最近在怀疑APC(Alternative PHPCache)到底有没有Zend包中的产品厉害(实际APC也是Zend的内部团队开发的),国内找了很多,没有结果,测试又复杂,找到一篇外国blog,不错,备案一下,大家可参考一下APC和Zend Optimizer、Xcache以及纯PHP环境下的差别和优势!
没有翻译,重点看后面测试结果即可……
Tonight I wanted to see how the Zend Framework would run against an application that I have put in quite a bit of components into. I figured with the amount of objects that have been instanciated that there was likely going to be a larger performance hit overall. These results may surprise you with what really made a difference as far as PHP Accelerators.
Zend Framework : Release 1.0.3
- Zend_Cache
- Zend_Config
- Zend_Config_Xml
- Zend_Db
- Zend_Db_Table
- Zend_Registry
- Zend_Loader
- Zend_Controller_Front
- Zend_Auth
- Zend_Acl
- Zend_Acl_Role
- Zend_Acl_Resource
- Zend_Session
- Zend_Session_Namespace
Testing Environment
- PHP 5.2.5
- Apache 2.2.6
Test Results(测试结果)
Pure PHP(纯PHP)
Concurrency Level: 10(并发数) Time taken for tests: 60.655071 seconds Complete requests: 298(完成请求数,意思是,60秒完成298次请求) Failed requests: 0 Write errors: 0 Total transferred: 643149 bytes HTML transferred: 516971 bytes Requests per second: 4.91 [#/sec] (mean)(每秒请求) Time per request: 2035.405 [ms] (mean)(单个请求所用时间) Time per request: 203.541 [ms] (mean, across all concurrent requests)(并发情况下,平均每个请求时间) Transfer rate: 10.35 [Kbytes/sec] received
APC
Concurrency Level: 10
Time taken for tests: 60.106697 seconds
Complete requests: 914(优势明显,3倍的提升)
Failed requests: 0
Write errors: 0
Total transferred: 1962675 bytes
HTML transferred: 1582035 bytes
Requests per second: 15.21 [#/sec] (mean)
Time per request: 657.623 [ms] (mean)
Time per request: 65.762 [ms] (mean, across all concurrent requests)
Transfer rate: 31.88 [Kbytes/sec] received
Zend Optimizer
Concurrency Level: 10 Time taken for tests: 60.302711 seconds Complete requests: 262 Failed requests: 0 Write errors: 0 Total transferred: 564135 bytes HTML transferred: 454727 bytes Requests per second: 4.34 [#/sec] (mean) Time per request: 2301.630 [ms] (mean) Time per request: 230.163 [ms] (mean, across all concurrent requests) Transfer rate: 9.12 [Kbytes/sec] received
XCache
Concurrency Level: 10 Time taken for tests: 60.261114 seconds Complete requests: 292 Failed requests: 0 Write errors: 0 Total transferred: 628485 bytes HTML transferred: 506597 bytes Requests per second: 4.85 [#/sec] (mean) Time per request: 2063.737 [ms] (mean) Time per request: 206.374 [ms] (mean, across all concurrent requests) Transfer rate: 10.17 [Kbytes/sec] received
Conclusions
What I find quite interesting about this, is that APC was the only one to provide a much higher amount of requests while all the others slowed the requests down. I believe this may be related to utilizing the Zend_Loader functionality which also slows some items down for anything attempting to optimize and cache. I believe after I change that I am going to run these tests again and see if there is any large speed changes. I will post more about this more than likely in a week or so.
原文地址: