make php fast again
TRANSCRIPT
Make PHP Fast AgainPHP Performance Benchmarks
Peter Kokot github.com/petk
@peter_kokot
Intro
Why?
40% of users abandon a website that takes more than 3 seconds to load
General performance improvements guidelines● Server hardware● Minimize and optimize image file sizes● Gzip compression● Pre HTTP/2 minimize and combine JavaScript and CSS files● CDN● Asynchronous scripts loading
Synchronous vs. asynchronous loading
Blackfire is a Performance Management Solution. It can be used at any step of your application's lifecycle: during development, test, staging and production, to profile, test, debug and optimize its performance.
How to Achieve even more?
DisclaimerThe following stacks can behave differently on different hardware and configuration.
The following benchmarks are advised to be made on your own as well to get a better overview.
BenchmarksApache, Nginx, OpenLiteSpeed
Apache Benchmarking Tool● ab -c 100 -n 100000 -k http://localhost/● Intel® Core™ i7-2670QM CPU @ 2.20GHz × 8 with 16GB RAM
Static HTML File Benchmarksab -c 100 -n 100000 -k http://localhost/
PHP Benchmarksab -c 100 -n 100000 -k http://localhost/
PHP FPMTCP/IP Socket vs. Unix Domain Socketlisten = 127.0.0.1:9000 vs. listen = /run/php/php-fpm.sock
PHP-PM● PHP-PM is a process manager, supercharger and load balancer for PHP
applications.● Based on ReactPHP● Out of the box support for Symfony, Laravel, Zend Framework and Drupal
> github.com/php-pm/php-pm
PHP PM Benchmarks
Swoole is an event-driven, asynchronous & concurrent networking communication engine with higher performance written only in C for PHP. Swoole includes components for different purposes: TCP/UDP Server and Client, Task Worker, Database Connection Pooling, Millisecond Timer, Event, Async IO, Async Http/WebSocket Client, Async Redis Client, Async MySQL Client, and Async DNS Requiring.
> www.swoole.com
Swoole Benchmark
Combined Benchmarks
> github.com/petk/benchmarks
Next PHP Versions?● JIT - Just-In-Time compiling
● PHP 8 or PHP 7.2
Thank you!Questions welcome