What about Apache to Mongrel for Rails applications?
So what about Apache 2 using the prefork MPM?
This is our vanilla (and fat) Apache 2.0.x install.
Server Hostname: mongrel-ap.textdrive.com
Server Port: 80
Concurrency Level: 100
Complete requests: 10000
Requests per second: 431.57 [#/sec] (mean)
By fat, I mean this thing does mod_security, php, fcgi, DAV, SVN and has other authentication modules for MySQL and IMAP.
Let’s turn some stuff off
Let’s do a couple of things: let’s turn off mod_security as an input filter and let’s set KeepAlive Off
Server Hostname: mongrel-ap.textdrive.com
Server Port: 80
Concurrency Level: 100
Complete requests: 10000
Requests per second: 904.47 [#/sec] (mean)
Let’s start up more servers since we’re hitting it with a concurrency of 100
Was
<IfModule prefork.c>
StartServers 30
MinSpareServers 30
MaxSpareServers 55
ServerLimit 600
MaxClients 400
MaxRequestsPerChild 2500
ListenBacklog 1000
</IfModule>
Now
<IfModule prefork.c>
StartServers 100
MinSpareServers 10
MaxSpareServers 10
ServerLimit 10000
MaxClients 10000
MaxRequestsPerChild 2500
ListenBacklog 1000
</IfModule>
Server Hostname: mongrel-ap.textdrive.com
Server Port: 80
Concurrency Level: 100
Complete requests: 10000
Requests per second: 882.98 [#/sec] (mean)
Not too much of a change.
Let’s add some stuff
EnableSendfile On
EnableMMAP On
Server Hostname: mongrel-ap.textdrive.com
Server Port: 80
Concurrency Level: 100
Complete requests: 10000
Requests per second: 982.27 [#/sec] (mean)
OK that’s the best so far.
Hmm … what else can I do with this (without turning off our SVN, DAV etc)
Ah, I’ll turn off .htaccess and input filtering by mod_deflate as well
Server Hostname: mongrel-ap.textdrive.com
Server Port: 80
Concurrency Level: 100
Complete requests: 10000
Requests per second: 1070.59 [#/sec] (mean)
But I’ll turn those back on, no biggie.
The biggest hit actually comes from mod_security, restoring it after all the other changes pushed it back down to about 500 requests/second.
And this is very respectable by the way considering that just did a little better than lighttpd and litespeed for proxying to mongrel.
Joyent.com is a little PHP (mod_php) site with no database backend and under the same conditions it does
Requests per second: 588.36 [#/sec] (mean)
And the other and last point is that this is still a slow Apache because it’s prefork on FreeBSD and still doing rewrites, DAV, SVN and has several third party auth modules. I’m certain that it’s performance can be taken up several fold with a slim and trim proxy-only Apache 2.2 instance using the worker or event MPM.
There is also now a load-balancing extension for mod_proxy in Apache 2.2
There also wasn’t an appreciable load difference when using Apache and it’s nice to see the same mongrel processes stay at ~28MB (I used the same exact mongrel process with 4 threads for apache, lighttpd and litespeed).
·:· Posted 17 April 2006, 02:27 by Jason Hoffman to Rails |

I think they will all be faster than prefork… but its hard to tell in this test, since it doesn’t seem to stress the webserver, and instead the load is on the mongrel backend.
— Paul Querna 17 April 2006, 03:39 #
So the plan is to fire up the worker MPM and then the event MPM on our solaris boxes (we run from latest Nevada build) and fire off a big set from there.
— jason Hoffman 17 April 2006, 03:47 #
— Josh Peek 18 April 2006, 02:09 #