Benchmarks: OpenLiteSpeed vs. NGiNX vs. Apache
If our search statistics are any indication, the question on everyone’s mind is “How does OpenLiteSpeed compare to NGiNX and Apache?” We think that’s a question that deserves an answer, so we set up a test environment and got to work.
We looked at OpenLiteSpeed, NGiNX, and Apache and we ran burst tests simulating 10,000 requests over 100 concurrent users. We looked at how the three web servers handled a small static file and a simple PHP script, and then we evaluated their WordPress performance.
When it comes to WordPress, caching is important, so we made sure to use an appropriate caching solution for each web server in our tests.
All tests were performed with Keep-Alive enabled. (See more common settings under Web Server Configuration below.)
The following charts show how many requests per second the three servers processed during our series of tests. The larger the number, the better.
Static files require no processing, and so this test is useful for measuring the servers’ response times. How quickly can each server deliver small static files?
When we benchmark the “Hello World” PHP app, we are not testing real-world conditions. Nevertheless, this is the best way to isolate the communication between server and PHP from the processing of the PHP itself. With this test, what we are most interested in is how efficiently the server communicates with the PHP engine.
WordPress is a heavy PHP application and as such, caching is strongly recommended. In this test, we pair each server with an appropriate caching option.
As you can see, OpenLiteSpeed outperforms NGiNX and Apache in all of our scenarios.
Try it Yourself
In the interest of transparency, we’re including the specs of our web server configuration and test environment below. Feel free to run the same benchmarks and compare OpenLiteSpeed to NGiNX and Apache for yourself.
This is the command we used in all tests (Replace
example.com/path with the location of your test subjects):
ab -n 10000 -k -H "Accept-Encoding: gzip,deflate" -c 100 example.com/path
Each test was run five times, and the average result was used for our graphs.
Web Server Configuration
Common settings for all servers:
- PHP use socket
- PHP version 7.1.2
Additional OpenLiteSpeed settings:
- Number of Workers 4
Additional NGiNX settings:
- worker_processes 4
- worker_connections 4096
- pm.start_servers = 20
Web Server version:
- OLS: v1.4.28
- NGiNX: v1.12.2
- Apache: v2.4.6
Server API version:
- OLS: LSAPI v6.11
- NGiNX: FPM/FastCGI
- Apache: Apache 2.0 Handler
- OLS: LSCache for WordPress v1.7.1
- NGiNX: FastCGI Cache
- Apache: W3 Total Cache v0.9.6
- Version: 4.9.4
Both Client and Server specs:
- Intel Xeon CPU E7- 4870 4 Core @ 2.40GHz
- 4GB RAM
- 120GB ZFS RAID-Z2 iSCSI Drive
- CentOS 7
Although we didn’t use one for our benchmarks, We recommend Solid State Drives (SSD) in production environments.
What we hope you have noticed, is that OpenLiteSpeed easily outperforms the competition. If you are in the market for a new web server solution, and you are thinking Open Source, give OpenLiteSpeed a try.
Not convinced? We encourage you to repeat our tests on your own hardware and see the difference for yourself!
Esteban over at infranetworking wrote up a very detailed and thorough comparison between Apache, NGNiX, and LiteSpeed Web Server. (It’s in Spanish, but Google Translate does a decent job, if you don’t speak Spanish.)
Article by: Lisa Clarke
Benchmarks Performed by: Eric Leu
Graphs by: Mark Zou