Passenger Benchmark (on Apache/Nginx)
For the last few days I’ve been putting Thin and Unicorn behind Apache, Nginx and Cherokee acting as proxies. The day would finally come where the all mighty Passenger would come to dance with the rest of its partners.
This benchmark is focused on Passenger’s performance on Apache and Nginx and, of course, an analysis is made on the achieved results.
Setup and test
The setup is pretty similar to the previous benchmarks. Apache, Nginx and Passenger versions are as follows:
- Apache 2.2.14
- Nginx 0.7.64
- Passenger 2.2.10
The Ruby interpreter used was MRI, version 1.8.7.2010.01. This is done in order to make these benchmarks fair, since MRI was also used in Thin’s/Unicorn’s benchmarks and in the future all these benchmarks will come together.
As for the test itself, the environment used was the same from the previous benchmarks - 3 pages (one light, two heavy) and 5 request/concurrency variants (ranging from 50/1 to 2500/500). Apache ab was used to preform to endure the benchmark.
Configuration
Following the same line of fairness mentioned before, only 4 instances of Rails were used, although I noticed that Apache spawned a lot of Rails processes despite being instructed otherwise. The important sections of each web server configuration are as follows:
Some of you may notice the StartServers 20 line, in contradiction to Nginx’s worker_processes 1;. I actually needed to improve Apache’s configuration over Nginx’s to achieve a similar degree of scalability. Standing in the same feet, Apache wasn’t able to complete most of the tests without a single error or request time-out.
Results

Conclusions
When considering the tests that both web servers were able to successfully complete, Apache won by a slight margin of ~2%, while using 33% more memory.
Apache was, though, unable to cope with some of the tests. The 500/50 benchmark on the heavy page meant a few request time-outs for this web server, providing it failed the test.
The low memory usage and scalability of Nginx pose as strong arguments when choosing the web server to use with Passenger. In the scope of my research and this blog, it’s an obvious choice.