performance comparison of php 5.6 vs. 7.0 vs hhvm

29
Performance Comparison of PHP 5.6 vs. 7.0 vs HHVM Jani Tarvainen - April 20th 2016

Upload: jani-tarvainen

Post on 14-Jan-2017

502 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Performance Comparison of PHP 5.6 vs. 7.0 vs HHVM

Performance Comparison of PHP 5.6 vs. 7.0 vs

HHVMJani Tarvainen - April 20th 2016

Page 2: Performance Comparison of PHP 5.6 vs. 7.0 vs HHVM

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

Page 3: Performance Comparison of PHP 5.6 vs. 7.0 vs HHVM

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

Page 4: Performance Comparison of PHP 5.6 vs. 7.0 vs HHVM

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

Page 5: Performance Comparison of PHP 5.6 vs. 7.0 vs 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

Page 6: Performance Comparison of PHP 5.6 vs. 7.0 vs HHVM

Benchmark case - Frontpage

Page 7: Performance Comparison of PHP 5.6 vs. 7.0 vs HHVM

Benchmark case - Top Stories

Page 8: Performance Comparison of PHP 5.6 vs. 7.0 vs HHVM

Benchmark case - Projects

Page 9: Performance Comparison of PHP 5.6 vs. 7.0 vs HHVM

Benchmark case - REST API Call

Page 10: Performance Comparison of PHP 5.6 vs. 7.0 vs HHVM

Memory usage and Response Time - Load Frontpage with empty runtime and Symfony caches

Page 11: Performance Comparison of PHP 5.6 vs. 7.0 vs HHVM

Memory usage and Response Time - Load Frontpage with empty runtime and Symfony caches

Page 12: Performance Comparison of PHP 5.6 vs. 7.0 vs HHVM

Memory usage and Response Time - Load Top Stories page

Page 13: Performance Comparison of PHP 5.6 vs. 7.0 vs HHVM

Memory usage and Response Time - Load Top Stories page

Page 14: Performance Comparison of PHP 5.6 vs. 7.0 vs HHVM

Memory usage and Response Time - Load Projects page

Page 15: Performance Comparison of PHP 5.6 vs. 7.0 vs HHVM

Memory usage and Response Time - Load Projects page

Page 16: Performance Comparison of PHP 5.6 vs. 7.0 vs HHVM

Memory usage and Response Time - Load Frontpage

Page 17: Performance Comparison of PHP 5.6 vs. 7.0 vs HHVM

Memory usage and Response Time - Load Frontpage

Page 18: Performance Comparison of PHP 5.6 vs. 7.0 vs HHVM

Requests served per second - Frontpage without Symfony Reverse Proxy

Page 19: Performance Comparison of PHP 5.6 vs. 7.0 vs HHVM

Requests served per second - Frontpage with Symfony Reverse Proxy

Page 20: Performance Comparison of PHP 5.6 vs. 7.0 vs HHVM

Requests served per second - API without Symfony Reverse Proxy

Page 21: Performance Comparison of PHP 5.6 vs. 7.0 vs HHVM

Requests served per second - API with Symfony Reverse Proxy

Page 22: Performance Comparison of PHP 5.6 vs. 7.0 vs HHVM

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

Page 23: Performance Comparison of PHP 5.6 vs. 7.0 vs HHVM

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)

Page 24: Performance Comparison of PHP 5.6 vs. 7.0 vs HHVM

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

Page 25: Performance Comparison of PHP 5.6 vs. 7.0 vs HHVM

...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)

Page 26: Performance Comparison of PHP 5.6 vs. 7.0 vs HHVM

Frontpage without Symfony Reverse Proxy

Page 27: Performance Comparison of PHP 5.6 vs. 7.0 vs HHVM

API without Symfony Reverse Proxy

Page 29: Performance Comparison of PHP 5.6 vs. 7.0 vs HHVM

Questions?

• Thank you!• http://symfony.fi/php-hhvm