Benchmarking Magento Part 2 - PHP-FPM

PHP-FPM is a high performance alternative to the standard PHP library that I used in Part 1 of this series. Please see Part 1 for a run down of the configuration of the server that I am using in this series.

Installing PHP-FPM

PHP-FPM is available from the default Debian repositories and is installed with the following command:

apt update
apt upgrade
apt install php-fpm

Next, configure Apache2 to use PHP-FPM:

a2enmod proxy_fcgi setenvif
a2enconf php7.3-fpm

Now, disable the PHP7.3 module and enable mpm_event:

a2dismod php7.3
a2dismod mpm_prefork
a2enmod mpm_event

Reload Apache to set the new configuration live:

systemctl reload apache2.service

Your server is now be using PHP-FPM. The easiest way to check this is to create a file with the phpinfo command. Create a PHP file with the following contents:

<?php phpinfo(); ?>

in you Magento instance’s root directory. Then browse to this new page with in your normal browser e.g. https://magento.example.com/info.php. If your server is using PHP-FPM to process PHP then you should see the Server API listed as FPM/FastCGI as shown here:

Your Magento instance should be running normally with no error messages or other strange behaviour.

Benchmark results

I have included the results from Magento Benchmark Part 1

HTTP HTTPS
Stock server 147 trans/sec 111 trans/sec
PHP-FPM 165 trans/sec (12%) 116 trans/sec (5%)

PHP-FPM provided a 12% increase in HTTP transactions per second and a 4% increase in HTTPS transactions. It’s beginn>

Next Benchmark

In the next post the I will install a Reddis and configure it as a full page cache.

Magento Benchmark Part 3