Choosing the right application server is one of the most impactful decisions you'll make when deploying a Ruby or Rails application to production. The wrong choice can mean sluggish response times, wasted memory, and deployment headaches that compound over time. In this guide, you'll get a practical comparison of the five leading Ruby application servers in 2026 — Passenger, Puma, Falcon, iodine, and Agoo — along with production configuration examples and deployment strategies that work with tools like DeployHQ's automated deployment platform. Whether you're running a small side project or a high-traffic production service, you'll walk away knowing exactly which server fits your workload.
Web Server vs Application Server: What's the Difference?
Before diving into Ruby application servers, it's worth clarifying a distinction that trips up many developers — especially those searching for terms like Nginx vs Ruby on Rails
, Apache vs Ruby
or best web server for Rails.
The short answer: Nginx, Apache and Caddy are not alternatives to Ruby or Rails. Ruby is a language and Rails is a framework; Nginx, Apache and Caddy are web servers. A production Rails app normally uses a web server and a Ruby application server together, so the real choices are which web server to put in front and which application server runs your code behind it.
Web servers like Nginx and Apache handle HTTP connections, serve static assets (images, CSS, JavaScript), terminate TLS/SSL, and act as reverse proxies. They don't execute your Ruby code. Application servers like Puma, Passenger, and Falcon run your Ruby process, execute your Rails controllers, and return dynamic responses.
In production, you almost always use both: Nginx or Apache sits in front, handling static files and SSL, while your application server runs behind it, processing the Ruby logic.
| Concern | Web Server (Nginx/Apache) | Application Server (Puma/Passenger/Falcon) |
|---|---|---|
| Role | Reverse proxy, static files, TLS | Execute Ruby code, run Rails app |
| Handles | HTTP connections, load balancing | Rack requests, middleware, controllers |
| Concurrency | Event-driven (Nginx) or process-based (Apache) | Threads, processes, or fibers depending on server |
| Static assets | Yes (very efficient) | Possible but wasteful |
| Ruby execution | No | Yes |
| Configuration | nginx.conf or httpd.conf |
puma.rb, Passengerfile.json, etc. |
When Apache or Nginx Matters for Your Rails App
If you're wondering which web server to put in front of your Rails application, Nginx is the standard choice for most modern deployments. It uses less memory per connection, handles concurrent static asset requests efficiently, and has simpler reverse proxy configuration. Apache remains viable if your infrastructure already relies on it or you need .htaccess support, but for new Rails deployments there's little reason to choose it over Nginx. Caddy is worth a look if you want automatic HTTPS with minimal configuration. For a side-by-side of the three, see our Nginx vs Apache vs Caddy web server comparison.
The more impactful decision — and the focus of this guide — is which application server sits behind your web server.
The Five Major Ruby Application Servers
Passenger (Phusion Passenger)
Passenger is the most established Ruby application server and the easiest to get started with. It integrates directly into Nginx or Apache as a module, which means you don't need to manage a separate process — your web server and application server run as one unit.
Best for: Teams that want minimal configuration and operational overhead.
# Passengerfile.json - production configuration
{
"environment": "production",
"port": 3000,
"min_instances": 2,
"max_pool_size": 6,
"spawn_method": "smart",
"friendly_error_pages": false
}
Pros:
- Simplest setup — especially with Nginx integration
- Auto-scales worker processes based on traffic
- Built-in process supervision (restarts crashed workers)
- Enterprise edition adds multi-threading and advanced monitoring
- Excellent documentation and commercial support
Cons:
- Free (open source) edition is process-only — no multi-threading
- Enterprise license costs money for the best features
- Heavier memory footprint compared to Puma in threaded mode
- Less flexibility for custom concurrency tuning
When to choose it: If you want a production server that just works
without deep tuning, Passenger is hard to beat. It's particularly good for teams without dedicated DevOps staff.
Puma
Puma is the default application server for Rails and the most widely deployed in the ecosystem. It uses a hybrid thread/process model: each worker process runs multiple threads, giving you concurrency within each process without the memory cost of spawning entirely separate processes.
At DeployHQ, we run Puma in production serving thousands of deployments daily. Through years of tuning, we've found that the thread-per-process ratio matters more than total worker count — over-threading leads to GVL contention, while under-threading wastes memory. Our sweet spot on 4-vCPU instances is 2 workers with 5 threads each, which balances memory usage against concurrency without starving the garbage collector.
Best for: Most Rails applications. It's the safe, well-tested default.
# config/puma.rb - production configuration
max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
threads min_threads_count, max_threads_count
worker_timeout 30
workers ENV.fetch("WEB_CONCURRENCY") { 2 }
preload_app! # default in clustered mode since Puma 7; kept here to be explicit
port ENV.fetch("PORT") { 3000 }
environment ENV.fetch("RAILS_ENV") { "production" }
before_worker_boot do
ActiveRecord::Base.establish_connection
end
Upgrading from Puma 6? Puma 7.0 renamed its lifecycle hooks: on_worker_boot became before_worker_boot, on_worker_shutdown became before_worker_shutdown, on_restart became before_restart, and on_booted became after_booted. The old names still work in current releases but log deprecation warnings, so it's worth renaming them while you're in config/puma.rb. Puma 7 also made preload_app! the default in clustered mode.
Pros:
- Rails default — massive community and ecosystem support
- Hybrid thread/process model for efficient resource usage
- Hot restarts with
pumactl phased-restart(no dropped requests) - Mature, battle-tested in high-traffic production environments
- Excellent Kubernetes and container compatibility
Cons:
- Threads share the GVL (Global VM Lock) in MRI Ruby, limiting true parallelism
- Requires more tuning than Passenger for optimal performance
- Thread safety issues in gems can cause subtle production bugs
When to choose it: Unless you have a specific reason not to, Puma should be your starting point. It's the community standard, it works reliably, and every hosting provider and deployment tool supports it — including DeployHQ's build pipeline, which can run bundle exec puma as part of your deployment process.
Falcon
Falcon is the newest entrant and the most architecturally interesting. Built on the async gem, it uses Ruby fibers for cooperative concurrency — meaning a single thread can handle thousands of concurrent connections by yielding during I/O waits. If your application spends most of its time waiting on database queries, HTTP API calls, or file reads, Falcon can dramatically outperform thread-based servers.
Best for: I/O-heavy applications, real-time features (WebSockets, streaming), and teams willing to invest in async-compatible code.
# falcon.rb - production configuration
#!/usr/bin/env falcon --verbose serve
load :rack, :supervisor
hostname = File.basename(__dir__)
rack hostname do
endpoint Async::HTTP::Endpoint.parse("http://0.0.0.0:9292")
end
supervisor
Pros:
- Exceptional throughput for I/O-bound workloads
- Low memory per connection (fibers are lightweight)
- Native HTTP/2 support
- WebSocket support without additional gems
- Can handle thousands of concurrent connections on a single process
Cons:
- Requires the
asyncecosystem — not all gems are compatible - Smaller community and fewer production case studies
- Debugging fiber-based concurrency is harder than debugging threads
- Not a drop-in replacement for Puma in CPU-heavy applications
When to choose it: If your app makes heavy use of external API calls, database queries, or real-time features, and you're comfortable with the async ecosystem. Not recommended as a first choice for typical CRUD Rails apps.
iodine
iodine is a C-extension-based server that implements its own event loop rather than relying on Ruby's threading. This gives it very low overhead per connection and makes it well-suited for applications that mix HTTP with WebSocket connections — it handles both natively without extra gems.
Best for: Mixed HTTP/WebSocket applications and developers who want raw performance without the async gem ecosystem.
# config/iodine.rb
Iodine.threads = ENV.fetch("IODINE_THREADS") { 5 }.to_i
Iodine.workers = ENV.fetch("IODINE_WORKERS") { 2 }.to_i
Iodine::DEFAULT_SETTINGS[:port] = ENV.fetch("PORT") { "3000" }
# WebSocket pub/sub built in
Iodine.listen2http(
public: "public/",
handler: Rack::Builder.new { run Rails.application }.to_app
)
Pros:
- Very fast HTTP parsing (C extension)
- Built-in WebSocket and pub/sub support
- Low memory overhead per connection
- Simple API for real-time features
Cons:
- Smaller community — fewer resources and tutorials
- C extension can complicate deployment on some platforms
- Less integration with standard Rails deployment patterns
- Limited documentation compared to Puma or Passenger
When to choose it: If you need WebSocket support without adding ActionCable overhead, or if you want a lightweight server with native pub/sub.
Agoo
Agoo is a high-performance HTTP server written in C with a Ruby wrapper. It focuses purely on raw speed and is designed for API-only applications where you want maximum requests per second with minimal overhead.
Best for: JSON API services and microservices where throughput is the primary concern.
# config.ru with Agoo
require 'agoo'
Agoo::Server.init(3000, 'root')
class MyHandler
def call(req)
[200, { 'Content-Type' => 'application/json' }, ['{"status":"ok"}']]
end
end
Agoo::Server.handle(:GET, "/health", MyHandler.new)
Agoo::Server.start
Pros:
- Extremely fast for simple HTTP responses
- Low resource consumption
- GraphQL support built in
- Minimal memory footprint
Cons:
- Not designed for full Rails applications
- Very small community
- Limited middleware support
- C dependency can cause build issues on some platforms
- Rack compatibility is incomplete for complex applications
When to choose it: API-only microservices where you need maximum raw throughput and don't need the full Rails stack.
Deploying Your Ruby Application Server
Regardless of which server you choose, the deployment workflow follows a similar pattern. Here's how to set up a reliable deployment pipeline using DeployHQ.
Step 1: Configure Your Server
Add your application server to your Gemfile:
# Gemfile
gem 'puma', '~> 8.0' # Most common choice
# gem 'passenger', '~> 6.2' # Alternative
# gem 'falcon', '~> 0.57' # For async workloads
Step 2: Set Up Your Deployment Pipeline
With DeployHQ's automatic deployments from GitHub, you can trigger deployments on every push to your main branch. Configure your build commands to install dependencies and precompile assets:
# Build commands in DeployHQ
bundle config set --local deployment 'true'
bundle config set --local without 'development test'
bundle install
bundle exec rake assets:precompile
The --deployment and --without flags on bundle install are deprecated in Bundler 2, which is why the settings are applied with bundle config instead.
Run database migrations on the server (as an SSH command after the code is uploaded), not in the build step: the build environment shouldn't need credentials for your production database. If a migration and a code change have to ship together, our guide to database migration strategies for zero-downtime deployments covers the expand-and-contract pattern. Coming from Capistrano? Our Capistrano alternative comparison covers when scripted deploys still make sense and when a GUI-driven pipeline is simpler.
Step 3: Configure Zero-Downtime Restarts
For Puma, use phased restarts so existing requests complete before workers are replaced. Add a deploy hook in DeployHQ:
# Post-deployment SSH command
bundle exec pumactl phased-restart
This pairs well with zero downtime deployments — DeployHQ deploys your code to a new release directory and symlinks it, so there's never a moment where your application is unavailable. If you want to see how the release-directory layout works under the hood, read how atomic symlink deployments work on a single VPS.
Step 4: Set Up Rollback Safety
If a deployment introduces a bug, you need to recover fast. DeployHQ's one-click rollback lets you revert to the previous release instantly — no redeployment needed. This is especially important when changing application server configurations, since a misconfigured thread count or worker setting can take your app down.
If you don't have a server yet, our walkthrough on hosting a Rails app on a DeployHQ managed VPS covers provisioning, Puma and Nginx end to end. Already have a server? Follow our step-by-step guide to deploying a Rails app with DeployHQ to connect it and ship your first release.
Nginx Reverse Proxy Configuration
Regardless of your application server choice, you'll want Nginx in front:
# /etc/nginx/sites-available/myapp
upstream app_server {
server 127.0.0.1:3000 fail_timeout=0;
}
server {
listen 80;
server_name example.com;
root /var/www/myapp/current/public;
location ^~ /assets/ {
gzip_static on;
expires max;
add_header Cache-Control public;
}
location / {
try_files $uri @app;
}
location @app {
proxy_pass http://app_server;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_redirect off;
}
}
If Nginx returns a 502 after a deploy, the application server usually isn't listening on the upstream address yet (or crashed during boot). Our guide to fixing Nginx 502 Bad Gateway errors walks through the common causes.
For detailed server configuration in DeployHQ, see the shell server setup guide.
Choosing the Right Server: Decision Guide
flowchart TD
A[New Ruby/Rails Project] --> B{What type of app?}
B -->|Full Rails app| C{Need WebSockets?}
B -->|API only / microservice| D{Need max throughput?}
C -->|No| E[Puma]
C -->|Yes, heavy usage| F{Comfortable with async?}
F -->|Yes| G[Falcon]
F -->|No| H[iodine]
D -->|Yes, minimal framework| I[Agoo]
D -->|Standard Rails API| E
A --> J{Want minimal ops?}
J -->|Yes| K[Passenger]
Quick Recommendation Matrix
| Scenario | Recommended Server | Why |
|---|---|---|
| Standard Rails app | Puma | Battle-tested default, excellent community support |
| Minimal DevOps team | Passenger | Auto-scales, auto-restarts, least tuning needed |
| Heavy I/O / external APIs | Falcon | Fiber-based concurrency handles I/O waits efficiently |
| Mixed HTTP + WebSocket | iodine | Native WebSocket support without ActionCable overhead |
| High-throughput JSON API | Agoo | Raw speed for simple request/response patterns |
| Containerized / Kubernetes | Puma | Mature container support and a hybrid thread/process model |
| Legacy app, risk-averse | Passenger | Most forgiving of misconfiguration |
Production Tuning Tips
Memory-Based Worker Calculation
A common mistake is setting workers based on CPU count alone. In practice, memory is usually the bottleneck. Use this formula:
# Calculate workers based on available memory
available_memory_mb = 1500 # e.g., 2GB container minus OS overhead
per_worker_mb = 250 # Typical Rails app memory per worker
workers = (available_memory_mb / per_worker_mb).floor
# => 6 workers
Thread Safety Checklist
Before enabling multiple threads in Puma, verify:
- Your application code is thread-safe (no shared mutable state)
- All gems in your
Gemfiledeclare thread safety - Database connection pool matches thread count:
pool: ENV.fetch("RAILS_MAX_THREADS") { 5 } - External service clients (Redis, Elasticsearch) use connection pooling
- No use of class-level mutable variables (
@@varor@varon class objects)
Monitoring Ruby Application Servers in Production (APM and Server Metrics)
General-purpose APM dashboards tell you that a request was slow. They don't always tell you why: whether the time went on your code, on waiting for a free Puma thread, or on waiting for Ruby's Global VM Lock (GVL). For Ruby application servers, these are the signals worth wiring up first.
| Signal | What it tells you | Where it comes from |
|---|---|---|
| Request queue time | Time between Nginx accepting a request and your app starting to process it. Rising queue time means you need more workers or threads, not faster code | X-Request-Start header set by Nginx, read by your APM agent |
| Puma backlog and busy threads | Requests waiting for a free thread, and how many threads are working | Puma.stats / pumactl stats |
| GVL wait time | Time threads spend waiting to run Ruby code. High values mean too many threads per process | gvltools gem (Ruby 3.2+) |
| Worker memory (RSS) | Memory growth per worker. A steady climb usually means a leak or bloat, not traffic | Process metrics, APM agent, passenger-status for Passenger |
| Errors per release | Whether a spike started with a specific deploy | Error tracker with release tracking |
Measure request queue time at Nginx
Queue time is the clearest signal that your application server is under-provisioned, and it's invisible unless the front-end web server stamps each request. Add this to the location @app block from the Nginx config above:
proxy_set_header X-Request-Start "t=${msec}";
${msec} is the current time in seconds with millisecond resolution. APM agents such as New Relic's Ruby agent read this header and report the gap as queue time; check your vendor's docs for the exact header format it expects.
Read Puma's own stats
Puma exposes thread-pool stats through its control app. Enable it with an auth token and keep the socket private:
# config/puma.rb
activate_control_app "unix:///var/run/pumactl.sock", { auth_token: ENV.fetch("PUMA_CONTROL_TOKEN") }
pumactl -C unix:///var/run/pumactl.sock -T "$PUMA_CONTROL_TOKEN" stats
In clustered mode the output includes per-worker backlog, running, pool_capacity, busy_threads, max_threads and requests_count. A backlog that stays above zero and a pool_capacity near zero means every thread is busy and requests are queuing inside Puma. Inside the app, Puma.stats_hash returns the same data as a Hash.
If you already run Prometheus, you don't need to poll this yourself. yabeda-puma-plugin (plugin :yabeda plus activate_control_app) and Discourse's prometheus_exporter (PrometheusExporter::Instrumentation::Puma.start) both export Puma metrics.
One common misreading: Puma's backlog is not a GVL metric. It counts requests waiting for a thread. To see GVL contention you need to measure it directly.
Measure GVL contention before adding threads
Shopify's gvltools gem uses the GVL instrumentation API added in Ruby 3.2. GVLTools::LocalTimer records how long the current thread waited on the GVL (in nanoseconds), so a small Rack middleware can log it per request:
# config/initializers/gvl_instrumentation.rb
GVLTools::LocalTimer.enable
class GVLWaitMiddleware
def initialize(app)
@app = app
end
def call(env)
before = GVLTools::LocalTimer.monotonic_time
response = @app.call(env)
waited_ms = (GVLTools::LocalTimer.monotonic_time - before) / 1_000_000.0
Rails.logger.info("gvl_wait_ms=#{waited_ms.round(2)}")
response
end
end
Rails.application.config.middleware.use GVLWaitMiddleware
If GVL wait is a large share of response time, lower RAILS_MAX_THREADS and add workers instead. The gem's authors note the instrumentation has a cost (early testing showed a 1-5% slowdown on a saturated multi-threaded app), so enable it on a subset of processes or for short periods.
Choosing a Ruby APM tool
Every major APM vendor ships a Ruby agent that understands Rails, Puma, Sidekiq and Active Record. The difference is mostly scope and price model:
| Tool | Best fit |
|---|---|
| New Relic, Datadog | Teams that want Ruby APM inside a wider infrastructure and logging platform |
| Scout APM, AppSignal, Skylight | Rails-focused teams that want an opinionated, app-centric view with less setup |
| Sentry | Teams that already use it for error tracking and want performance tracing alongside |
| OpenTelemetry | Vendor-neutral tracing you can send to any backend |
If you're weighing the vendor-neutral route, our OpenTelemetry setup guide for metrics, traces and logs covers the collector and SDK side.
Tie regressions to deploys
Whichever APM you pick, mark deploys on it. A latency or error spike that starts at the same minute as a release is the fastest root cause you'll get. DeployHQ can notify Sentry of each deployment so every error is linked to the release that introduced it — see how to tie Sentry errors to the DeployHQ deploy that caused them. Pair that with one-click rollback and a bad Puma config change becomes a short incident instead of a long one.
FAQ
Q: Is Nginx an alternative to Ruby on Rails? No. Nginx (like Apache or Caddy) is a web server: it terminates TLS, serves static files and proxies requests. Ruby on Rails is the framework your application is written in, and it runs inside a Ruby application server such as Puma or Passenger. In production you typically run Nginx in front of Puma, not one instead of the other.
Q: Can I use Puma without Nginx in production? Yes, Puma can serve directly, but it's not recommended. Nginx handles static assets more efficiently, provides SSL termination, and protects against slow-client attacks that can tie up your Ruby workers. The exception is containerized deployments behind a load balancer that handles TLS — in that case, Puma can serve directly.
Q: Does Falcon work with standard Rails apps out of the box?
It can run a Rails app, but you won't see the full benefit unless your code uses the async gem for I/O operations. A standard synchronous Rails app will work but won't outperform Puma significantly. The real advantage comes when you rewrite database calls and HTTP requests to use async adapters.
Q: How many Puma workers should I run? Start with one worker per CPU core, then adjust based on memory. On a 2 GB server with a typical Rails app using ~300 MB per worker, 4 workers would be too many. Monitor memory usage in production and scale accordingly. More threads per worker (up to 5-8) is often more efficient than more workers.
Q: Is Passenger worth the Enterprise license cost? If you're running more than 3-4 production servers and don't have dedicated DevOps staff, the Enterprise edition pays for itself in reduced operational overhead. The multi-threading support alone can cut your server costs by 30-50% compared to the process-only open source edition.
Q: Which server is best for deploying with DeployHQ?
All five servers work with DeployHQ's Git deployment automation. Puma and Passenger are the most straightforward to configure — you set your start/restart commands in the deployment hooks and DeployHQ handles the rest. For any server, you can use build pipelines to run bundle install, asset precompilation, and database migrations before the server restarts.
Ready to deploy your Ruby application with confidence? Sign up for DeployHQ and set up your first deployment in under five minutes. Or explore DeployHQ's pricing plans to find the right fit for your team.
If you're working with other languages alongside Ruby, you might also find our guide on Python application servers (WSGI vs ASGI) useful — many of the same principles around web server vs application server apply.
Have questions about deploying Ruby applications? Reach out to us at support@deployhq.com or find us on Twitter/X @deployhq.