[Mongrel] Mongrel performing only half as fast as Apache?

Christos Zisopoulos christos at fetaphunk.com
Tue Feb 27 21:14:37 EST 2007


Mongrel is not meant to serve static files. It is meant to replace  
the FCGI part of doing Apache->FCGI->Ruby. Or WhateverBalancer->FCGI- 

As Ezra put its here, http://f8p.com/96ktde , "...it is horribly  
ineficient to serve static files with mongrel..."

Most mongrel setups (ones with Apache) use mod_rewrite to server the  
static files through apache (including cached rails html files).

Try this vhost template ( http://f8p.com/6d6i0s ) that uses  
mod_rewrite to serve static HTML through Apache.


On 28 Feb 2007, at 01:48, Christopher Bailey wrote:

> As additional info, I ran the same kind of tests with Pen and Nginx  
> instead of Apache+mod_proxy_balancer, just to get an idea on that  
> aspect:
> Pen with 1 Mongrel: ~671 req/sec
> Nginx with 1 Mongrel: ~612 req/sec
> So these at least show a smaller overhead for the load balancer  
> aspect.  They also are more bare-minimum configured (I don't have  
> much experience with either of those, so just did the basic Pen  
> setup where you tell it what port to run on and the ports/domain 
> +port it's proxying).
> On 2/27/07, Christopher Bailey <chris at codeintensity.com> wrote: I'm  
> trying to do some initial benchmarking of our setup, mainly just to  
> establish baselines.  I'm essentially using the process Zed  
> outlines in a previous message:
> http://rubyforge.org/pipermail/mongrel-users/2006-May/000200.html
> What I'm running into is that Mongrel appears only half as fast as  
> Apache when serving a small static HTML file.  If I then add in  
> Apache with mod_proxy_balancer, going to a single Mongrel, it drops  
> down to nearly about a third of what pure static Apache will do.   
> This seems bogus to me, and I suspect I have either some  
> configuration problem, or something.  My understanding from what  
> I've read is that Mongrel should be fairly close to Apache when  
> serving static content (at least not only 50% as fast).  Is that  
> right as a generalization?
> Here's some info to back this up.
> - Server: HP DL360 dual 3.0GHz Xeons, 4GB RAM, 10k RPM SCSI disks
> - OS: Fedora Core 6, up to date as of a few days ago, kernel 2.6.18  
> smp
> - Apache 2.2.3, with mod_proxy_balancer (the RPM install)
> - Mongrel 1.0.1, mongrel_cluster 0.2.1
> - ruby 1.8.5 (2006-12-04 patchlevel 2)
> - serving a static HTML file from the Rails app's public directory
> - Testing using an identical server, that sits above this one in  
> the rack, connected to a switch (so it's one hop)
> - Using httperf for testing, with the following command:
>   httperf --server lab05 --port 80 --uri /mongrel_alive.html --num- 
> conns 10000
> The number of connections I vary to be near the 10 second mark...
> Here's the results:
> - Just Apache, num-conns=15000, ~1400 req/sec
> - Direct to Mongrel on port 5000, num-conns=8000, ~740 req/sec
> - Apache mod_proxy_balancer to a single Mongrel, num-conns=5000,  
> ~475 req/sec
> So, I'm incurring a massive penalty for the balancer/cluster  
> setup.  In production we will be using hardware load balancers, but  
> even still, my understanding was that instead of a drop from 1400  
> to 740, it should be somewhat closer (say at least over 1000).
> My configuration is what seems to be the usual thing documented say  
> in Rails Cookbook, on various blogs, and so on.  I can post the  
> details if needed.
> What would folks suggest, or what comments do you have?
> _______________________________________________
> Mongrel-users mailing list
> Mongrel-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/mongrel-users

More information about the Mongrel-users mailing list