PHP 7.0.0 was just tagged yesterday, and I was interested to see if it could live up to the performance claims that Zend made. Yii2 is my PHP framework of choice, so I built PHP 7.0.0 from source, stress tested one of my application’s pages, and compared performance to PHP 5.6.4.
The maximum acceptable levels here for web performance are PHP 5.6.4 serving between 75-100 RPS at between a 31ms-176ms response time and PHP 7.0.0 serving 175 RPS at a 47ms response time.
PHP 7.0.0 does a very nice job here- about 2x the performance for serving Yii2! It seems that it is definitely worth upgrading.
I used Vegeta to HTTP Load test:
- Ran between 25 - 400 Requests per second for 5 seconds
- Recorded the 99th percentile of request time
The PHP page did the following:
- Initialized the Yii2 Framework
- Created a Session ID for the request and inserted it into a remote database
- Rendered a view containing a login page
Both PHP 5.6.4 and 7.0.0 were configured as follows:
- Served using NGINX and PHP-FPM
- OpCache Enabled
- PHP-FPM pool could spawn up to 25 child processes
The server configuration was:
- n1-standard-1 instance on Google Compute Engine
- 1 vCPU, 3.75GB RAM, and a 100GB Standard Persistent Disk
- PHP 5.6.4, PHP 7.0.0, and Vegeta were each run on their own servers