With the popularity of PHP, the execution efficiency of PHP is also getting more and more attention, and there are more and more available caches, from the old php-memcache to eaccelerator, there are also emerging xcache. In order to select a suitable cache, you can determine which cache is more efficient. Since php-memcache is rarely used, only eaccele is tested.
With the popularity of PHP, the execution efficiency of PHP is also getting more and more attention, and there are more and more available caches, from the old php-memcache to eaccelerator, there are also emerging xcache. In order to select a suitable cache, you can determine which cache is more efficient. Since php-memcache is rarely used, only eaccele is tested.
With the popularity of PHP, the execution efficiency of PHP is also getting more and more attention, and there are more and more available caches, from the old php-memcache to eaccelerator, there are also emerging xcache. In order to select a suitable cache, you can determine which cache is more efficient. Since php-memcache is rarely used, only eaccelerator and xcache are tested. Hardware configuration: CPU: Intel 2140 (dual-core) memory: 2 GB DDR667 Hard Disk: 80 GB (IDE interface, 2 MB cache)
Software Versions: Mandriva 2008 free, apache-2.2.6, php-5.2.4, ZendOptimizer-3.3.0, mysql-5.0.45. Version of the test object: eaccelerator-0.9.5.2, xcache-1.2.1
Both eaccelerator and xcache are manually compiled and installed. Install and install the installation steps and parameters officially released. You can log on to their website to learn more. Considering the Commercial Code support, the caches are all installed with zend extensions, and the cache size of both caches is 64 MB (a little large, 16 Mb is not small ). During the test, the eaccelerator will test two items. One is the default one, the other is to put the cache directory of the eaccelerator into tmpfs, and I call it the memory mode of the eaccelerator. For more information about tmpfs, see http://lcuc.org.cn/node/304.
Test Tool for AB, test read object is phpMyAdmin-2.11.2, Discuz! _ 6.0.0 _ SC _GBK
PhpMyAdmin
Test statement: AB-n 100000 http: // localhost/phpmyadmin
Do not install any caches
[Root @ mandriva phpmyadmin] # AB-n 100000 http: // localhost/phpmyadminThis is apachenetworking, Version 2.0.40-dev <$ Revision: 1.146 $> apache-2.0Copyright 1996 Adam Twiss, zeus Technology Ltd, http://www.zeustech.net/Copyright 2006 The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient) Completed 10000 requestsCompleted 20000 requestsCompleted 30000 requestsCompleted 40000 requestsCompleted 50000 requestsCompleted 60000 requestsCompleted 70000 requestsCompleted 80000 limit 90000 requests
Server Software: Apache/2.2.6Server Hostname: localhostServer Port: 80
Document Path:/phpmyadminDocument Length: 337 bytes
Concurrency Level: 1 Time taken for tests: 20.699322 secondsComplete requests: 100000 Failed requests: 0 Write errors: 0Non-2xx responses: 100000 Total transferred: 59100000 bytesHTML transferred: 33700000 seconds per second: 4831.08 [#/sec] (mean) Time per request: 0.207 [MS] (mean) Time per request: 0.207 [MS] (mean, average SS all concurrent requests) Transfer rate: 2788.21 [Kbytes/sec] committed ed
Connection Times (MS) min mean [+/-sd] median maxConnect: 0 0 0.0 0 0 Processing: 0 0 1.2 0 294 Waiting: 0 0 1.2 0 294 Total: 0 0 1.2 0 294
Percentage of the requests served within a certain time (MS) 50% 066% 075% 080% 090% 095% 098% 099% 0100% 294 (longest request) the main performance indicator is Requests per second, only all feedback is given for the first time, and all others provide Requests per second.
Result: Requests per second: 4831.08 [#/sec] (mean)
EAccelerator result: Requests per second: 4850.92 [#/sec] (mean)
EAccelerator memory mode result: Requests per second: 4690.77 [#/sec] (mean)
Xcache result: Requests per second: 4781.96 [#/sec] (mean)
We found that the eAccelerator and xcache can be installed at the same time, so we also tried it. EAccelerator + xcache result: Requests per second: 4791.29 [#/sec] (mean)
The test result is that the eAccelerator memory mode wins. However, this does not seem to be necessary for the cache, and phpMyAdmin is too simple. Start Discuz! The request test of _ 6.0.0 _ SC _GBK is of more reference significance to domestic users.
Discuz! Description: Discuz! Installed by default, without any data, Discuz! The cache function is provided but is not enabled by default. The test results are not affected.
Test statement: AB-n 100000 http: // localhost/bbs/index. php for Discuz! The test adds the following sentence: AB-n 100000-c 200 http: // localhost/bbs/index. php super BT pai_^
AB-n 100000
Do not install any caches
[Root @ mandriva bbs] # AB-n 100000 http: // localhost/bbs/index. phpThis is apacheloud, Version 2.0.40-dev <$ Revision: 1.146 $> apache-2.0Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/Copyright 2006 The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient) Completed 10000 requestsCompleted 20000 requestsCompleted 30000 requestsCompleted 40000 requestsCompleted 50000 requestsCompleted 60000 requestsCompleted 70000 requestsCompleted 80000 limit 90000 requests
Server Software: Apache/2.2.6Server Hostname: localhostServer Port: 80
Document Path:/bbs/index. phpDocument Length: 9251 bytes
Concurrency Level: 1 Time taken for tests: 2278.10424 secondsComplete requests: 100000 Failed requests: 0 Write errors: 0 Total transferred: 958900000 bytesHTML transferred: 925100000 bytesRequests per second: 43.90 [#/sec] (mean) Time per request: 22.780 [MS] (mean) Time per request: 22.780 [MS] (mean, average SS all concurrent requests) Transfer rate: 411.07 [Kbytes/sec] committed ed
Connection Times (MS) min mean [+/-sd] median maxConnect: 0 0 0.0 0 0 Processing: 21 22 0.9 22 137 Waiting: 14 21 0.6 21 40 Total: 21 22 0.9 22 137
Percentage of the requests served within a certain time (MS) 50% 2266% 2275% 2280% 2390% 2395% 2398% 2499% 24100% (longest request)
Result: Requests per second: 43.90 [#/sec] (mean)
EAccelerator result: Requests per second: 167.28 [#/sec] (mean)
EAccelerator memory mode result: Requests per second: 168.53 [#/sec] (mean)
Xcache result: Requests per second: 191.68 [#/sec] (mean)
AB-n 100000-c 200
Result: Requests per second: 77.73 [#/sec] (mean)
EAccelerator result: Requests per second: 317.69 [#/sec] (mean)
EAccelerator memory mode result: Requests per second: 325.86 [#/sec] (mean)
Xcache result: Requests per second: 388.76 [#/sec] (mean)
At this time, the results have obviously won the xcache, and the gaps have also widened.
Result: The xcache performance is quite good and can replace eAccelerator. The memory mode of the eAccelerator does not greatly improve the performance of the eAccelerator, but increases the complexity of system configuration.
At the same time, pay attention to the performance of mysql. In the Discuz! In some tests, the CPU usage was almost 100%. When no cache server is installed, the mysql usage is only about 10%, and the rest are occupied by apache. When installing any buffer, the usage of Single-thread mysql is about 35%, that of multi-thread is about 40%, and that of others is occupied by apache. In this case, the cache is very important in php applications. A cache can greatly reduce the burden on apache. Therefore, we recommend that all php users install a cache.
Note: The parameters used in this test are a bit BT ^ _ ^. However, we just want to get an approximate and reasonable test result. It takes a little longer.