PHP 5.5, w3 Total Cache, and opcache

PHP5.5 has ZendOptimizer opcache built in and it seems to work pretty well and the benchmarks seem to give it a slight edge over APC in performance. Great. So APC seems to be on its way out.

My question regards w3 total cache. W3TC has the option to do database and opcode caching using APC, and I had this working more or less fine with the APCu (APC user cache). Its compatibility with opcache wasn’t perfect — for example, you’d get some weird save issues if you didn’t make some tweaks to cache invalidation and so forth.

Read More

I’m wondering — is it worth it at all to use APCu for user stored caches for opcache/dbcache? I turned it off and my CPU load seems a little lower and I’m wondering if I’m really accomplishing anything given that Zend opcache is already doing the heavy lifting (is it?).

I prefer the more vanilla install (no APCu) as it’s one less thing to worry about. But I wonder if I’m really losing any performance. Thoughts?

Related posts

2 comments

  1. You seem to be a little confused about what function APCu performs. It only implements key/value store. It performs no opcode caching, since the whole point of APCu is to leave that to new Zend implementation of opcode.

    When you use APC(u) and compatible object cache plugin WP switches to storing its cache (which is natively discarded when page load ends) and transients (which are natively stored in database) in it. While not very visible this is major change to how internals tick.

    So answer to your question is two-part:

    1. Object cache is highly good idea since it’s used by WP big time and memory store is very very fast.

    2. APC(u) is just one of possible backends for object cache and if you are havving issues or concerns about it you could easily explore any alternative (memcached, redis, etc).

  2. In general you need to analyze how many hits and misses your cache gets. If you have relatively many misses then the cache is not useful. I think that APC provides this kind of stats.

    A page served from the page cache do not use PHP, and therefor the APC user cache, at all. The APC user cache is useful only if you have enough pages generated for logged in or commenting users.

    So yes, it is totally possible that APC user cache have always wasted you CPU time even before you have done this change, but it depends on your traffic profile.

Comments are closed.