Performance Comparison of
PHP 5.6 vs. 7.0 vs HHVM
Jani Tarvainen - April 20th 2016
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
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
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
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
Benchmark case - Frontpage
Benchmark case - Top Stories
Benchmark case - Projects
Benchmark case - REST API Call
Memory usage and Response Time - Load Frontpage
with empty runtime and Symfony caches
Memory usage and Response Time - Load Frontpage with
empty runtime and Symfony caches
Memory usage and Response Time - Load Top Stories
page
Memory usage and Response Time - Load Top Stories
page
Memory usage and Response Time - Load Projects page
Memory usage and Response Time - Load Projects page
Memory usage and Response Time - Load Frontpage
Memory usage and Response Time - Load Frontpage
Requests served per second - Frontpage
without Symfony Reverse Proxy
Requests served per second - Frontpage with
Symfony Reverse Proxy
Requests served per second - API without
Symfony Reverse Proxy
Requests served per second - API with
Symfony Reverse Proxy
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
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)
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
...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)
Frontpage without Symfony Reverse Proxy
API without Symfony Reverse Proxy
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
Questions?
• Thank you!
• http://symfony.fi/php-hhvm

Performance Comparison of PHP 5.6 vs. 7.0 vs HHVM

  • 1.
    Performance Comparison of PHP5.6 vs. 7.0 vs HHVM Jani Tarvainen - April 20th 2016
  • 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 threeare 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 • Doneusing 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
  • 6.
  • 7.
    Benchmark case -Top Stories
  • 8.
  • 9.
    Benchmark case -REST API Call
  • 10.
    Memory usage andResponse Time - Load Frontpage with empty runtime and Symfony caches
  • 11.
    Memory usage andResponse Time - Load Frontpage with empty runtime and Symfony caches
  • 12.
    Memory usage andResponse Time - Load Top Stories page
  • 13.
    Memory usage andResponse Time - Load Top Stories page
  • 14.
    Memory usage andResponse Time - Load Projects page
  • 15.
    Memory usage andResponse Time - Load Projects page
  • 16.
    Memory usage andResponse Time - Load Frontpage
  • 17.
    Memory usage andResponse Time - Load Frontpage
  • 18.
    Requests served persecond - Frontpage without Symfony Reverse Proxy
  • 19.
    Requests served persecond - Frontpage with Symfony Reverse Proxy
  • 20.
    Requests served persecond - API without Symfony Reverse Proxy
  • 21.
    Requests served persecond - API with Symfony Reverse Proxy
  • 22.
    Conclusions • From astanding 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 HHVMpackages 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 Iuse? • 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)
  • 26.
  • 27.
    API without SymfonyReverse Proxy
  • 28.
    Cool Links • SymfonyBenchmarks: 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
  • 29.
    Questions? • Thank you! •http://symfony.fi/php-hhvm