LiteSpeed suEXEC 40x Faster than Apache suPHP! New PHP Benchmarks
With the second in our series of new benchmarks, we’ve pit many different PHP setups against each other for serving a small PHP hello world script. The contestants:
- LiteSpeed Web Server Enterprise 4.2.5 with suEXEC daemon mode
- LiteSpeed Web Server Enterprise 4.2.5 with ProcessGroup
- LiteSpeed Web Server Enterprise 4.2.5 with PHP-FPM
- OpenLiteSpeed 1.2.6
- nginx 1.4.3 with PHP-FPM
- Apache 2.2.25 with PHP-FPM
- Apache 2.4.6 with PHP-FPM
- Apache 2.2.25 with mod_PHP
- Apache 2.2.25 with suPHP
- Apache 2.4.6 with suPHP
The results here were even more staggering than our small static file benchmarks, with LiteSpeed more than 40 x faster than Apache with suPHP and about twice as fast as Apache or nginx with PHP-FPM.
Full results for our PHP Hello World benchmark.
Again, LSWS Enterprise showed the greatest gains with keep-alive connections enabled. LiteSpeed Enterprise (with either suEXEC daemon mode or ProcessGroup) was:
- 3885% faster than Apache 2.2 using suPHP.
- 4506% faster than Apache 2.4 using suPHP.
- 50% faster than Apache 2.2 with mod_PHP.
- 273% faster than Apache 2.2 with PHP-FPM.
- 203% faster than Apache 2.4 with PHP-FPM.
- 86% faster than nginx with PHP-FPM.
- 16% faster than LiteSpeed Enterprise with PHP-FPM.
- slightly faster than OpenLiteSpeed.
LiteSpeed Enterprise tested essentially the same with suEXEC Daemon mode and ProcessGroup in both tests.
This test suggests a number of points:
- First and foremost, LiteSpeed is faster at serving PHP than all other web servers. No matter the setup, even when using the same PHP-FPM backend, LiteSpeed Enterprise and OpenLiteSpeed handily beat all comers. Our code is just more optimized.
- LSAPI is still faster than FCGI. PHP-FPM uses FCGI. suEXEC Daemon mode and ProcessGroup both use LSAPI, LiteSpeed’s unique server API, for communication with the PHP engine. In the tests, switching LiteSpeed to PHP-FPM caused a significant decrease in performance.
- LiteSpeed is particularly great if you need suEXEC (for shared hosting, for example). Hosters running suPHP should take note — running LiteSpeed’s suEXEC daemon mode is incomparably more powerful. There are many reasons for this difference: suPHP uses CGI whereas suEXEC daemon mode uses LSAPI. suPHP spawns a brand new process for each PHP task. This is far slower and more resource-intensive than suEXEC daemon mode’s one parent process forking new child processes. And, as always, LSWS is just coded for more performance than Apache. (And even if you’re running PHP-FPM pools, the difference with LiteSpeed suEXEC daemon or ProcessGroup is remarkable.)
In the test we tried to remove as many other variables as we could, using the same hardware and purposely keeping the script size miniscule. The goal was to demonstrate pure speed differences when serving PHP. As we noted in the last test, this is just one facet of web service. We are building up to more complex situations, including web applications.
We’re very interested in your feedback. Get in touch with us on our forum. You can find the test configurations and hardware specs with the benchmark results. We’d be happy to hear any objections you have. We encourage you to reproduce the test yourself and suggest any changes you would like to see.