A lot has happened in the world of PHP and web development in terms of performance in the last few years. Facebook's HHVM runtime pushed the envelope with improved performance and efficiency, but now with PHP 7.0 out what is the case now?
Here are some numbers for running a Symfony application, eZ Platform through it's paces on PHP 5.6, PHP 7.0 and HHVM.
2. About me - Jani Tarvainen
• Working on the web professionally from 2000 in various roles in
development, support operations, management and consulting
• By day I help people build the web at eZ Systems
• By night I do things at Malloc for fun/profit
• On Twitter: @velmu
3. PHP performance lately
• PHP 5.6
• Opcode cache built in (since 5.5)
• HHVM 3.x
• Increased performance
• Facebook's own Hacklang for features
• PHP 7.0
• Increased performance and more efficient memory use
• New PHP language features
4. Compatibility
• All three are are solid for production use
• Symfony achieves 100% PHP7 compatibility
• Symfony 2.3 achieves 100% HHVM compatibility
• PHP 7 feature support in HHVM
5. Benchmark case
• Done using a full Symfony2 framework application - eZ Platform demo
• A few page loads and REST API calls used
• Tests done on dedicated VPSes, repeated 3 times and averages
reported
• Details: Symfony Benchmarks: PHP 5.6, HHVM 3.11 and PHP 7.0.1
22. Conclusions
• From a standing start HHVM can be the slowest (JIT)
• HHVM beats PHP 5.6 in memory usage and throughput
• PHP 7.0 is the fastest and uses a significantly than 5.6 or HHVM less
memory
• When you've got a lot of template processing, etc. the difference
between HHVM and PHP 7.0 closes down, compared to that of the
API calls
23. Adoption
• Prebuilt HHVM packages for Ubuntu, Debian
• PHP 7.0 available for CentOS/RHEL, Debian
• Containers (Docker, etc.) makes runtime packaging easier
• PHP 7.0 is default in Ubuntu 16.04 LTS, release tomorrow (April 21st)
24. What should I use?
• PHP 5.6 is super safe
• HHVM can be a boost for non PHP 7-compatible apps and Hacklang
features
• PHP 7.x is the future, I suggest targeting it
• Some PHP 7 polyfills available: New in Symfony 2.8: Polyfill
Components
25. ...PHP-PM and PHPFastCGI?
• Traditionally PHP boots up from scratch
• PHP-PM and PHPFastCGI Running PHP as long running processes
• High performance, but introduce memory leak worries, etc
• Still work in progress, but stabilising
• Details: PHP-FPM vs. PHP-PM (on PHP 7 and HHVM)
28. Cool Links
• Symfony Benchmarks: Introduction
• How Badoo saved one million dollars switching to PHP7
• Migrating from PHP 5.6.x to PHP 7.0.x
• Wikipedia on HHVM
• Running Symfony Applications with PHP-PM or PHPFastCGI
• PHP High-Performance - Follow Up with Symfony/Jarves.io and PHP-
PM
• Things to consider when developing an application with PHPFastCGI