How does LiteSpeed vs Nginx compare? And how does LiteSpeed vs Nginx do in WordPress? In my quest to find the best WordPress hosting, this was a question that always bothered me.
There were a lot of posts from niche blogs and not so-great-looking blogs claiming that LiteSpeed performed up to 1200% better than Nginx showing some nice LiteSpeed vs Nginx benchmarks. That sounded like a story that is too good to be true, but could it be really true?
Even the Litespeed vs Nginx benchmarks from LiteSpeed itself indicate a large performance difference, so if this would be true, using LiteSpeed would be phenomenal.
These blog posts did not really give me satisfactory answers, and benchmarks were often one-dimensional. The solution was easy: spin up a couple of servers myself and do some real testing!
In this article and in the above video, I will answer the following question: How does (Open)LiteSpeed compare against Nginx when using WordPress?
The below infographic summarizes it all:
But what is LiteSpeed?
LiteSpeed, or better, LiteSpeed web server, is a product from LiteSpeed technologies that allow you to run a webserver. A webserver is enabling a computer or server that is connected to the internet to host and serve websites.
LiteSpeed is known for its performance and compatibility with Apache, another very popular webserver.
In this article, we are focusing on the open-source version of LiteSpeed Web Server, which is called OpenLiteSpeed.
Some shared web-hosting companies use (Open)LiteSpeed with great success, but many large hosting companies use Nginx or Apache.
And what is NGINX?
Nginx is an HTTP and reverse proxy server. It can be used to host and cache applications and websites on any given server. It is used by many large companies such as Dropbox and Netflix, and is getting increasingly popular.
It’s known for serving static files really well, and also has special modules for caching (FastCGI) and handling PHP (PHP-FPM).
In addition, it also has functionalities for handling Mail proxies and load balancing.
LiteSpeed vs Nginx: The Results
For my testing set-up, I created 2 servers at Upcloud, both with 2 cores and 4GB of RAM at the London data centre. Upcloud is a great provider, with fast servers and disks.
I used Runcloud to deploy a WordPress website on each of these servers, which is a great control panel for hosting WordPress on your own servers (find the best control panels here). Finally, I used another server on which I installed a load-testing tool. On one server, I installed NGINX, and on the other server, I used OpenLiteSpeed. For some benchmarks, I also enabled FastCGI caching for Nginx and caching for LiteSpeed
Essentially, my benchmarks compare OpenLiteSpeed vs NGINX.
Then I performed the following tests on these WordPress sites:
- TTFB and Load tests using Sucuri Performance Check.
- 1000 clients per second test using Loader.io (with caching turned on)
- 50 clients per second test, using Loader.io (with caching turned off)
- From 0 to 10.000 clients in one second, using Loader.io (with caching turned on)
- A test I wrote myself, where 10.000 posts are inserted, 10.000 posts are queried, and 10.000 posts are deleted.
- A test using the WordPress Performance Tester Plugin
- A test using the WordPress Benchmark Plugin.
OpenLiteSpeed vs Nginx: Time to First Byte (equal)
These are the results for the Time to First Byte (TTFB):
|Fastest TTFB||32 ms||34 ms|
|Fastest Total||38 ms||68 ms|
|Average TTFB||372 ms||317ms|
|Average Total||668 ms||550 ms|
Nginx is loading faster in the closest location, while OpenLiteSpeed is performing better for all locations averaged.
OpenLiteSpeed vs Nginx: 1000 Clients per Seconds (cached) (Nginx)
Using loader.io, which simulates clients constantly firing requests, we can get a good view of the cached performance. In this case, 1000 clients per second equals 1000 requests a second.
|Metrics (1000 cached clients)||Nginx||OpenLiteSpeed|
|Average Response||744 ms||1615 ms|
|Minimum Response||101 ms||102 ms|
|Maximum Response||10296 ms||11381 ms|
Nginx performs much better here, with more requests and a lower average response time. Nginx also has a much more equal response time, with fewer spikes in its graph and managed to get 99.9% of all requests successfully.
OpenLiteSpeed also had a couple of network errors and timeouts (> 10 second response time), and only got 90% of the maximum possible requests.
OpenLiteSpeed vs Nginx: From 0 to 10.000 Clients (cached) (OpenLiteSpeed)
But how do both platforms compare if we slowly increase the visitors from 0 to 10.000 in one minute?
Interestingly enough, with Nginx, we see that the response time roughly correlates with the rising number of visitors. With OpenLiteSpeed though, the number stays further down the line, with a step increase after 9000+ clients resulting in a large number of Timeouts.
In essence, OpenLiteSpeed was performing better under roughly 9000 clients, also resulting in more successful requests. Here’s an overview of all figures:
|Metrics (0-10000 clients)||Nginx||OpenLiteSpeed|
|Average Response||3069 ms||2041 ms|
|Minimum Response||110 ms||103 ms|
|Maximum Response||12028 ms||16661 ms|
Let’s see what happens if we turn the cache off!
OpenLiteSpeed vs Nginx: 50 Clients per Second (uncached) (Nginx)
When caching is turned off, we get a totally different image.
Nginx performs much better than LiteSpeed, with many more successful requests and lower response times.
|Metrics (50 uncached clients)||Nginx||OpenLiteSpeed|
|Average Response||1918 ms||3560 ms|
|Minimum Response||498 ms||1137 ms|
|Maximum Response||3069 ms||11077 ms|
Another popular load-testing tool is h2load. You’ll see it a lot in blogs. The following results talk about this.
OpenLiteSpeed vs Nginx: h2load (cached) (OpenLiteSpeed)
I performed the following benchmark:
h2load -n10000 -c100 -m10 --h1 "https://host.makeitwork.press"
This basically says to perform 10.000 requests, with 100 clients that can have as many as 10 concurrent streams. And these are the results:
|Metrics (1000 cached clients)||Nginx||OpenLiteSpeed|
|Completion||5.59 seconds||4.87 sec|
|Requests||1790,45 req/s||2052,24 req/s|
|Throughput||93,86 MB/s||107,79 MB/s|
OpenLiteSpeed is doing better here, serving. In a second test, which you will also find in the video, results from Nginx and OpenLiteSpeed are actually closer to each other.
OpenLiteSpeed vs Nginx: h2load (uncached) (Nginx)
But will we see a similar difference when caching is turned off? Let’s see! I executed the following command, which loads uncached versions of the website.
h2load -n1000 -c10 -m10 --h1 "https://host.makeitwork.press?nocache"
By now, you should know what the above syntax means :). And these are the results:
|Metrics (10 uncached clients)||Nginx||OpenLiteSpeed|
|Completion||24.95 seconds||43.54 seconds|
|Requests||40.09 req/s||22.97 req/s|
|Throughput||1.92 MB/s||1001 KB/s|
Like the test with Loader.io, Nginx performs much better here.
Let’s now dive into some WordPress specific benchmarks and see how both giants compare.
OpenLiteSpeed vs Nginx: WordPress Post Insert & Delete (OpenLiteSpeed)
The Post Insert & Delete Test is a simple test that I wrote, where I perform 10.000 post insertions, a query of 10.000 posts and a deletion of 10.000 posts. For each of these actions, I register what time it took.
|Insert 10.000 posts||46,939 seconds||41,041 seconds|
|Delete 10.000 posts||44,538 seconds||43,170 seconds|
|Query 10.000 posts||0,318 seconds||0,376 seconds|
In this case, OpenLiteSpeed is slightly faster.
OpenLiteSpeed vs Nginx: WordPress Performance Tester (Equal)
The WordPress Performance Tester Plugin does two benchmarks that benchmark the server and the queries per second in WordPress. It’s a nice indication of (web)-server performance.
|Queries per Second||1326||1304|
In this benchmark, Nginx and OpenLiteSpeed are doing equal For the server score, lower is better.
OpenLiteSpeed vs Nginx: WordPress Benchmark Tools (OpenLiteSpeed)
The WordPress Hosting Benchmark tool is a great tool that tests your CPU & Memory, MySQL, Disk and network performance. It gives a lot of insight into how great your hosting provider is, but also a bit of how well a web server stack performs.
In this benchmark, OpenLiteSpeed is doing slightly better for most of the benchmarks, except for small files I/O.
|Operations with large text data||8.3 seconds||7.8 seconds|
|Random binary data operations||7.5 seconds||7.3 seconds|
|Filesystem write ability||1179 MB/s||1174 MB/s|
|Local file copy and access speed||1047 MB/s||1143 MB/s|
|Small file IO test||990 MB/s||698 MB/s|
|Importing a large amount of data to database||3.5 sec||3.3 sec|
|Simple queries on a single table||1.2 sec||1 sec|
|Complex database queries on multiple tables||5 sec||4.7 sec|
Phew! We did a lot of benchmarks. It’s time to get to the conclusion.
OpenLiteSpeed vs Nginx: A WooCommerce Case Study
While the previous benchmarks were done on a basic install of WordPress, this does not really reflect the average WordPress website.
Therefore, I did another round of benchmarking with a simple webshop set-up, based upon a bloated WordPress theme and the WooCommerce plugin. I also scaled the server to three levels to see what the effect would be (From 1 core and 2GB of ram to 4 cores and 8GB of ram, using the amazing servers from Upcloud). So, what did I test?
- The loading performance for three levels using h2load.
- The time it took to insert/delete/read 10.000 posts.
- How long it takes to generate 1000 and 10.000 random WooCommerce products.
- The loading times and MySQL queries as indicated by Query Monitor with various set-ups.
- The time it takes to import 1000 posts with WP All Import.
Loadtest (caching enabled): Equal
In this load test, I basically fired 10000 requests caused by 100 concurrent users upon a cached page of the set-up website. These are the results:
|Server||Requests per Second|
|NGINX on 1 Core / 2GB||2605|
|OLS on 1 Core / 2GB||1055|
|NGINX on 2 Core / 4GB||1094|
|OLS on 2 Core / 4GB||1105|
|NGINX on 4 Core / 8GB||1086|
|OLS on 4 Core / 8GB||1103|
Except for the odd exception for the smallest server for NGINX, the results are pretty equal. However, OpenLiteSpeed did have a smaller time to the first byte. I also didn’t see much effect for scaling the server up.
Loadtest (caching disabled): NGINX
In this load test, I basically fired 1000 requests caused by 10 concurrent users upon an uncached page of the set-up website. These are the results:
|Server||Requests per Second|
|NGINX on 1 Core / 2GB||8.3|
|OLS on 1 Core / 2GB||4.01|
|NGINX on 2 Core / 4GB||14.97|
|OLS on 2 Core / 4GB||8.28|
|NGINX on 4 Core / 8GB||29.25|
|OLS on 4 Core / 8GB||16.83|
Similar to the base installation, NGINX can handle way more uncached users and there was a clear performance improvement for servers that are scaled. Again, we see the power of caching because an uncached setup is way slower.
Post Insertion / Deletion / Read Test: Nginx
In this test, I inserted, queried and deleted 10.000 posts subsequently. These are the results:
|Server||Insertion (s)||Querying (s)||Deletion (s)|
|NGINX on 1 Core / 2GB||39.865||0.378||38.742|
|OLS on 1 Core / 2GB||59.084||0.505||58.640|
|NGINX on 2 Core / 4GB||56.655||0.370||48.120|
|OLS on 2 Core / 4GB||52.699||0.413||59.617|
|NGINX on 4 Core / 8GB||36.853||0.364||33.128|
|OLS on 4 Core / 8GB||50.906||0.463||41.256|
NGINX clearly wins here
In this setup, NGINX is much faster than OpenLiteSpeed, especially when deleting or inserting posts.
WordPress is Single-Threaded
Except for some variance with Nginx, we don’t see some change when we scale up but not as much as expected. That’s because WordPress (and PHP) is single-threaded; one process is assigned to one thread. That means that no matter how many cores your server does have, one process (in this case, inserting, deleting, reading posts) is executed by one core. However, with more cores you can run more processes simultaneously, usually resulting in better performance.
Product Generation Benchmark: Equal
With help of the WC Smooth Generator, I generated 1000, and subsequently 10.000 products and reported the generating time. OpenLiteSpeed handled 1000 products faster, while NGINX finished 10.000 products sooner.
|Server||1000 products||10.000 products|
|NGINX on 4 Core / 8GB||00:03:54||00:54:19|
|OLS on 4 Core / 8GB||00:03:15||00:56:42|
In the background, I also did a test with a scaled-down server but there was no significant impact on product generation time.
Because this is a test that takes a lot longer, it is also a good test for longevity, in other words: how long performance is endured.
Query Monitor Results: NGINX
For various amounts of products, I visited the products page and edited a product, and watched the metrics in Query Monitor. Query Monitor is a plugin that helps to improve performance and see what code in WordPress has a lot of influence on that.
The plugin monitors the time is takes to process PHP execution, the time it takes to query the database and how much ram and queries are used in that process.
Default Setup (17 products)
|Page||PHP Load (s)||Query Load (s)|
|NGINX – Products Page||0.37||0.04|
|OLS – Products Page||0.82||0.05|
|NGINX – Edit Product Page||0.37||0.08|
|OLS – Edit Product Page||1.54||1.17|
Nginx performed much better here and OLS has some odd values for editing products. But how did they do with 1000 products?
1000 Products Setup
|Page||PHP Load (s)||Query Load (s)|
|NGINX – Products Page||0.27||0.06|
|OLS – Products Page||0.65||0.08|
|NGINX – Edit Product Page||0.47||0.04|
|OLS – Edit Product Page||0.42||0.09|
Again, NGINX was faster in querying and loading the pages, except for the Edit product page in which OpenLiteSpeed loaded slightly faster (though had slower querying)
11000 Products Setup
With this setup, we are slowly seeing the results of having a large number of products in our database, resulting in larger query times.
|Page||PHP Load (s)||Query Load (s)|
|NGINX – Products Page||0.48||0.11|
|OLS – Products Page||1.01||0.25|
|NGINX – Edit Product Page||0.55||0.34|
|OLS – Edit Product Page||1.79||0.46|
Again, NGINX is doing better here, even after repeated page loads and averaged out numbers to make sure a number was not a one-time incident.
By the way, I did this on the largest server set-up, as scaling down did not have significant effects.
Importing Benchmark Results: NGINX
At last, I imported 1000 products into WordPress using WP All import and recorded the time it took. These are the results:
Again, NGINX seems to be slightly faster here. This is especially the case if the import already contains existing products.
LiteSpeed vs Nginx: It’s close, but Nginx seems the winner
In my tests, Nginx and LiteSpeed actually performed really close, although Nginx seems to be doing better in the Webshop case study.
- In most of the benchmarks, the difference is very small, with OpenLiteSpeed being marginally faster for server operations and in cached situations (except for handling 1000 simultaneous clients).
- Nginx seemed to perform much better with load tests when caching was turned off, handling the same amount of requests and clients much faster.
Unfortunately, I can not give a definitive conclusion of whether you should use LiteSpeed or Nginx. But what if you would have to make a decision?
- Use OpenLiteSpeed if you want to have an easy to use caching plugin for WordPress that covers all your performance optimalizations, and need compatibility with .htaccess. This also includes ESI (edge side includes) caching, which you can use the cache parts of dynamic pages such as shopping pages. Cyberpanel, GridPane and Runcloud work greatly with OpenLiteSpeed.
- Use Nginx if you want great uncached performance, and like the way Nginx configurations file work. Both GridPane and Runcloud work greatly with Nginx.
- The earlier mentioned platforms are aimed at developers. Hostinger is a great hosting provider that supports LiteSpeed, and is aimed at beginners. Rocket.net or Kinsta are great if you favor Nginx.
Next to his, there are a couple of other things to consider when opting for LiteSpeed or Nginx.
The Bigest Perk of Using LiteSpeed in WordPress
The biggest advantage of using Litespeed for WordPress is its caching plugin. This plugin is a one-in-all toolkit for all your performance requirements. It does provide options for caching, minification, object caching, ESI (partial) caching, image optimization, improved content delivery, database optimization and more. It also provides support for integration with QUIC.cloud, which can make your WordPress website load fast from anywhere.
Unfortunately, Nginx does not have such a great plugin.
Great Hosting Providers that Use LiteSpeed
Are you convinced of using LiteSpeed? Or do you think Nginx is more capable? If you want to use LiteSpeed, I tested a couple of providers that make use of it. Here’s a link to their reviews:
- A2 Hosting
- Cyberpanel (for developers)
- GridPane (for developers). GridPane also supports NGINX.
- Runcloud (for developers). Runcloud also supports NGINX.
Great Hosting Providers that Use Nginx
There are many great providers that use NGINX, and with good reason. The following WordPress hosting providers use stacks that consist solely of NGINX:
- Kinsta (full review)
- Rocket.net (full review)
- GridPane (for developers)
- Runcloud (for developers)
- Ploi (for developers)
- Cleavr (for developers)
- SpinupWP (for developers)
If we compare OpenLiteSpeed vs NGINX, I think Nginx is the clear winner in terms of performance. It’s only a (big) pity that they don’t have a plugin as good as the LiteSpeed cache plugin.
So, what do you think? Let me know in the comments below!