Accelerators Revisited

by Mike Willbanks on December 24th, 2007

Updated 2007-12-30: I utilized the same configuration as previously with XCache in order to provide more detail to moo, the developer of XCache. After running these again, I found slightly different numbers in XCache (Still unknown why the previous numbers died in certain tests). The numbers have been updated below.

Due to feedback from the first time around for tuning settings I decided to re-run the tests. I found a much closer value this time, however, it seems that XCache had some odd results which I was unable to find out why they were so off. It might be that the variables were not configured to be cached? If anyone has any feedback on XCache settings let me know. The configuration that was utilized is shown at the end of the post. The details of the test are explained in a previous post outlining the details. There are some slight differences such as the configuration of some of the accelerators.


Here we had the bootstrap of the file using “require_once” on each of the included classes. Both APC and the Zend Platform are neck to neck here, however, the Zend Platform was ahead by 11 requests meanwhile XCache lagged behind at 986.


Here we had the bootstrap of the file using “require” on each of the included classes. Again APC and Zend Platform are comparable, however, APC was ahead by 14 requests meanwhile XCache lagged behind at 999.


Here we had the bootstrap of the file using “Zend_Loader::loadClass()” on each of the included classes. Again APC and Zend Platform are comparable, however, Zend Platform was ahead by 21 requests meanwhile XCache resulted in 881.

Configuration

The configuration of each item is explained below for reference.

APC


apc.enabled = 1
apc.shm_segments = 1
apc.shm_size = 30
apc.optimization = 0
apc.num_files_hint = 1000
apc.user_entries_hint = 4096
apc.ttl = 0
apc.user_ttl = 0
apc.gc_ttl = 3600
apc.cache_by_default = 1
apc.filters NULL
apc.mmap_file_mask NULL
apc.slam_defense = 0
apc.file_update_protection = 2
apc.enable_cli = 0
apc.max_file_size = 1M
apc.stat = 1
apc.write_lock = 1
apc.report_autofilter = 0
apc.include_once_override = 0
apc.localcache = 0
apc.localcache.size = 512

XCache


xcache.shm_scheme = "mmap"
xcache.size = 30M
xcache.count = 1
xcache.slots = 8K
xcache.ttl = 0
xcache.gc_interval = 0
xcache.var_size = 0M
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 = Off
xcache.mmap_path = "/dev/zero"
xcache.coredump_directory = ""
xcache.cacher = On
xcache.stat = On
xcache.optimizer = On

Zend Platform

“If you want to level the field, than you should set the acceleration to
extreme via the GUI and load only ZendPlatform.so (every extension from
Monitor to Debugger and Optimizer should be removed in php.ini)

You should then enable timestamp checking (change
zend_accelerator.validate_timestamps=0 to 1) because APC does that by
default (it’s slower but this will give level playing field and many
people prefer it on as they don’t need to restart Apache every time a
file is updated).”

Conclusions

APC and Zend Platform seem to be the strongest and APC which is available in PECL otherwise the Zend Platform is for purchase. What I thought a little off was that in order to get the Zend Platform to perform nicely, you had to turn off many of the different features which makes me think that it would either work better in a large server farm for a single platform or in a testing environment where a QA staff is checking everything.

Now this test isn’t exactly perfect such that the configuration isn’t perfectly tuned for each item. I know for myself I have decided on using APC after running all of these, however, XCache does seem like something I want to use in the future.

From PHP

