{"id":9286,"date":"2018-03-05T02:00:45","date_gmt":"2018-03-05T07:00:45","guid":{"rendered":"https:\/\/blog.litespeedtech.com\/?p=9286"},"modified":"2018-03-05T02:00:45","modified_gmt":"2018-03-05T07:00:45","slug":"compare-openlitespeed-to-nginx-and-apache","status":"publish","type":"post","link":"https:\/\/lswp.store\/index.php\/2018\/03\/05\/compare-openlitespeed-to-nginx-and-apache\/","title":{"rendered":"Benchmarks: OpenLiteSpeed vs. NGiNX vs. Apache"},"content":{"rendered":"<p><a href=\"https:\/\/lswp.store\/wp-content\/uploads\/2018\/03\/null.png\"><img fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter size-full wp-image-9288\" src=\"https:\/\/lswp.store\/wp-content\/uploads\/2018\/03\/null.png\" alt=\"Compare OpenLiteSpeed to NGiNX and Apache\" width=\"800\" height=\"400\" srcset=\"https:\/\/lswp.store\/wp-content\/uploads\/2018\/03\/null.png 800w, https:\/\/lswp.store\/wp-content\/uploads\/2018\/03\/null-300x150.png 300w, https:\/\/lswp.store\/wp-content\/uploads\/2018\/03\/null-768x384.png 768w, https:\/\/lswp.store\/wp-content\/uploads\/2018\/03\/null-600x300.png 600w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/a><\/p>\n<p>If our search statistics are any indication, the question on everyone&#8217;s mind is &#8220;How does OpenLiteSpeed compare to NGiNX and Apache?&#8221; We think that&#8217;s a question that deserves an answer, so we set up a test environment and got to work.<\/p>\n<p><strong>Note:<\/strong> For a more in-depth discussion of the differences and similarities between LiteSpeed, Apache, and nginx, take a look at <a href=\"https:\/\/www.litespeedtech.com\/products\/litespeed-web-server\/compare-litespeed-apache-nginx\">the comparison on our site<\/a>.<\/p>\n<h2>The Contenders<\/h2>\n<p>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.<\/p>\n<p>When it comes to WordPress, <a href=\"https:\/\/lswp.store\/2017\/07\/12\/wpw-caching-101\/\">caching is important<\/a>, so we made sure to use an appropriate caching solution for each web server in our tests.<\/p>\n<p>All tests were performed with Keep-Alive enabled. (See more common settings under <strong>Web Server Configuration<\/strong> below.)<\/p>\n<h2>The Results<\/h2>\n<p>The following charts show how many requests per second the three servers processed during our series of tests. The larger the number, the better.<\/p>\n<p><a href=\"https:\/\/lswp.store\/wp-content\/uploads\/2018\/03\/small-static-file-4kb.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-9314\" src=\"https:\/\/lswp.store\/wp-content\/uploads\/2018\/03\/small-static-file-4kb.png\" alt=\"Compare OpenLiteSpeed to NGiNX and Apache: Small Static File Benchmark\" width=\"700\" height=\"350\" srcset=\"https:\/\/lswp.store\/wp-content\/uploads\/2018\/03\/small-static-file-4kb.png 700w, https:\/\/lswp.store\/wp-content\/uploads\/2018\/03\/small-static-file-4kb-300x150.png 300w, https:\/\/lswp.store\/wp-content\/uploads\/2018\/03\/small-static-file-4kb-600x300.png 600w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/a><\/p>\n<p>Static files require no processing, and so this test is useful for measuring the servers\u2019 response times. How quickly can each server deliver small static files?<\/p>\n<p><a href=\"https:\/\/lswp.store\/wp-content\/uploads\/2018\/03\/hello-world.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-9312\" src=\"https:\/\/lswp.store\/wp-content\/uploads\/2018\/03\/hello-world.png\" alt=\"Compare OpenLiteSpeed to NGiNX and Apache: Hello World PHP Benchmark\" width=\"700\" height=\"350\" srcset=\"https:\/\/lswp.store\/wp-content\/uploads\/2018\/03\/hello-world.png 700w, https:\/\/lswp.store\/wp-content\/uploads\/2018\/03\/hello-world-300x150.png 300w, https:\/\/lswp.store\/wp-content\/uploads\/2018\/03\/hello-world-600x300.png 600w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/a><\/p>\n<p>When we benchmark the &#8220;Hello World&#8221; PHP app, we are not testing real-world conditions. Nevertheless, this is the best way to isolate the <em>communication<\/em> between server and PHP from the <em>processing<\/em> of the PHP itself. With this test, what we are most interested in is how efficiently the server communicates with the PHP engine.<\/p>\n<p><a href=\"https:\/\/lswp.store\/wp-content\/uploads\/2018\/03\/wordpress-cache.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-9316\" src=\"https:\/\/lswp.store\/wp-content\/uploads\/2018\/03\/wordpress-cache.png\" alt=\"Compare OpenLiteSpeed to NGiNX and Apache: WordPress Cache Benchmark\" width=\"700\" height=\"350\" srcset=\"https:\/\/lswp.store\/wp-content\/uploads\/2018\/03\/wordpress-cache.png 700w, https:\/\/lswp.store\/wp-content\/uploads\/2018\/03\/wordpress-cache-300x150.png 300w, https:\/\/lswp.store\/wp-content\/uploads\/2018\/03\/wordpress-cache-600x300.png 600w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/a><\/p>\n<p>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.<\/p>\n<p>As you can see, OpenLiteSpeed outperforms NGiNX and Apache in all of our scenarios.<\/p>\n<h2>Try it Yourself<\/h2>\n<p>In the interest of transparency, we&#8217;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.<\/p>\n<p>This is the command we used in all tests (Replace <code>example.com\/path<\/code> with the location of your test subjects):<\/p>\n<pre>ab -n 10000 -k -H \"Accept-Encoding: gzip,deflate\" -c 100 example.com\/path<\/pre>\n<p>Each test was run five times, and the average result was used for our graphs.<\/p>\n<h3>Web Server Configuration<\/h3>\n<p>Common settings for all servers:<\/p>\n<ul>\n<li>Keep-Alive<\/li>\n<li>gzip<\/li>\n<li>OPCache<\/li>\n<li>PHP use socket<\/li>\n<li>PHP version 7.1.2<\/li>\n<\/ul>\n<p>Additional OpenLiteSpeed settings:<\/p>\n<ul>\n<li>Number of Workers 4<\/li>\n<li>PHP_LSAPI_CHILDREN=20<\/li>\n<li>LSAPI_AVOID_FORK=1<\/li>\n<\/ul>\n<p>Additional NGiNX settings:<\/p>\n<ul>\n<li>worker_processes 4<\/li>\n<li>worker_connections 4096<\/li>\n<li>pm.start_servers = 20<\/li>\n<\/ul>\n<h3>Test Environment<\/h3>\n<h4>Software<\/h4>\n<p>Web Server version:<\/p>\n<ul>\n<li>OLS: v1.4.28<\/li>\n<li>NGiNX: v1.12.2<\/li>\n<li>Apache: v2.4.6<\/li>\n<\/ul>\n<p>Server API version:<\/p>\n<ul>\n<li>OLS: LSAPI v6.11<\/li>\n<li>NGiNX: FPM\/FastCGI<\/li>\n<li>Apache: Apache 2.0 Handler<\/li>\n<\/ul>\n<p>Cache version:<\/p>\n<ul>\n<li>OLS: <a href=\"https:\/\/wordpress.org\/plugins\/litespeed-cache\/\">LSCache for WordPress v1.7.1<\/a><\/li>\n<li>NGiNX: FastCGI Cache<\/li>\n<li>Apache: W3 Total Cache v0.9.6<\/li>\n<\/ul>\n<p>WordPress version:<\/p>\n<ul>\n<li>Version: 4.9.4<\/li>\n<\/ul>\n<h4>Hardware<\/h4>\n<p>Both Client and Server specs:<\/p>\n<ul>\n<li>Intel Xeon CPU E7- 4870 4 Core @ 2.40GHz<\/li>\n<li>4GB RAM<\/li>\n<li>120GB ZFS RAID-Z2 iSCSI Drive<\/li>\n<li>CentOS 7<\/li>\n<\/ul>\n<p>Although we didn\u2019t use one for our benchmarks, We recommend Solid State Drives (SSD) in production environments.<\/p>\n<h2>Summary<\/h2>\n<p>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, <a href=\"https:\/\/www.litespeedtech.com\/open-source\/openlitespeed\">give OpenLiteSpeed a try<\/a>.<\/p>\n<h2>Not convinced?<\/h2>\n<p>We encourage you to repeat our tests on your own hardware and see the difference for yourself! Or, join us in our <a href=\"https:\/\/www.litespeedtech.com\/benchmark-shootout\">Benchmarks Shootout<\/a>! If you think you can configure NGNiX or Apache to beat LiteSpeed, we&#8217;d love to go head-to-head with you. Follow <a href=\"https:\/\/www.litespeedtech.com\/benchmark-shootout\">this link<\/a> for more information.<\/p>\n<h2>Want More?<\/h2>\n<p>Esteban over at infranetworking wrote up <a href=\"https:\/\/blog.infranetworking.com\/apache-vs-nginx-vs-litespeed\/\">a very detailed and thorough comparison between Apache, NGNiX, and LiteSpeed Web Server<\/a>. (It&#8217;s in Spanish, but Google Translate does a decent job, if you don&#8217;t speak Spanish.)<\/p>\n<p>&#8212;<br \/>\n<strong>Article by:<\/strong> Lisa Clarke<br \/>\n<strong>Benchmarks Performed by<\/strong>: Eric Leu<br \/>\n<strong>Graphs by<\/strong>: Mark Zou<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We benchmarked OpenLiteSpeed, NGiNX, and Apache. 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.<\/p>\n","protected":false},"author":1,"featured_media":9288,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[16,29],"tags":[36,196],"class_list":["post-9286","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-benchmarks","category-openlitespeed","tag-apache","tag-nginx"],"jetpack_featured_media_url":"https:\/\/lswp.store\/wp-content\/uploads\/2018\/03\/null.png","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/posts\/9286","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/comments?post=9286"}],"version-history":[{"count":0,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/posts\/9286\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/media\/9288"}],"wp:attachment":[{"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/media?parent=9286"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/categories?post=9286"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/tags?post=9286"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}