performance comparison of php 5.6 vs. 7.0 vs hhvm

Post on 14-Jan-2017

498 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Performance Comparison of PHP 5.6 vs. 7.0 vs

HHVMJani 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

Questions?

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

top related