Not Even Close: Ruby LSAPI 4.1 Bests Nginx + Passenger (A Benchmark, Of Course)
Part 1 — Uploading
Now that we’ve finished tweaking the latest update of LiteSpeed’s SAPI for Ruby on Rails with Rack, we decided to celebrate with a little benchmarking. In our new version, Ruby LSAPI 4.1, we’ve implemented a native rewindableinput interface. Requests in the new interface are already coded as rewindable, so Rack no longer has to expend memory caching requests to make them rewindable. This should streamline uploading to Rack applications. We wanted to see how much difference it would make. (By the way, if you’re going to run LSAPI 4.1, we strongly recommend upgrading to LSWS 4.2.2, if you haven’t already.)
We thought we’d also take this chance to test drive our API against our favorite frenemy — Nginx, this time with Passenger. Nginx + Passenger is supposed to be the best high-performance option for hosting Ruby Rails Rack applications, with Passenger increasing efficiency by automatically managing the backend. We’ve never benchmarked against Nginx with Passenger, so we were excited. Of course we thought our software was better, but we expected some competition. We were wrong. Here’s a quick summary of the results: (For the benchmark we used LSWS 4.2.2 with Ruby LSAPI 4.1, Nginx 1.2.6 with Passenger 3.0.19, and Ruby 1.9.3p374, Rails 3.2.11, and Rack 1.4.3.)
This is a very simple benchmarking — we ran the different APIs on the same virtual machine using the same application. We used a bare bones application so that most of the pressure was on the servers. No surprisingly, the speeds diverge the most when transferring a smaller amount of data. As the amount of data grows, the app becomes the bottleneck, and the processing speed becomes comparable. This short test is not meant to mimic real life. We just wanted to see how the server software performed in comparison (under idealized, oversimplified conditions) — and LiteSpeed blew Nginx out of the water.
We are eagerly awaiting (and hoping for) a flood of snarky criticisms. Here are the configurations and detailed results for the upload benchmarking, so you can test it and see for yourself. We love talking about benchmarks, so, please, give us some feedback. (Maybe we’ll even try new benchmarks if you suggest them…)