测试程序为 ThinkPHP 3.2.3 框架(不带数据库操作):
409
PHP-FPM 运行池进程数量为 5 个。
测试时先将 php-fpm 服务重启,然后刷新 10 次页面,记录下每次页面的运行时间。
使用以个命令间隔 1 秒连续请求 URL,根据 ThinkPHP 的调试输出信息,打印出运行时间:
while [ 1 ]; do curl -s [url]http://thinkphp.ius/[/url] | egrep -o "运行时间[^<]+"; sleep 1; done
使用 IUS 官方打包编译的 PHP
[root@thinkphp ~]# service php-fpm restart
Stopping php-fpm: [ OK ]
Starting php-fpm: [ OK ]
[root@thinkphp ~]# while [ 1 ]; do curl -s http://thinkphp.ius/ | egrep -o "运行时间[^<]+"; sleep 1; done
运行时间 : 0.0132s ( Load:0.0110s Init:0.0010s Exec:0.0003s Template:0.0009s )
运行时间 : 0.0130s ( Load:0.0108s Init:0.0010s Exec:0.0003s Template:0.0009s )
运行时间 : 0.0136s ( Load:0.0110s Init:0.0010s Exec:0.0005s Template:0.0011s )
运行时间 : 0.0130s ( Load:0.0109s Init:0.0009s Exec:0.0003s Template:0.0009s )
运行时间 : 0.0128s ( Load:0.0107s Init:0.0009s Exec:0.0003s Template:0.0009s )
运行时间 : 0.0076s ( Load:0.0058s Init:0.0007s Exec:0.0002s Template:0.0009s )
运行时间 : 0.0081s ( Load:0.0062s Init:0.0008s Exec:0.0002s Template:0.0010s )
运行时间 : 0.0082s ( Load:0.0064s Init:0.0007s Exec:0.0002s Template:0.0009s )
运行时间 : 0.0077s ( Load:0.0060s Init:0.0007s Exec:0.0002s Template:0.0008s )
运行时间 : 0.0085s ( Load:0.0067s Init:0.0008s Exec:0.0002s Template:0.0009s )
使用基于 IUS 编译脚本本地编译的 PHP
[root@thinkphp ~]# service php-fpm restart
Stopping php-fpm: [ OK ]
Starting php-fpm: [ OK ]
[root@thinkphp ~]# while [ 1 ]; do curl -s http://thinkphp.ius/ | egrep -o "运行时间[^<]+"; sleep 1; done
运行时间 : 0.0133s ( Load:0.0111s Init:0.0009s Exec:0.0003s Template:0.0009s )
运行时间 : 0.0130s ( Load:0.0108s Init:0.0009s Exec:0.0003s Template:0.0009s )
运行时间 : 0.0130s ( Load:0.0109s Init:0.0009s Exec:0.0003s Template:0.0009s )
运行时间 : 0.0130s ( Load:0.0108s Init:0.0010s Exec:0.0003s Template:0.0009s )
运行时间 : 0.0130s ( Load:0.0107s Init:0.0009s Exec:0.0004s Template:0.0010s )
运行时间 : 0.0075s ( Load:0.0059s Init:0.0007s Exec:0.0001s Template:0.0008s )
运行时间 : 0.0074s ( Load:0.0058s Init:0.0007s Exec:0.0001s Template:0.0008s )
运行时间 : 0.0075s ( Load:0.0058s Init:0.0007s Exec:0.0001s Template:0.0008s )
运行时间 : 0.0102s ( Load:0.0080s Init:0.0010s Exec:0.0002s Template:0.0010s )
运行时间 : 0.0077s ( Load:0.0058s Init:0.0007s Exec:0.0002s Template:0.0010s )
运行时间 : 0.0071s ( Load:0.0056s Init:0.0006s Exec:0.0001s Template:0.0007s )