evanphx/puma — Issue #23: all requests on a single thread
Author: yob
Created: 2011-12-19 05:39:28+00:00
State: open

I've just tried puma on a rails 3.1.1 app. I added 'config.threadsafe!' to 'config/environments/production.rb' and get the following output when I boot the app:

⚡ RAILS_ENV=production bundle exec puma --threads 0:3
Puma 0.9.1 starting...
* Min threads: 0, max threads: 3
* Listening on tcp://0.0.0.0:9292
Use Ctrl-C to stop

I then created a controller action that looks like this:

def index
product.connection.select_all("select sleep(10)")
render :text => "I should have taken 10 seconds! (id: #{Thread.current.object_id})"
end

If I make 2 concurrent requests they seem to execute serially and the thread ID is identical. Am I missing something?