码迷,mamicode.com
首页 > Web开发 > 详细

自己动手ab测了个ThinkPHP与CodeIgniter框架性能对比

时间:2015-03-01 19:43:36      阅读:827      评论:0      收藏:0      [点我收藏+]

标签:

技术分享

PHP环境:Apache 2.4.10 + PHP 5.4.36

同样php输出代码

echo ‘Hello Qzzm!‘;

以下列出分别测试结果

一、CodeIgniter 2.2

This is ApacheBench, Version 2.3 <$Revision: 1604373 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking a.shy.pw (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: Apache/2.4.10
Server Hostname: a.shy.pw
Server Port: 80

Document Path: /index.php
Document Length: 11 bytes

Concurrency Level: 100
Time taken for tests: 23.541 seconds   #全部请 求完成耗时
Complete requests: 10000
Failed requests: 0
Total transferred: 2150000 bytes
HTML transferred: 110000 bytes
Requests per second: 424.80 [#/sec] (mean)
Time per request: 235.407 [ms] (mean)  #每次并发请求时间(所有并发)
Time per request: 2.354 [ms] (mean, across all concurrent requests)  #每一请求时间(并发平均) 
Transfer rate: 89.19 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.3 0 2
Processing: 20 235 191.6 204 1534
Waiting: 20 234 191.6 204 1533
Total: 21 235 191.6 204 1534

Percentage of the requests served within a certain time (ms)
50% 204
66% 211
75% 217
80% 220
90% 234
95% 262
98% 1235
99% 1376
100% 1534 (longest request)

 

二、Thinkphp 3.2.3开启Debug模式

This is ApacheBench, Version 2.3 <$Revision: 1604373 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking b.shy.pw (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
apr_pollset_poll: The timeout specified has expired (70007)
Total of 9997 requests completed

 

三、Thinkphp 3.2.3 不开启Debug模式也就是 正式发布的模式

This is ApacheBench, Version 2.3 <$Revision: 1604373 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking b.shy.pw (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: Apache/2.4.10
Server Hostname: b.shy.pw
Server Port: 80

Document Path: /index.php
Document Length: 11 bytes

Concurrency Level: 100
Time taken for tests: 205.808 seconds  #全部请 求完成耗时
Complete requests: 10000
Failed requests: 9
(Connect: 0, Receive: 0, Length: 9, Exceptions: 0)
Total transferred: 4096310 bytes
HTML transferred: 109901 bytes
Requests per second: 48.59 [#/sec] (mean)
Time per request: 2058.080 [ms] (mean)  #每次并发请求时间(所有并发)
Time per request: 20.581 [ms] (mean, across all concurrent requests)  #每一请求时间(并发平均) 
Transfer rate: 19.44 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.4 0 20
Processing: 823 2055 2623.9 1863 123212
Waiting: 0 1994 1170.4 1863 14484
Total: 823 2055 2623.9 1863 123212

Percentage of the requests served within a certain time (ms)
50% 1863
66% 1905
75% 1930
80% 1955
90% 2003
95% 2059
98% 4747
99% 12857
100% 123212 (longest request)

四、纯PHP模式,无框架

This is ApacheBench, Version 2.3 <$Revision: 1604373 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking a.shy.pw (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: Apache/2.4.10
Server Hostname: a.shy.pw
Server Port: 80

Document Path: /index1.php
Document Length: 11 bytes

Concurrency Level: 100
Time taken for tests: 6.312 seconds   #全部请 求完成耗时

Complete requests: 10000
Failed requests: 0
Total transferred: 2150000 bytes
HTML transferred: 110000 bytes
Requests per second: 1584.20 [#/sec] (mean)
Time per request: 63.123 [ms] (mean)  #每次并发请求时间(所有并发)
Time per request: 0.631 [ms] (mean, across all concurrent requests)  #每一请求时间(并发平均)
Transfer rate: 332.62 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.3 0 1
Processing: 1 63 275.7 15 1751
Waiting: 0 59 275.7 11 1743
Total: 1 63 275.7 15 1751

Percentage of the requests served within a certain time (ms)
50% 15
66% 16
75% 16
80% 16
90% 16
95% 17
98% 1596
99% 1659
100% 1751 (longest request)

分析得图表:

  全部请求完成耗时 每次并发请求时间(所有并发) 每一请求时间(并发平均) 
纯php无框架 6.312 秒 63.123 毫秒 0.631 毫秒
CodeIgniter 2.2 23.541 秒 235.407 毫秒 2.354 毫秒
ThinkPHP 3.2.3 205.808 秒 2058.080 毫秒 20.581 毫秒
ThinkPHP 3.2.3 Debug - - -

CodeIgniter完胜ThinkPHP,另外从下面的图中可以看到Laravel框架性能也高与CodeIgniter

不过考虑到虚拟主机兼容性和中文开发文档来说 CodeIgniter和Thinkphp还是比较实用

CodeIgniter php版本≥5.2

ThinkPHP 3.2.3   php版本≥5.3

Laravel 新一点的版本都是  php版本≥5.4

最后发一个框架性能图片 外国测试的,机器配置不详,好像是  ?分钟内的请求次数    用问号表示不知道几分钟,估计是1分钟

技术分享

yaf 扩展式框架最快

结束

 

自己动手ab测了个ThinkPHP与CodeIgniter框架性能对比

标签:

原文地址:http://www.cnblogs.com/qzzm/p/4307388.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!