[Mongrel] compress and max upload size?

Xavier Noria fxn at hashref.com
Sat Dec 9 10:57:58 EST 2006

On Dec 9, 2006, at 2:38 PM, Xavier Noria wrote:

> Yeah, I tried that yesterday and got no response so far. Before
> patching Mongrel, looks like ngnix supports that limit and would be a
> good or even better choice for our application than Apache, I am
> right now testing it.

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.

-- fxn

tested with: ab -t 60 -c 5 -H 'Accept-Encoding: gzip'  

Nginx (5 req/s)

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;

     sendfile on;

     gzip on;
     gzip_proxied any;
     gzip_types text/html text/plain text/xml text/css application/x- 

     client_max_body_size 1M;

     upstream mongrel {

     server {
         listen       80;
         server_name  www.example.com;
         root /home/oper/www/public;

         location ^~ \.flv$ {

         location / {
             if (!-f $request_filename) {
                 proxy_pass  http://mongrel;

         error_page  404              /404.html;

         # redirect server error pages to the static page /50x.html
         error_page   500 502 503 504  /50x.html;
         location = /50x.html {
             root   html;

Apache (17 req/s)

NameVirtualHost *:80

# Configure the balancer to dispatch to the Mongrel cluster.
<Proxy balancer://example_cluster>

# Setup the VirtualHost for your Rails application
<VirtualHost *:80>
   ServerAdmin admin at example.com
   ServerName  www.example.com
   ServerAlias localhost

   DocumentRoot /path/to/example/public
   <Directory '/path/to/example/public'>
     Options FollowSymLinks
     AllowOverride None
     Order allow,deny
     Allow from all

   ProxyPass / balancer://example_cluster/
   ProxyPassReverse / balancer://example_cluster/

   # Setup your Rewrite rules here
   RewriteEngine On

   # Rewrite index to check for static
   RewriteRule ^/$ /index.html [QSA]

   # Send all requests that are not found as existing files to the  
   RewriteRule ^/(.*)$ balancer://example_cluster%{REQUEST_URI}  

   # Deflate
   AddOutputFilterByType DEFLATE text/html text/plain text/xml text/ 
css application/x-javascript

   # Error logs
   ErrorLog /path/to/example/log/apache_error_log
   CustomLog /path/to/example/log/apache_access_log combined

More information about the Mongrel-users mailing list