sheldonk sheldonk - 2 months ago 8x
Ruby Question

Apache HTTP vs Ruby Rack Speed Comparison for a Webserver

I was planning on hosting some static webpages and I was interested in using Ruby Rack to spice things up. I was wondering if anyone knew the speed comparison and how many requests could be handled per second for the two options. Thanks!


Ruby Rack is rarely used on its own except for testing and almost always has some kind of server front-end in front of it. These need some kind of layer to manage the Rack processes.

Passenger is a popular choice and works with both Apache httpd and nginx. There are other more exotic arrangements for hosting Rack-based applications involving HAProxy or a hardware appliance.

To determine how many "requests per second" your stack can handle, you'll need to benchmark. Each application has an entirely different performance profile, and additional tuning can be done to various parts of your stack, all the way from hardware, operating system, database, choice of Ruby interpreter, web front-end and load-balancer.

Don't forget that most extremely high performance apps "cheat" enormously using caching to produce the impression of speed while deferring as many time-consuming operations as possible using a background job queue.

Remember it's usually more about the impression of speed than it is actual speed. If you can achieve page load times of ~20ms consistently this is a lot better than ~5ms with intermittent 5000ms spikes even if your average times are the same. People notice inconsistency more than actual performance.