APC Object Cache Backend
[resolved] Combining WP's APC object cache with W3TC's APC object caching: good or bad? (7 posts)

  1. cms_
    Posted 2 years ago #

    Would running WP's APC object cache in parallel with W3TC's object cache in APC be considered a good practice? I know they each use their own labels, but will they incur unnecessary duplication?


  2. cms_
    Posted 2 years ago #

    Upon further inspection, it appears W3TC swaps in its own object-cache.php provider. With very low fragmentation, it appears to perform better than WP's own APC object cache drop-in.

  3. Maraki
    Posted 2 years ago #

    so if I use W3TC, you don't recommend using APC object cache?

  4. cms_
    Posted 2 years ago #

    Short answer: It depends.

    Give APC object caching a try, and monitor it with the included apc.php. APC object cache will be a bit faster, but if/when PHP segfaults/dies, you will lose all your cached objects. Memcache will persist if PHP goes down, but is a bit slower.

  5. Maraki
    Posted 2 years ago #

    so let's say i only use currently W3TC... For best performance I must either use APC or Memcache together with W3TC ?

    Been having some server nightmares with it going down with spike loads..

  6. cms_
    Posted 2 years ago #

    Dealing with traffic spikes can be tricky, especially if you're making a bunch of unnecessary database calls for each page view. Every site is different, so your solution will be one you must find yourself. APC is good for PHP opcode caching (PHP code compiled in memory). APC also does object (key/value) caching, and can be faster than memcached if your PHP is stable.

    If you get a lot of segfaults with PHP, as can happen when loading multiple extensions and under heavy load, you might be better off with the stability of memcached. It runs in its own box, and you won't lose your precious object cache if PHP craps out.

    Although reloading the opcode cache does not take much time or resources (files read are kept in memory), rebuilding an object cache can take an hour or more (depending on the size/complexity of the site) while data is read from SQL on disk into the cache. Those queries also take up CPU cycles. Because regenerating an object cache is expensive, stability is key.

    So try out memcached and APC together. Set w3tc to memcached, and use its suggested settings for the memcache PHP module. Start out with a low object TTL and make sure MySQL isn't spawning too many processes when you get a spike in visitors and competing for memory. Remember that memcached grows its memory consumption as it fills its cache up.

    Trial and error will get you there... just watch closely (or use monitoring) when you have the spikes and adjust the TTL, cache sizes, MySQL connections, PHP processes, etc. until you find the right balance.

  7. Maraki
    Posted 2 years ago #

    sorry cms_.. this is out of my league :( I am not quite sure I know how to monitor SQL and adjust all the things you mention.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • APC Object Cache Backend
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic