• Resolved webdevm4dc

    (@webdevm4dc)


    Hello,

    I have a HA complex setup, where each WP website is replicated on like 10x servers. This includes the database too, and the traffic is load balanced. Also using CF for some benefits.

    I tried to use W3 cache but failed because:

    1. I cannot use disk cache, because I ignore “cache” folders in replication
    2. I cannot upgrade to “enterprise” to use Amazon SNS and APCu cache
    3. I do not want to use a CDN to host all the media and such on it

    Looking at the code on GitHub, I can see possibility for memcached to work in such environment ?

    I was thinking of installing memcached or redis on each server, and then add all the servers in the cache settings – would something like that work ?

    Theoretically it should save the cache per website/host on each server ?

    I’m not sure if this was ever tested, and I am in production so I cannot really play around too much…

    Many thanks for your advice.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @webdevm4dc,
    I am happy to assist you with this.
    Memcached and Redis are both suitable options. If you use the same configuration for each server, there should only be one “server” in the W3TC config, 127.0.0.1:11211 for Memcached or 127.0.0.1:6379 for Redis.
    That will indeed save cache per website separately for each server.

    1. I cannot use disk cache, because I ignore “cache” folders in replication

    That doesn’t matter, you can still use disk cache, the cache directory will be created automatically. This will act similar to using Memcached or Redis, but if you replicate Memcached or Redis to other servers, you won’t have to deal with outdated cache on a mirror server.

    I hope this helps.

    Thread Starter webdevm4dc

    (@webdevm4dc)

    Thank you very much, just to confirm that my theory would work:

    – Memcached on each server running on default port 11211
    – Inside wordpress for example.com I add only the “current” ( localhost ) memcached server ( 127.0.0.1:11211 )
    – W3 will store/manage/refresh the cache on each server accordingly ( eg user lands on server nr 3, but there is no cache yet, W3 will add it

    And this should cause no problems right ?

    I don’t know about replicating memcached, with mariadb it was easy using galera. Do I really need to replicate the memcache or my example above will work just fine ?

    The concern is, how does server nr 3 know that I just “flushed cache” on server 1 ?

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @webdevm4dc,

    That is correct! If you don’t replicate Memcached, server 3 indeed won’t know server 1 just flushed cache or changed a page, so you might get discrepancies with one server serving something different than another (e.g. every refresh could display another version of the page, depending on how the load balancer is set up).
    We have not done any testing with multiple Memcached servers but it should work properly if you add all servers to the W3TC config.

    Thread Starter webdevm4dc

    (@webdevm4dc)

    I see, and there is no way to make each server aware of each other? This is why I was thinking to add all the servers into the config…

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @vmarko,

    Again correct as mentioned in the previous post.

    Thread Starter webdevm4dc

    (@webdevm4dc)

    Ok thanks for everything.

    Thread Starter webdevm4dc

    (@webdevm4dc)

    One more question regarding this topic, would https://aws.amazon.com/elasticache solve the issue with the cache mirror ?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘High Availability cluster setup + LBS – memcached/redis ?’ is closed to new replies.