We have used the Apache HTTP Server (HTTPD) for our web hosting services since the very beginning of our company. It is one of the oldest and most stable and mature web servers available, and it still maintains a huge market share due to its outstanding flexibility, configurability, and extensibility. Until recently, more than half of all websites used it.
However, multiple competing alternatives have emerged over the years, some sporting very compelling performance and security features. Because of that, the market share of Apache HTTPD has been steadily decreasing over the years:
As part of our never-ending work to improve our service, we recently investigated how our current setup based on the Apache HTTP Server and FastCGI compares to one of the strongest Apache competitors around, the LiteSpeed Web Server.
The LiteSpeed Web Server (LSWS) is marketed as a drop-in replacement for HTTPD. It is proprietary software developed by LiteSpeed Technologies, and its strongest appeal for system administrators, besides the performance gains it promises, is the fact that it is compatible with the configuration format of HTTPD. In theory, migration from HTTPD to LSWS should be fairly easy to do for existing sites.
Is there a significant enough performance boost to justify the migration, though? And is performance the only factor that would weigh in on a decision like this? That's what we set out to find out.
For our tests, we used several modifications of our managed VPS setup that we compared to a LiteSpeed server on the same hardware, all running a fairly large and well-optimized WordPress site with about 30 active plugins.
We performed our tests on a First Class managed VPS plan with the following hardware:
- CPU: 2 cores at 2.4GHz
- RAM: 8 GB
- Storage type: SSD (we don't have any other type 😉 )
For our tests, we configured our VPS environment based on Apache HTTPD with PHP 7.2 in several different ways:
- Without modifications
- With FastCGI enabled for PHP 7.2
- PHP 7.2 running on FastCGI with OPcache enabled
The LiteSpeed environment we used had two modifications:
- LSWS with PHP 7.2
- LSWS with PHP 7.2, with PHP OPcache
One thing to note is that, unsurprisingly, the migration to LiteSpeed turned out to not be as simple as just replacing HTTPD with LSWS. Particularly for a heavily-tuned and customized environment like ours, there are multiple technical issues involved in modifying it to use LSWS without losing existing functionality.
The following table summarizes the results of our tests over a few thousand requests sent to the test servers:
|Result||Apache||Apache FastCGI||Apache FCGI OPcache||LiteSpeed||LiteSpeed OPcache|
|Time taken for tests:||1109.7s||945.4s||235.3s||928.7s||222.2s|
|Requests per second:||2.70||3.2||12.8||3.2||13.5|
|Time per request:||739.8ms||630.3ms||156.8ms||619.1ms||148.1ms|
Predictably, using FastCGI on our existing setup and enabling OPcache, regardless of the web server software in use, both lead to sizable improvements in performance. We can also see that LiteSpeed does have a marginal lead over Apache with FastCGI. However, we ultimately decided against using LiteSpeed on our servers.
There are several reasons for our decision. One of them is that using LiteSpeed does not actually lead to the incredible 40%-50% across the board increases in performance figures we've seen advertised elsewhere. We had our doubts in the first place, but our tests convinced us that the improvement would not be large enough to be significant.
Another is that LSWS is developed by a private company, LiteSpeed Technologies, that offers their software for a premium. This would increase the end price for our customers.
The Apache HTTP Server, on the other hand, is developed by a lively community of volunteers coordinated by the non-profit Apache Foundation. The project is extremely stable, and it does not come with any of the technical or legal caveats of the LiteSpeed Web Server.
In the end, performance improvements of a WordPress website do not come only from the web server software. In other words, there are no shortcuts; WordPress sites, in particular, can benefit immensely from caching and site-specific optimizations. We covered some very easy and quick improvements you can make to your WordPress website in our blog post on how to speed up WordPress.
There are other projects we are working on with the aim of improving the performance of our customers' websites. Stay tuned to find out more!