Putting cachedir on local disks in cluster

Putting cachedir on local disks in cluster

by Colin Campbell -
Number of replies: 2

We currently have Moodle 2.4 in dev and test environments and will be setting up a production environment over the next couple of months.  (We have been running 2.2 for the past couple of years.)  We just realized that with the new caching framework (MUC), we should not have $CFG->cachedir on a NFS mount.  Instead, we would like to put it on local disk on each of the eight production servers we are running.

Putting cachedir on local disk on each server seems straightforward except for one thing: How would we handle cache purging in that case?  I dug around in the code a bit and did not see how a cache purge would result in each server in the cluster purging its own cache.  Does anybody have any advice or suggestions on this?  Should we be looking at a different solution?  Thanks!

Average of ratings: -
In reply to Colin Campbell

Re: Putting cachedir on local disks in cluster

by Matteo Scaramuccia -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi Colin,
interesting question!
My poor suggestion is to file an issue directly into the Moodle Tracker: as you've described putting $CFG->cachedir locally per server - as already designed before MUC - breaks the purging action over all the nodes: never thought before now.

AFAIK there's no way to cleanup it programmatically unless coding something (unbreakable, read e.g. race conditions) into the $CFG->dataroot to announce the invalidation of the potentially local $CFG->cachedir.

HTH,
Matteo

In reply to Matteo Scaramuccia

Re: Putting cachedir on local disks in cluster

by Colin Campbell -

Thanks Matteo.  I submitted MDL-38059 and Petr responded quickly saying that cachedir must be on a shared disk.  Given the problems with locking on NFS, I suspect that we need to go with something like Memcached for the MUC caching.  Does that sound right to you?  Any other suggestions?

Colin