Martin Svoboda Martin Svoboda - 1 year ago 93
Ruby Question

Clustered puma not accepting more than 1 request concurrently

I have setup my puma web server based on heroku manual: Deploying Rails Applications with the Puma Web Server


workers Integer(ENV['WEB_CONCURRENCY'] || 2)
threads_count = Integer(ENV['RAILS_MAX_THREADS'] || 2)
threads threads_count, threads_count


rackup DefaultRackup
port ENV['PORT'] || 3000
environment ENV['RACK_ENV'] || 'development'

on_worker_boot do


web: bundle exec puma -C config/puma.rb

Now when I try to access action which has
sleep 10
which delays the response and then try to access some other action, my understanding was that Puma would handle these 2 requests concurrently (since I have 2 workers). But instead it waits for the first request which sleeps to finish then it proceeds to the second one. Am i missing something?

My setup is:

  • Ruby 2.2.4

  • Rails 4.2.0


Ok, so I found out that on Heroku, it works, so question is, why it doesn't work in development mode?

Answer Source

rails s does not use the Procfile, you may want to look at using a tool like foreman:

update: this was the solution:

config.allow_concurrency = true in the rails development config.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download