15 Comments
  1. OnyxRaven permalink

    Any tests on eaccelerator? its relatively the same, but i’m curious as to any differences.

    Thanks for the good benches!

  2. @OnyxRaven
    I didn’t do any tests on eaccelerator. The reason that I didn’t was that it was once a dead project and in the longer term I really don’t see it sticking around all that long.

    Let me explain why I chose APC, XCache and Zend Platform:

    1. APC – APC may be part of the PHP 6 core, I say may because I haven’t kept up in that area for a little while.
    2. XCache – Since there is already XDebug and also lighttpd (XCache developer is also a developer of lighttpd) I believe that this project will fit in nicely. It seems like a solid area with a lot of ideas and active development.
    3. Zend Platform – Lets face it, they are Zend. The commercial support is mainly the largest bonus as well as the tools it provides for corporate companies running PHP servers.

    Updated comment since I was off base with XDebug and slightly lighttpd, please note Derick’s comment below.

  3. XCache has totally *nothing* to do with Xdebug, which also means *I* have nothing to do with XCache. They are seperate projects, run by seperate people – just like XCache and lighttpd.

  4. @Derick
    Thank you for the clarification. I apologize for any misguidance.

  5. I dropped a not on xcache’s forum. I hope someone will come to rescue xcache’s reputation ;)

    http://forum.lighttpd.net/topic/33150

  6. @Alexey
    Thank you :) I hope someone will swing by and tell me I am doing something wrong, or atleast I hope.

  7. It seems like xcache doesn’t even enalbled.
    My configuration, which works very well:

    zend_extension=/usr/lib/php5/lib/php/extensions/no-debug-non-zts-20060613/xcache.so
    auto_globals_jit=”0″
    xcache.cacher=”1″
    xcache.size=”32M”
    xcache.count=”2″
    xcache.slots=”8k”
    xcache.var_size=”32M”
    xcache.var_count=”1″
    xcache.readonly_protection=”0″
    xcache.mmap_path=”/dev/zero”
    xcache.stat=”1″
    xcache.coverager=”0″
    xcache.coveragedump_directory=”"
    xcache.admin.enable_auth=”1″
    xcache.admin.auth = On
    xcache.admin.user = “****”
    xcache.admin.pass = “****”

  8. Song permalink

    Hi, I got a much different result for XCache. In my tests, XCache complete about 5% more requests than APC, this is my configuration:

    xcache.cacher=On
    xcache.size=256M
    xcache.count=1
    xcache.slots=256k
    xcache.ttl=0
    xcache.gc_interval=0
    xcache.var_size=0
    xcache.var_solts=8k
    xcache.var_ttl=0
    xcache.var_maxttl=0
    xcache.var_gc_interval=300
    xcache.readonly_protection=Off
    xcache.mmap_path=/dev/zero

    xcache.optimizer=Off

    xcache.coverage=Off
    xcache.coveragedump_directory=/tmp/pcov

  9. @Davojan
    It seems that you are storing more in your xcache.count as well as your vars. What I was attempting to do here was equal the settings between the different caching engines.

    @Song
    You are using a fairly high amount of memory for xcache in consideration where I was using 30M which was the default for APC.

    What I would like to see is a similar amount of memory dedicated to xcache that is the same as APC. Typically in a larger server environment you are not going to give it a large amount of memory as that would limit the amount of requests that it would actually end up handling.

  10. Song permalink

    hi, this is my configure of apc. I gave apc and memory both 256M money.
    extension=apc.so
    apc.cache_by_default = 1
    apc.enable_cli = 0
    apc.enabled = 1
    apc.file_update_protection = 2
    apc.filters =
    apc.gc_ttl = 3600
    apc.include_once_override = 0
    apc.localcache = 0
    apc.localcache.size = 512
    apc.max_file_size = 1M
    apc.mmap_file_mask =
    apc.num_files_hint = 1000
    apc.report_autofilter = 0
    apc.rfc1867 = 0
    apc.shm_segments = 1
    apc.shm_size = 256
    apc.slam_defense = 0
    apc.stat = 1
    apc.stat_ctime = 0
    apc.ttl = 0
    apc.user_entries_hint = 4096
    apc.user_ttl = 0
    apc.write_lock = 1

  11. Yusuf permalink

    Mike, moo of xcache fame has commented here

    http://forum.lighttpd.net/topic/33150#14173

    Would be nice if you could discuss your findings with him directly

  12. @Yusuf
    I updated the above with some findings after rerunning information to give moo details. I am actually going to be sending him the further details once I have time to review them and give the information he requested.

  13. vaggos permalink

    Xcache seems faster for me. Number one compared to the rest.

  14. Daniel Sydnes permalink

    Thanks for publishing these benchmarks, Mike. I wonder if you can provide additional context? For example:

    - Test results from a control configuration (no accelerator)? Readers would have a better sense of the significance of the performance deltas between the accelerators, as well as what they are missing without opcode acceleration.

    - Environmental measurements (server load, memory usage, io queue length, etc.)? Readers could discover potential bottlenecks limiting performance in your tests.

    Thanks again!

  15. _ck_ permalink

    eAccelerator is a dead project? Hmm, is that opinion or fact? The other benchmarks/reviews I have seen show that while it a tad slower than APC in some cases, it’s actually more stable and more compatible.

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS