I&#39;m using nginx to serve files cached by merb.  Passenger/mod_rails to deals with requests not served by the cache.  merb is not touched by the test case here.  all test (cached) files are handled by nginx or passenger.<div>
<br></div><div>Nginx can serve a cached file ~5,000 / sec.   That drops to 5 / sec when &quot;passenger_enabled on.&quot;  Please see the notes in the body of the server block of the nginx.conf below.  Anyone know the cause of this drop?</div>
<div><br></div><div>OS: Ubuntu 9.10, 32bit</div><div>Nginx: 0.8.31, compiled with headers-more 0.07 + Passenger: 2.2.8 without OpenSSL</div><div><br></div><div>TIA,</div><div>Ming</div><div><br></div><div>nginx.conf:</div>
<div><br></div><div><div>events {</div><div>    worker_connections  1024;</div><div>}</div><div><br></div><div><br></div><div>http {</div><div>    passenger_root /usr/lib/ruby/gems/1.8/gems/passenger-2.2.8;</div><div>    passenger_ruby /usr/bin/ruby1.8;</div>
<div>    passenger_log_level 0;</div><div><br></div><div>    include       mime.types;</div><div>    default_type  application/octet-stream;</div><div><br></div><div>    log_format  main  &#39;$remote_addr - $remote_user [$time_local] &quot;$request&quot; &#39;</div>
<div>                      &#39;$status $body_bytes_sent &quot;$http_referer&quot; &#39;</div><div>                      &#39;&quot;$http_user_agent&quot; &quot;$http_x_forwarded_for&quot;&#39;;</div><div><br></div><div>    access_log  logs/access.log  main;</div>
<div><br></div><div>    sendfile        on;</div><div>    #tcp_nopush     on;</div><div><br></div><div>    #keepalive_timeout  0;</div><div>    keepalive_timeout  65;</div><div><br></div><div>    #gzip  on;</div><div><br>
</div><div>    server {</div><div>        listen       80;</div><div>        server_name  myapp.local;</div><div>        root<span class="Apple-tab-span" style="white-space:pre">        </span>     /var/www/myapp/public;</div><div>
<br></div><div>        rack_env development;</div><div><br></div><div>        access_log  logs/host.access.log  main;</div><div><br></div><div>        location ~* \.(ico|css|js|gif|jpe?g|png|swf)$ {</div><div>           break;</div>
<div>        }</div><div><br></div><div>        passenger_enabled on; &lt;-- on = 5 requests / sec, off = 5K requests / sec</div><div><br></div><div>       # code below is not necessary for passenger to serve cached files.  if i &quot;passenger_enabled on&quot; and optionally delete the code below, nginx will serve ~5 requests/ sec or less; if i keep the code and passenger_enable off, nginx will serve ~5,000 requests /sec</div>
<div><br></div><div>        if (-f $request_filename) {</div><div>  <span class="Apple-tab-span" style="white-space:pre">        </span>  break;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div>
<br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span># cached pages</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>set $cache_extension &#39;&#39;;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>if ($request_method = GET) {</div>
<div>  <span class="Apple-tab-span" style="white-space:pre">        </span>   set $cache_extension &#39;.html&#39;;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span># the above is a hack because nginx doesn&#39;t allow nested or ANDed ifs</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>if (-f $request_filename$cache_extension) {</div><div>           #more_set_headers  &quot;Content-Encoding: gzip&quot;;</div><div>  <span class="Apple-tab-span" style="white-space:pre">        </span>   rewrite (.*) $1.html break;</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div>}</div><div><br></div></div><div> </div>