Get Started Today Free Trial
July 16, 2007 - by jason
The one you feel comfortable configuring, maintaining and perhaps extending.
That one.
As web server/reverse proxy schizoserverphrenia tends to sweep through the Rails community from time to time, I see questions of which is “best” so I thought I’d add some numbers here.
These are from April-ish 2006, and were in various places on weblog.textdrive.com and joyeur.
So with
Some representative numbers with FreeBSD client -> FreeBSD web/proxy -> Solaris Rails application server
Litespeed Enterprise 2.1.14 -> Mongrel 0.3.12.4
Concurrency Level: 100
Requests per second: 1008.04 [#/sec] (mean)
Lighttpd 1.4.10 -> Mongrel 0.3.12.4
Concurrency Level: 100
Requests per second: 1010.36 [#/sec] (mean)
I was a fan of apache 1.3’s modaccel which was by the nginx dude, so 0.3.37 made it in
nginx 0.3.37 -> Mongrel 0.3.12.4
Concurrency Level: 100
Requests per second: 1016.40 [#/sec] (mean)
Zeus -> Mongrel 0.3.12.4
Concurrency Level: 100
Requests per second: 25.07 [#/sec] (mean)
(Zeus still did 1300+ req/sec on static files with the same configuration).
Apache 2.2 worker (with mod proxy balancer) -> Mongrel 0.3.12.4
Concurrency Level: 100
Complete requests: 10000
Requests per second: 1452.23 [#/sec] (mean)
Apache 2.0 using the prefork MPM, only mod_proxy
Concurrency Level: 100
Complete requests: 10000
Requests per second: 1070.59 [#/sec] (mean)
What’s the lesson I learned from this?
That when you spend a while tuning each, digging through their code and instrumenting, there is not a significant difference between these when it comes their ability to be a reverse proxy server in terms of throughput. There is a significant difference in what one does “out of the box” and there are more significant differences in their abilities to serve static files and in their memory footprints.
And there was one thing that became very clear though through all of them and that was differences in their horizontal scalability. Covered here
What do I like as the current?
F5 BIG-IPs -> Varnish -> F5 BIG-IPs -> Mongrel
Varnish by the way is a fine piece of software mainly written by the incredible PHK and with the VCL’ed PURGE function in which you can programmatically clear things from the cache (ticket). Did you hear what I said? You can have this very fast cache do all the caching for your Rails applications (or anything for that matter), and when something is updated in your application, you can actually have it ping the cache with a
"PURGE /images/207/123/52db760df37da63a1c9d94a1be6fcf6f.jpg HTTP/1.0"
Nice.
Mongrel has been good, but right now JRuby-Glassfish is doing a bit of a siren’s song because of some places it can help in the backend (and it also happens to be fast).
Level3 CDN -> F5 BIG-IPs -> Varnish -> Nginx
A CDN is a good thing, the F5’s are there because they’re faster than Varnish, and Varnish is faster than nginx (and also not a web server).