为什么不使用所有的线程?

我正在使用美洲狮和nxinx,并据我所知,它只是使用一个单一的线程,即使我用16个或更多的默认线程启动它。 我已经build立了一个新的rails应用程序,然后通过这里描述的设置:

http://blog.wiemann.name/rails-server

这给了这个例子nginxconfiguration:

upstream benchmarkapp.com {server unix:/tmp/benchmark_app.sock fail_timeout=0;} server { server_name benchmarkapp.com; root /home/tristan/benchmark_app/public; try_files $uri/index.html $uri @benchmarkapp.com; location @benchmarkapp.com { proxy_redirect off; proxy_pass http://benchmarkapp.com; } } 

然后创build一个简单的控制器动作,只是睡3秒,然后呈现“你好”:

 class WelcomeController < ApplicationController def index sleep(2) render :text => "hello" end end 

然后我开始使用puma: puma -t 16 -b unix:///tmp/benchmark_app.sock -S /tmp/benchmark_app.state

一旦运行,我用10个并发用户使用围攻打了它,结果如下

  % siege -c 10 -t 60s http://benchmarkapp.com ** SIEGE 2.70 ** Preparing 10 concurrent users for battle. The server is now under siege... HTTP/1.1 200 2.04 secs: 25 bytes ==> / HTTP/1.1 200 4.05 secs: 25 bytes ==> / HTTP/1.1 200 6.06 secs: 25 bytes ==> / HTTP/1.1 200 8.08 secs: 25 bytes ==> / HTTP/1.1 200 10.09 secs: 25 bytes ==> / 

这正是我期望看到的应用程序是否运行单线程。 采取前两个要求。 他们大致在同一时间到达。 第一个需要两秒钟,到目前为止这么好。 但第二,第三,…到第十都必须等待每个请求额外的2秒钟之前。 事实上,如果我重新启动只有一个线程的美洲狮,我得到这个结果。

我在这里做错了什么? 我怎样才能让服务器实际上使用所有的彪马产生的线程? 如果一切正常,我希望看到:

  % siege -c 10 -t 60s http://benchmarkapp.com ** SIEGE 2.70 ** Preparing 10 concurrent users for battle. The server is now under siege... HTTP/1.1 200 2.04 secs: 25 bytes ==> / HTTP/1.1 200 2.05 secs: 25 bytes ==> / HTTP/1.1 200 2.03 secs: 25 bytes ==> / HTTP/1.1 200 2.01 secs: 25 bytes ==> / HTTP/1.1 200 2.06 secs: 25 bytes ==> / 

我怎样才能做到这一点?