Backend Development
PHP7
Detailed explanation on comparative analysis of Laravel blog application performance under PHP7.0 and PHP5.6The Homestead virtual machine version I currently installed is 2.1.8:

The PHP version pre-installed on this version of Homestead is 5.6.15:

We use the ab command (the performance testing tool provided by Apache) to test the performance of the Laravel application (taking the blog application developed using Laravel that we are currently talking about as an example) in this version. We simulate 10,000 times Requests, 100 concurrent stress tests:
ab -n 10000 -c 100 http://blog.app/
The running results are as follows:
This is ApacheBench, Version 2.3
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking blog.app (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Completed 10000 requests
Finished 10000 requests
Server Software: nginx/1.8.0
Server Hostname: blog.app
Server Port: 80
Document Path: /
Document Length: 324 bytes
Concurrency Level: 100
Time taken for tests: 69.354 seconds
Complete requests: 10000
Failed requests: 0
Total transferred: 19851388 bytes
HTML transferred: 10230000 bytes
Requests per second: 144.19 [#/sec] (mean)
Time per request: 693.545 [ms] (mean)
Time per request: 6.935 [ms] (mean, across all concurrent requests)
Transfer rate: 279.52 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.2 0 3
Processing: 17 684 319.1 588 2720
Waiting: 17 684 319.1 588 2720
Total: 20 684 319.1 588 2720
Percentage of the requests served within a certain time (ms)
50% 588
66% 695
75% 842
80% 933
90% 1155
95% 1321
98% 1545
99% 1813
100% 2720 (longest request)What we want to focus on here is the red bold text, that is, the number of requests processed per second, which is the measurement system key indicators of performance. Depending on the system and hardware configuration, there will be some discrepancies in the data.
Now we will upgrade PHP in Homestead to version 7.0 as described in the section "Laravel Homestead supports PHP 7 ".
Use vagrant ssh to log in to the newly added homestead-7 virtual machine and check whether the PHP version information is correct:

At this time, access http in the browser ://blog.app will report an error because the newly installed Homestead database data is empty. You need to log in to the virtual machine and run the following command to run the migration and fill in the data:
php artisan migrate php artisan db:seed
It will be OK to visit again. Okay, let’s continue. Use the same ab command to perform a stress test:
ab -n 10000 -c 100 http://blog.app/
The running results are as follows:
This is ApacheBench, Version 2.3
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking blog.app (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Completed 10000 requests
Finished 10000 requests
Server Software: nginx/1.8.0
Server Hostname: blog.app
Server Port: 80
Document Path: /
Document Length: 324 bytes
Concurrency Level: 100
Time taken for tests: 45.032 seconds
Complete requests: 10000
Failed requests: 0
Total transferred: 20101202 bytes
HTML transferred: 10230000 bytes
Requests per second: 222.06 [#/sec] (mean)
Time per request: 450.319 [ms] (mean)
Time per request: 4.503 [ms] (mean, across all concurrent requests)
Transfer rate: 435.91 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.2 0 4
Processing: 11 443 252.8 379 1978
Waiting: 11 443 252.8 379 1978
Total: 15 443 252.8 379 1978
Percentage of the requests served within a certain time (ms)
50% 379
66% 517
75% 590
80% 631
90% 795
95% 938
98% 1060
99% 1229
100% 1978 (longest request)After comparison, the performance of the same Laravel application under PHP 7.0 is 54% higher than that under PHP 5.6. This is A very significant performance improvement. Of course, the data will vary depending on the environment, and there is still more room for improvement.
Original address: https://xueyuanjun.com/post/2398
The above is the detailed content of Detailed explanation on comparative analysis of Laravel blog application performance under PHP7.0 and PHP5.6. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Dreamweaver Mac version
Visual web development tools

Dreamweaver CS6
Visual web development tools




