目前我安装的 Homestead 虚拟机版本是 2.1.8:
该版本 Homestead 上预装的 PHP 版本是 5.6.15:
我们使用 ab 命令(Apache 提供的性能测试工具)在该版本中测试 Laravel 应用(以目前正在讲的使用Laravel开发的博客应用为例)性能,我们模拟 10000 次请求,100 个并发进行压力测试:
- ab -n 10000 -c 100 http://blog.app/
@H_404_22@
运行结果如下:
- 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)
@H_404_22@
@H_404_22@
再次访问就OK了,好了我们继续使用同样的 ab 命令进行压力测试:
- ab -n 10000 -c 100 http://blog.app/
@H_404_22@
运行结果如下:
- This is ApacheBench,Version 2.3
- Copyright 1996 Adam Twiss,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)
@H_404_22@
@H_404_22@
更多学习内容请访问:@H_404_22@ 腾讯T3-T4标准精品PHP架构师教程目录大全,只要你看完保证薪资上升一个台阶(持续更新)
@H_404_22@