We're migrating multiple Moodle installations which are currently on standalone VMs into a dedicated cluster. The cluster has 3 nodes and we'd like to use memcached for sessions + caching.
What's currently not clear to me is how Moodle handles the distribution of cache + session files across the nodes. From my understanding:
- I can define a pool with multiple Memcached servers. Here I will define all 3 nodes.
- Moodle will check all memcached servers in the pool and serve cache data from the first found memcached server that has the data available. Otherwise it'll be a cache MISS and the data is added to the cache.
- Moodle will periodically perform a cache flush, which is why it is required to have 2 seperate memcached instances; one for session data and one for cache data.
Now it's fine if cache data is missing as it'll simply need to regenerate the cache. However, missing sessions are of course a problem. The cluster has to be redundant. We want it to run fine with only 1 node up (out of 3). With sessions, it is possible a user is logged out of a memcached server goes down, unless the session data is replicated across all memcached servers in the pool.
It is not clear to me if Moodle handles this natively. I was able to find this URL which supposedly solved this problem in Moodle < 2.8:
The URL mentions it is now merged in Moodle 2.8+ but I haven't been able to explicitely find this feature.
If it is not possible natively in Moodle I saw that the PHP memcache extension does support this:
However, for data caching Moodle uses the Memcached (instead of memcache) extension. Now I'm fine with installing both but if it's not required because of native support I'd rather not do so.
Could anyone clear this up for me and perhaps tell me the recommended way to manage this?