11 July 2022 Reading time: 3 minutes

Alexei Ilatovski

Ispmanager Developer

OpenLiteSpeed is fast. But not always

Ispmanager

Today I will tell you how I did load testing of nginx, Apache and OpenLiteSpeed (aka OLS), and which server is faster.

The reason for the test was the addition of OLS to our product — ispmanager. This is a control panel for web servers and websites. We have had support for Apache and nginx for a long time, but OLS is new. The developers say that it is a superfast server, and independent measurements confirm it. However, we decided to check it out for ourselves. Turns out OLS is really productive, but still doesn't always outperform the competition.

Testing methodology

The purpose of the test was to measure and compare the following indicators:

  • Speed - response time;
  • Performance - the maximum number of requests that a web server can process per unit time using the same resources.

We checked four configurations in total:

  • Apache MPM Prefork + mod_php
  • Nginx + Apache MPM Prefork + mod_php
  • Nginx + PHP FPM
  • OpenLiteSpeed + LSAPI

All web servers were with default settings, without doping.

For testing, we used a VDS with the following characteristics:

  • CPU — 3,4 GHz (4 cores)
  • RAM — 4 GB
  • HDD — 16 GB

We tested the website with a freshly installed WordPress - perhaps the most popular version of CMS. For that, we used the Yandex.Tank utility. Requests were made to static and dynamic content. For three minutes, we gradually increased the number of requests per second from 0 to 600.

The configuration of the tank was as follows:

   overload:
enabled: true
package: yandextank.plugins.DataUploader
token_file: "token.txt"
phantom:
instances: 100000
address: 172.31.97.2:80
load_profile:
  load_type: rps
  schedule: line(0, 600, 3m)
headers:
  - "[Host: example.com]"
uris:
  - "/"
  - "/?p=1"
  - "/wp-login.php"
  - "/wp-content/themes/twentyseventeen/assets/images/header.jpg"
  - "/wp-content/themes/twentyseventeen/style.css"
  - "/wp-content/themes/twentyseventeen/assets/js/global.js?ver=20190121"
console:
enabled: true
telegraf:
enabled: false	

Test results

Average number of processed requests for Apache MPM Prefork + mod_php, per second

Average response time for Apache MPM Prefork + mod_php, ms

It can be seen that Apache can handle approximately 186 requests per second on the server resources provided. Then it hits the CPU limit and starts returning error 500. The average response time to this point is 23 ms.

Average number of processed requests for Nginx + Apache MPM Prefork + mod_php, per second

Average response time for Nginx + Apache MPM Prefork + mod_php, ms

If you use Nginx to process static content, the number of processed requests increases to 242 per second. The average response time is 19 ms.

Average number of processed requests for Nginx + PHP FPM, per second

Average response time for Nginx + PHP FPM, ms

PHP FPM gives great performance. This configuration can handle about 422 requests per second and the response time will be only 10 ms. Let us see if OpenLiteSpeed overtakes it.

Average number of processed requests for OpenLiteSpeed + LSAPI, per second

Average response time for OpenLiteSpeed + LSAPI, ms

OpenLiteSpeed is capable of handling about 273 requests per second with an average response time of 17 ms.

Comparing the results

To see the big picture, let us compare the results of all measurements:

In this test, OpenLiteSpeed is faster than Apache and the combination of Nginx + Apache, but still significantly slower than Nginx + PHP FPM.

The results are a bit disappointing - we expected OLS to outperform all the competitors. Nevertheless, during the testing we used default configurations. OpenLiteSpeed, on the other hand, has many tools that can help it compete with Nginx. For example, the LSCache caching plugin, brotli compression, HTTP/3 protocol, etc. Perhaps in the future we will conduct a similar test for optimized web servers - then we will be sure to tell you about the results.