passenger_enabled slows down nginx dramatically
Ming
minger at gmail.com
Wed Jan 6 19:36:34 MSK 2010
I'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.
Nginx can serve a cached file ~5,000 / sec. That drops to 5 / sec when
"passenger_enabled on." Please see the notes in the body of the server
block of the nginx.conf below. Anyone know the cause of this drop?
OS: Ubuntu 9.10, 32bit
Nginx: 0.8.31, compiled with headers-more 0.07 + Passenger: 2.2.8 without
OpenSSL
TIA,
Ming
nginx.conf:
events {
worker_connections 1024;
}
http {
passenger_root /usr/lib/ruby/gems/1.8/gems/passenger-2.2.8;
passenger_ruby /usr/bin/ruby1.8;
passenger_log_level 0;
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request"
'
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name myapp.local;
root /var/www/myapp/public;
rack_env development;
access_log logs/host.access.log main;
location ~* \.(ico|css|js|gif|jpe?g|png|swf)$ {
break;
}
passenger_enabled on; <-- on = 5 requests / sec, off = 5K requests /
sec
# code below is not necessary for passenger to serve cached files.
if i "passenger_enabled on" 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
if (-f $request_filename) {
break;
}
# cached pages
set $cache_extension '';
if ($request_method = GET) {
set $cache_extension '.html';
}
# the above is a hack because nginx doesn't allow nested or ANDed ifs
if (-f $request_filename$cache_extension) {
#more_set_headers "Content-Encoding: gzip";
rewrite (.*) $1.html break;
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20100106/bd1bda66/attachment.html>
More information about the nginx
mailing list