[Mongrel] compress and max upload size?

Xavier Noria fxn at hashref.com
Sat Dec 9 14:05:04 EST 2006


On Dec 9, 2006, at 7:15 PM, Xavier Noria wrote:

> On Dec 9, 2006, at 4:57 PM, Xavier Noria wrote:
>
>> Well, looks like the limit is working with Nginx, but I get very poor
>> performance compared to Apache, same server machine, same (remote)
>> stress machine. Apache is serving about 17 req/s, whereas Nginx is
>> serving about 5 req/s. Since Nginx is known to be fast I bet my
>> config, albeit simple, is somehow wrong. I attach it below in case
>> some experienced eye catches something.
>
> I think I got something. The Content-Length reported by ab for Apache
> is 4K, and for Nginx is 19K, so my guess is that compression is not
> being triggered. If I use wget content is not compressed either. But
> it comes compressed if I use Firefox.
>
> That would explain the difference. I will try another stress tool  
> then.

Indeed, that was the problem.

Once I've got compressed content, we go up to about 10 req/s, still  
not close to the 17 req/s of Apache. I think I don't have evidence of  
the speed of Nginx + mongrel_cluster for my particular application at  
least, so I'll get back to Apache 2.2.3 + mod_proxy_balancer.

-- fxn

The Nginx config is:

user  daemon;

error_log  logs/error.log;
pid        logs/nginx.pid;

events {
     worker_connections  1024;
}

http {
     include       conf/mime.types;
     default_type  application/octet-stream;

     gzip on;
     gzip_types   text/plain text/css application/x-javascript text/xml;
     gzip_proxied any;
     gzip_comp_level 2;
     gzip_http_version 1.0; # for ab and wget

     upstream mongrel {
         server 127.0.0.1:3001;
         server 127.0.0.1:3002;
         server 127.0.0.1:3003;
     }

     # based on http://brainspl.at/articles/2006/09/12/new-nginx-conf- 
with-rails-caching
     server {
         listen       80;
         root /home/oper/www/public;
         client_max_body_size 1M;

     	# this rewrites all the requests to the maintenance.html
         # page if it exists in the doc root. This is for capistrano's
         # disable web task
     	if (-f $document_root/maintenance.html){
             rewrite  ^(.*)$  /maintenance.html last;
     		break;
     	}

         location ^~ \.flv$ {
             flv;
         }

         location / {
             proxy_set_header  X-Real-IP  $remote_addr;
             proxy_set_header  X-Forwarded-For  
$proxy_add_x_forwarded_for;
             proxy_set_header Host $http_host;
             proxy_redirect false;
             if (!-f $request_filename) {
               proxy_pass http://mongrel;
               break;
             }
         }

         error_page   500 502 503 504  /50x.html;
         location = /50x.html {
             root   html;
         }
     }
}



More information about the Mongrel-users mailing list