Speed matters. Our engineers are always looking at ways on improving the stack. One of the major objectives of our stack integrations is to improve the speed of the overall processes of our stack.
Keeping up with this practice, in a bid to increase speed of aspects of Managed Cloud Hosting coupled with constant improvements based on users feedback, Cloudways has now integrated PHP-FPM in all its servers. Owing to this integration, applications hosted on Cloudways PHP hosting servers are now going to perform up to 3x faster.
From a website visitor’s perspective, switching from mod_PHP to PHP-FPM might not be much of a bigger deal. However, from a system administrator’s point of view, both of these are entirely different things.
All system administrators are aware that PHP works with all major web servers and it can be run in different ways on your server. One of the most common known ways to run PHP is the mod_php module. This is because it comes by default on the Apache HTTP servers. But there is a slight problem. Unlike PHP-FPM, mod_PHP locks out processes and disrupts the performance of a website.
If your primary goal for hosting your web application with an optimized cloud service is to achieve optimal performance and security, then PHP-FPM is the way forward.
PHP-FPM (FastCGI Process Manager) dramatically speeds up the performance of your PHP environment.
Host PHP Websites with Ease [Starts at $10 Credit]
- Free Staging
- Free backup
- PHP 8.0
- Unlimited Websites
You might also like: How To Host PHP On DigitalOcean
PHP-FPM vs. mod_PHP Performance Benchmarks
Before writing about the PHP benchmarks, and then using a controlled environment we tested a WordPress website using both PHP-FPM and mod_PHP. We have not used Varnish or Turpentine for the test. Each time, we noticed increased performance and stability with the stack that contained PHP-FPM.
Performance with mod_PHP
We used a DigitalOcean 4 GB server. The app for this test was a WordPress website.
Test generated 38,046 successful hits in 295.0 seconds with a data transfer of 7,399.11 KB in and 206,219.42 KB out from the app. The average hit rate of 128.0/second translates to about 1,1059,200 hits/day.
The average response time was 2150 ms.
Performance with PHP-FPM
The only thing different in this test is the addition of PHP-FPM.
Test generated 85,829 successful hits in 295.0 seconds with a transfer of 16,465.18 KB in and 465,728.74 KB of data out from the app. The average hit rate of 290.0/second translates to about 25,056,000 hits/day.
The average response time was 628 ms.
You might also like: PHP 5.6 Vs PHP 7 – Performance Benchmarks With Symfony 3
You can notice PHP-FPM made our test website almost 350% faster when it comes to loading times. Plus, it made the site twice as resource efficient as it was with mod_php.
PHP-FPM, one of the newest way to use PHP in conjunction with a web server, is an alternative PHP FastCGI implementation. This module of PHP can be used with any web server which is compatible with the protocol of FastCGI.
The major advantage of PHP-FPM is that it relies on the concept of pool management. Each pool of PHP-FPM can be viewed as a full instance of PHP, having a configuration, limit and restrictions of its own. These limitations, restrictions, and configurations are in terms of the child processes, modules, environment variables, folders, and logs.
How to Enable PHP-FPM?
For servers launched after this announcement dated August 23rd, 2016, PHP-FPM has been enabled by default. For new server instances, mod_PHP has been retired by default. For servers launched before August 23rd, you can enable PHP-FPM by going over this step-by-step guide.
PHP-FPM vs. mod_PHP: Which is Better?
We believe that it is really not a matter of PHP-FPM vs mod_PHP. With this move, we are targeting the main aspects Cloudways aspires to achieve: Reliability, Security, Scalability, and Speed. PHP-FPM provides all these along with a lot of customization and performance tuning opportunities. Therefore, it is only feasible that we move from slower processes (mod_PHP) to much faster processes with PHP-FPM.
Q: What is PHP-FPM used for?
A: PHP-FPM (FastCGI Process Manager) is a web tool used to speed up the performance of a website. It is much faster than traditional CGI based methods and has the ability to handle tremendous loads simultaneously.
Q: How to resolve “PHP-FPM service is not running” error?
A: To resolve this error, simply change the config file with /var/run/php5-fpm.pid in place of /var/run/php-fpm.pid. This could possibly solve the above stated error in minutes.
Start Creating Web Apps on Managed Cloud Servers NowEasy Web App Deployment for Agencies, Developers and E-Commerce Industry.
Immad Uddin Khan
Immad is a Digital Content Producer for Cloudways - A Managed Cloud Hosting Platform. He is mostly busy in creating all sorts of informative and innovative content types. As a hobby, he loves to travel with his camera to picturesque destinations.