- Bare Metal
- Bare Metal Cloud
- Big Data Benchmarks
- Big Data Experts Interviews
- Big Data Technologies
- Big Data Use Cases
- Big Data Week
- Data Lake as a Service
- Dedicated Servers
- Disaster Recovery
- Industry Standards
- Online Retail
- People of Bigstep
- Performance for Big Data Apps
- Press Corner
- Tech Trends
- What is Big Data
Using lsapi in WHM
An update for EasyApache 4 released in early February has introduced a version of mod_lsapi that can be installed by all WHM users. This high-performance module developed by LiteSpeed Technologies was previously only available in the LiteSpeed web server or through CloudLinux, but in both cases, a separate licence was needed.
The EasyApache 4 module is described as “a scaled-back version of the module already distributed by CloudLinux”, with main features of CloudLinux – such as CRIU and connection pooling - missing.
Without going into details, an article published on the cPanel blog claims that lsapi can provide a significant speed boost for php-based websites and serve as an alternative for PHP-FPM. The article further mentioned that the new module is easier to manage because it doesn’t require advanced configurations.
However, the cPanel blog leaves many questions unanswered and doesn’t fully explain how to use the new module. We will detail all the steps in this article and run some basic tests to see if mod_lsapi does indeed provide the promised performance boost.
Our test server runs the latest versions of WHM, EasyApache 4, MySQL 5.7 and php 7.2, with PHP_FPM active and proper settings for max_children and php memory limit.
We have installed a simple Wordpress website on one of the domains, without any plugins. No type of static caching is active.
For benchmarking, we will use one of the simplest tools available. Apache Benchmark (AB) is installed with the Apache HTTP server and can generate requests for testing purposes.
From another machine, we will send a total of 100 requests, 5 at the same time; as we are interested in php speed, and it is not a stress test, there is no need to generate more requests. Here is the command executed, with the following results:
ab -n 100 -c 5 http://linuxblog.xyz/
Concurrency Level: 5 Time taken for tests: 2.936 seconds Complete requests: 100 Failed requests: 0 Write errors: 0 Total transferred: 5343300 bytes HTML transferred: 5322300 bytes Requests per second: 34.06 [#/sec] (mean) Time per request: 146.784 [ms] (mean) Time per request: 29.357 [ms] (mean, across all concurrent requests) Transfer rate: 1777.47 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 1 1 0.1 1 1 Processing: 50 129 45.4 119 416 Waiting: 46 114 45.0 104 404 Total: 51 130 45.4 120 418 Percentage of the requests served within a certain time (ms) 50% 120 66% 125 75% 133 80% 136 90% 150 95% 239 98% 283 99% 418 100% 418 (longest request)
Installing lsapi is easy: simply customize the active profile from the EasyApache 4 interface and select mod_lsapi from the Apache Modules section. The package conflicts with mod_ruid2, which has to be removed but it’s no longer needed anyway.
Proceed with the selection and start the provision process. The Apache module is now installed, the cPanel blog post doesn’t provide any further instructions. Let’s run the test again to find out if the module has any effect on its own.
The results are almost identical to the initial setup, so it’s safe to conclude that the module needs the php handler in order to work.
Activate the lsapi handler
The cPanel article doesn’t describe how to activate the handler, but this can be done quickly.
In WHM, navigate to Home > Software > MultiPHP ManagerDocumentation and disable PHP-FPM for the test domain.
From the upper menu, select PHP Handler and then Edit in the Actions column for the active php version (7.2 in this case). Choose lsapi instead of cgi, then click Apply.
Running the test should yield different results this time, and it does:
Concurrency Level: 5 Time taken for tests: 18.301 seconds Complete requests: 100 Failed requests: 0 Write errors: 0 Total transferred: 5343300 bytes HTML transferred: 5322300 bytes Requests per second: 5.46 [#/sec] (mean) Time per request: 915.055 [ms] (mean) Time per request: 183.011 [ms] (mean, across all concurrent requests) Transfer rate: 285.12 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 1 1 0.1 1 1 Processing: 679 884 106.6 906 1129 Waiting: 671 871 105.1 887 1105 Total: 680 886 106.6 907 1130 Percentage of the requests served within a certain time (ms) 50% 907 66% 950 75% 965 80% 974 90% 1002 95% 1090 98% 1104 99% 1130 100% 1130 (longest request)
We can see that PHP-FPM is actually a lot faster, with a huge difference in the average time per request and the number of requests served per second.
The main reason for this difference is that the new handler doesn’t provide all the features of the CloudLinux version.
While the results of these simple benchmarks are by no means definitive, the current lsapi doesn’t seem to provide a performance boost for WHM servers. At the moment, PHP-FPM appears to be the fastest php processing option available in WHM, by a healthy margin. However, WHM’s mod_lsapi will be developed further and might become significantly faster in future releases.