OP Cache大比拼: APC vs eAccelerator vs xcache, eAccelerator胜出
APC 3.0.19 (Alternative PHP Cache) 配置extension=apc.so apc...
扫描右侧二维码阅读全文
25
2008/08

OP Cache大比拼: APC vs eAccelerator vs xcache, eAccelerator胜出

APC 3.0.19 (Alternative PHP Cache)
配置

extension=apc.so apc.enabled=1 apc.shm_segments=1 apc.shm_size=128 apc.ttl=7200 apc.user_ttl=7200 apc.num_files_hint=1024 apc.mmap_file_mask=/tmp/apc.XXXXXX apc.enable_cli=1

结果

7303 fetches, 50 max parallel, 1.67458e+07 bytes, in 300 seconds 2293 mean bytes/connection 24.3433 fetches/sec, 55819.3 bytes/sec msecs/connect: 3.27583 mean, 2999.74 max, 0.184 min msecs/first-response: 2043.52 mean, 7853.21 max, 325.513 min HTTP response codes: code 200 -- 7303

eAccelerator 0.9.5.3
配置

[eaccelerator] extension=eaccelerator.so eaccelerator.shm_size="16" eaccelerator.cache_dir="/tmp/eaccelerator" eaccelerator.enable="1" eaccelerator.optimizer="1" eaccelerator.check_mtime="1" eaccelerator.debug="0" eaccelerator.log_file = "/var/log/httpd/eaccelerator_log" eaccelerator.filter="" eaccelerator.shm_max="0" eaccelerator.shm_ttl="0" eaccelerator.shm_prune_period="0" eaccelerator.shm_only="0" eaccelerator.compress="1" eaccelerator.compress_level="9"

结果

7568 fetches, 50 max parallel, 1.73534e+07 bytes, in 300.001 seconds 2293 mean bytes/connection 25.2266 fetches/sec, 57844.6 bytes/sec msecs/connect: 0.39873 mean, 1.01 max, 0.173 min msecs/first-response: 1972.44 mean, 5520.1 max, 635.565 min HTTP response codes: code 200 -- 7568

XCache v1.2.2
配置

extension="xcache.so" [xcache.admin] ; Change xcache.admin.user to your preferred login name xcache.admin.user = "admin" ; Change xcache.admin.pass to the MD5 fingerprint of your password ; Use md5 -s "your_secret_password" to find the fingerprint xcache.admin.pass = "e10adc3949ba59abbe56e057f20f883e" [xcache] ; Change xcache.size to tune the size of the opcode cache xcache.size = 24M xcache.shm_scheme = "mmap" xcache.count = 2 xcache.slots = 8K xcache.ttl = 0 xcache.gc_interval = 0 ; Change xcache.var_size to adjust the size of variable cache xcache.var_size = 8M xcache.var_count = 1 xcache.var_slots = 8K xcache.var_ttl = 0 xcache.var_maxttl = 0 xcache.var_gc_interval = 300 xcache.test = Off xcache.readonly_protection = On xcache.mmap_path = "/tmp/xcache" xcache.coredump_directory = "" xcache.cacher = On xcache.stat = On xcache.optimizer = On [xcache.coverager] xcache.coverager = Off xcache.coveragedump_directory = ""

结果

4539 fetches, 50 max parallel, 1.04079e+07 bytes, in 300 seconds 2293 mean bytes/connection 15.13 fetches/sec, 34693.1 bytes/sec msecs/connect: 0.405883 mean, 0.999 max, 0.182 min msecs/first-response: 3214.64 mean, 18691.3 max, 772.952 min HTTP response codes: code 200 -- 4539

No OP-Cache
结果

1798 fetches, 50 max parallel, 3.9867e+06 bytes, in 300 seconds 2217.3 mean bytes/connection 5.99332 fetches/sec, 13289 bytes/sec msecs/connect: 12.0802 mean, 2999.48 max, 0.203 min msecs/first-response: 6966.64 mean, 59754 max, 381.002 min 41 timeouts 61 bad byte counts HTTP response codes: code 200 -- 1757

结论:
eAccelerator 0.9.5.3
25.2266 fetches/sec

APC 3.0.19
24.3433 fetches/sec

XCache v1.2.2
15.13 fetches/sec

No OP-Cache
5.99332 fetches/sec

eA的效果最好.APC紧随其后.两者的性能表现基本相同.xcache最差.

Last modification:November 26th, 2018 at 04:16 pm
If you think my article is useful to you, please feel free to appreciate

5 comments

  1. david

    I have problem with these comparisons:

    1) shm sizes are different:
    APC: 128M
    eA: 16M
    XCache: 24M

    2) Optimization turned for eA and XCache are turned on; this will impact performance quite a bit.

  2. Johnny Woo

    内存方面我在最后整理的时候注意到了
    但是有两点考虑让我最后决定忽略它
    1.这次测试只是一个页面.所以OPCODE缓冲使用的空间16M也足够了
    2.测试结果显示尽管XCache比eA拥有更多内存,但是测试结果却更差.说明内存不是一个,至少不是一个关键的影响因素
    关于优化选项,eA和XCache都打开了,而APC似乎没有什么优化选项,或者是我忽略了.不过我曾测试过ea和xc各自打开和关闭优化选项所带来的表现,结果是在这个测试用例中,是可以忽略其影响的.
    谢谢你的提问,这使得今后我们的测试会更严谨.

  3. 三马

    用的是Apache吗?也许用lighttpd对xcache公平一些。

    博主,鄙人的blog现在搬家到了:http://www.csphp.com/ 原来的 csask站长日志 已经不使用了:)

  4. Johnny Woo

    好的.我更改下好友链接
    用的是apache 2.2.4的
    因为这些都是PHP的插件.所以用lighttpd.我猜测可能不会有什么改变.

  5. links for 2008-08-30 | 甘先生blog

    [...] OP Cache大比拼: APC vs eAccelerator vs xcache, eAccelerator胜出 | 架构研究室 (tags: cache) [...]

Leave a Comment