WordPress.org

Ready to get started?Download WordPress

Forums

W3 Total Cache page caching with memcached - low memcached hit rate (3 posts)

  1. Simon Wheatley
    Code for the People
    Posted 3 years ago #

    I'm running W3 Total Cache on two WP servers backed by a DB server running MySQL and Memcached. The page caching is using Memcached, which is configured with:

    MAXCONN=1024
    CACHESIZE=512
    OPTIONS=""

    I'm watching memcache-top and seeing only 64% hit rate on memcached (usage is 1.6% so there's plenty of space I think). The server running memcached seems very lightly loaded, load avg 0.01, CPU practically 0%, approx 30% of the RAM free.

    Are there some Memcached options I can tweak to improve the hit rate?

    Thanks in advance for any suggestions.

  2. m00b
    Member
    Posted 3 years ago #

    Let me just start by saying that the memcached daemon does not require much cpu to run and that a load such as you have is perfectly normal. If you're only using it for page caching then it won't be using anywhere near the amount of memory you have specified anyway. FYI memcached GROWS to the size you set in the config, starting at 64mb, but won't reach 512mb until that much is actually in its cache.

    Experiance has shown that memcached is certianly not the best method to go with. For a start, every connection to the daemon has to run through a php process, which doesnt actually reduce load at all, it increases it, if anything.

    I have a very similar setup to you, in that I loadbalance between two WWW servers. Except we only use memcached for minification.For page caching we setup an nfs share on the pgcache directory and then have nginx serve static w3tc files it creates in Disk (Enhanced) mode. We also use xcache on each of the www servers, although not in conjuction with w3tc, just as an opcode cacher. This setup has proven to be pretty fast and reliable.

    To answer your question, after all the pointless crap I said above, I don't believe there are options in memcached you can tweak to increase hitrate. You can of course get w3tc to do more caching with the daemon, object cache, db cache etc. From experiance however, this doesnt work well.

    If you continue to use memcached, add OPTIONS="-l ip.address" to its config and perhaps iptables rules to prevent unauthorized access to the daemon. Or run it on an internal ip.

    Sorry if this is blindingly obvious to you, I don't know how much previous experiance you have with memcached, but I hope some of this helps!

  3. Frederick Townes
    Member
    Posted 3 years ago #

    I have a very similar setup to you, in that I loadbalance between two WWW servers. Except we only use memcached for minification.For page caching we setup an nfs share on the pgcache directory and then have nginx serve static w3tc files it creates in Disk (Enhanced) mode. We also use xcache on each of the www servers, although not in conjuction with w3tc, just as an opcode cacher. This setup has proven to be pretty fast and reliable.

    Be aware that NFS does not scale for storage of cache files, your configuration is working for you because of your traffic level and hardware, not because it is ideal. After NFS, SAN is needed to scale and after that, well memcached.

    Also memcached is normally ideal in dedicated hosting environments because PHP would use memcache PECL extension which speeds up the memcached interactions, coupled with an opocde cache makes scale less of an issue.

    Are there some Memcached options I can tweak to improve the hit rate?

    Anyway, to increase hit rates, you would likely need to increase expire times. You may have lots of users posting comments which reduces hit rates for example

Topic Closed

This topic has been closed to new replies.

About this Topic