上次PHP框架介绍techtalk中,我给大家做演示,连接一台远程的Linux Server,测试了一下kiwiphp(kiwiphp是我自己写的一个小framework)性能,结果显示kiwiphp在执行一个简单的页面输出任务时,性能只有原生php的3%,而并非我演示之前说的30%,这个是不正常的,由于时间关系,我没有当场解决这个问题。后来我在笔记本和yroot上分别测了一下,30%是相对比较可信的。
现将测试结果贴这里备忘:
测试方法1
用php framework和原生php分别输出一个页面,该页面include一个公共头和一个公共尾
原生php代码参见附件
环境测试方法和结果:
nonmvc.txt的内容是100行http://localhost/mvc_bench/nonmvc/index.php
mvc.txt的内容是100行http://localhost/mvc_bench/mvc/index.php
http_load -parallel 10 -seconds 10 /home/jianxian/nonmvc.txt
11363 fetches, 10 max parallel, 1.52264e+06 bytes, in 10.0008 seconds
134 mean bytes/connection
1136.21 fetches/sec, 152252 bytes/sec
msecs/connect: 0.065158 mean, 12.248 max, 0.018 min
msecs/first-response: 4.99158 mean, 825.573 max, 0.733 min
HTTP response codes:
code 200 – 11363
http_load -parallel 10 -seconds 10 /home/jianxian/mvc.txt
3823 fetches, 10 max parallel, 512282 bytes, in 10.0013 seconds
134 mean bytes/connection
382.251 fetches/sec, 51221.7 bytes/sec
msecs/connect: 0.0706869 mean, 0.185 max, 0.018 min
msecs/first-response: 15.2609 mean, 867.053 max, 2.237 min
HTTP response codes:
code 200 – 3823
382.251 / 1136.21 = 33.64%
测试方法2
用php framework和原生php分别输出一个字串:Hello world
环境测试方法和结果:
nonmvc.txt的内容是100行http://localhost/mvc_bench/hw/nonmvc/index.php
mvc.txt的内容是100行http://localhost/mvc_bench/hw/mvc/index.php
http_load -parallel 10 -seconds 10 /home/jianxian/nonmvc.txt
11248 fetches, 10 max parallel, 1.50723e+06 bytes, in 10.0003 seconds
134 mean bytes/connection
1124.76 fetches/sec, 150718 bytes/sec
msecs/connect: 0.06526 mean, 4.462 max, 0.018 min
msecs/first-response: 4.60769 mean, 630.797 max, 0.763 min
HTTP response codes:
code 200 – 11248
http_load -parallel 10 -seconds 10 /home/jianxian/mvc.txt
4118 fetches, 10 max parallel, 477688 bytes, in 10.0002 seconds
116 mean bytes/connection
411.792 fetches/sec, 47767.9 bytes/sec
msecs/connect: 0.0731333 mean, 10.091 max, 0.018 min
msecs/first-response: 14.6304 mean, 828.407 max, 1.848 min
HTTP response codes:
code 200 -- 4118
411.792 / 1124.76 = 36.61% 小幅性能增长是因为我在框架中去掉了3个自动载入文件
update:禁用apc后测试结果是:
http_load -parallel 10 -seconds 10 /home/jianxian/nonmvc.txt
8922 fetches, 10 max parallel, 1.19555e+06 bytes, in 10.0009 seconds
134 mean bytes/connection
892.121 fetches/sec, 119544 bytes/sec
msecs/connect: 0.0680688 mean, 1.713 max, 0.018 min
msecs/first-response: 5.8938 mean, 745.489 max, 0.931 min
HTTP response codes:
code 200 -- 8922
http_load -parallel 10 -seconds 10 /home/jianxian/mvc.txt
1790 fetches, 10 max parallel, 207640 bytes, in 10.0027 seconds
116 mean bytes/connection
178.952 fetches/sec, 20758.5 bytes/sec
msecs/connect: 0.0744101 mean, 2.409 max, 0.019 min
msecs/first-response: 32.4393 mean, 1305.51 max, 5.265 min
HTTP response codes:
code 200 -- 1790
kiwiphp的性能是原生php的20%
你可以使用这个链接引用该篇文章 http://publishblog.blogchina.com/blog/tb.b?diaryID=6550993
|
- 评论人:shenzhe
2008-04-15 17:29:45
|
|||
再优化下,是不是要比原生的html还快了。 |
||||
|
- 评论人:丙川
2007-12-06 12:03:15
|
|||
你好,我想问一个,在win2k或winxp上,如何设置才能使iis和GreenAMP同时可以用?谢谢!!! |
||||