What is the role of Puma in Rails deployment?

Answer

Puma is Rails' default web server (since Rails 5). It is a concurrent, multi-threaded Rack server designed for production. Key features: multi-threaded (handles multiple requests per process simultaneously using threads — allows connection pool sharing), cluster mode (multiple worker processes, each multi-threaded — called "workers" + "threads"), and socket binding (can listen on TCP or Unix sockets). Configure via config/puma.rb: workers ENV.fetch("WEB_CONCURRENCY") { 2 }; threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }. In production, Puma sits behind Nginx (reverse proxy + static file serving). Puma handles graceful restarts (phased-restart) for zero-downtime deploys.