RSS Feed
Upgrade to PHP 7.2 - success story of performance-wise move
Posted by Esvon Support on 22 December 2017 08:17 AM

One of our customers got a good deal on a new VPS with EasyApache4. Before he had VPS with EasyApache3 where switching to PHP 7 was complicated.

We were asked to make sure pages serving is as fast as possible and that task included migration from PHP 5.6 to PHP 7.2.

Initial configuration included Apache 2.4 + mod_mpm_prefork + PHP 5.6 (suEXEC).

Website's index page is very rich with PHP-generated content so all speed tests were made on it using Apache bench command:

ab -n 500 -c 10

PHP 5.6 (suEXEC) results: 16 requests per second in average. Very slow. By the way suEXEC is making things slow too comparing to php-fpm.

New configuration included Apache 2.4 + mod_mpm_worker + PHP 7.2 (php-fpm).

PHP 7.2 (php-fpm) results: 83-101 requests per second. The difference can be amazing (6x faster). With EasyApache4 it is easy to switch between PHP versions so we tested the same configuration on PHP 7.1 and got 75-88 requests per second.

What contributed to this performance increase? At least 3 things:

1/ PHP 7.2 is the fastest in PHP line
2/ Handing PHP work off to PHP FPM makes a HUGE improvement in memory utilization (Server API = FPM/FastCGI in phpinfo output)
3/ Threaded worker Multi-Processing Module for Apache HTTP Server mod_mpm_worker is faster than mod_mpm_prefork

Merry Christmas !

Help Desk Software by Kayako Fusion