PHP-PM Is a Process Manager, Supercharger, and Load Balancer for PHP Applications
Published on by Paul Redmond
PHP-PM is an open-source process manager, supercharger, and load balancer for PHP applications. It uses ReactPHP to achieve event-driven, non-blocking I/O with PHP.
It’s based on ReactPHP and works best with applications that use request-response frameworks like Symfony’s HTTPKernel. The approach of this is to kill the expensive bootstrap of PHP (declaring symbols, loading/parsing files) and the bootstrap of feature-rich frameworks. See Performance section for a quick hint. PHP-PM basically spawns several PHP instances as worker bootstraping your application (eg. the whole Symfony Kernel) and hold it in the memory to be prepared for every incoming request: This is why PHP-PM makes your application so fast.
At a high level, the main features of PPM are:
- Performance boost up to 15x (compared to PHP-FPM, Symfony applications).
- Integrated load balancer.
- Hot-Code reload (when PHP files change).
- Static file serving for easy development procedures.
- Support for HttpKernel (Symfony/Laravel), Drupal (experimental), Zend (experimental).
PHP-PM is not ready for prime-time at the time of writing, but this technique is a fascinating approach that thinks outside the typical box of serving high-performance PHP applications. The authors are working on issues and pushing non-blocking processes in PHP to the limit. In my opinion, PHP will inch closer to being as performant as other options like Java and Node, and projects like PHP-PM seem like a neat approach to unlocking the performance needed for greater I/O. I am looking forward to seeing where projects like PPM and ReactPHP take PHP.
PHP7’s performance improvements were drastic from PHP5 and in my humble opinion we will see more performance-related focus on upcoming PHP releases and open-source software using PHP.
Learn More
Check out the official GitHub repository and the README to learn more about running PHP-PM.
One of the main contributors, Marc J. Schmidt, also wrote up a detailed article Bring High Performance Into Your PHP App (with ReactPHP) that explains the concepts used in PPM in greater detail.