Cache Settings in config.php - help

Cache Settings in config.php - help

by Noveck Gowandan -
Number of replies: 6

Hello everyone,

Quick question on Moodle 3.0.

Before I begin, here's my environment:
We have a multi-frontend (4 webservers Apache/PHP56) and a master/slave backend (MySQL 5.6)

Moodle data is handled via NFS on the backend, sessions are stored via files on the backend.


On to my question:


In the config.php, I'm seeing three variables that are not in use on my systems. What are the implications of leaving these off? (as is).

If I had to implement the tempdir and cachedir, seeing that they should be shared between the frontends, can I use the existing NFS share for this? (create a couple new subfolders in the moodledata)
The localcachedir is fairly straightforward, I think.


Any ideas?

//     $CFG->tempdir = '/var/www/moodle/temp';        // Files used during one HTTP request only.
//     $CFG->cachedir = '/var/www/moodle/cache';      // Directory MUST BE SHARED by all cluster nodes, locking required.
//     $CFG->localcachedir = '/var/local/cache';      // Intended for local node caching.


I also have a question about  memcached. I have the frontend servers also acting as memcached stores - can any possible complications arise from this? The config hasnt complained, and I've not seen any flags thrown.

Thoughts appreciated, and thanks in advance for all that you guys do.

Average of ratings: -
In reply to Noveck Gowandan

Re: Cache Settings in config.php - help

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Your cache *has* to be shared between the front ends (i.e. on a common server). If it isn't it won't work and I would expect some weird errors or poor performance (or both).

Average of ratings: Useful (1)
In reply to Howard Miller

Re: Cache Settings in config.php - help

by Noveck Gowandan -

Thanks Howard.
I think I understand that part a bit.


I was wondering if the existing moodledata share could work (with a couple new subdirs), or if I need a fresh NFS export off my backend to handle shared temp files and shared cache.

Cheers,

Noveck

In reply to Noveck Gowandan

Re: Cache Settings in config.php - help

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

If you do not set these three, then the default to a folder inside moodledata (which is shared between nodes).

However, it is permitted to set localcachedir to a folder on the local server (not shared) which can make some things slightly faster.

The comment also implies that tempdir can also be not-shared, so I guess that is true. However, I am not 100% sure of that one.

You can put memcache on the web servers, but only if you use the clustering option. That means that writes get written to all web servers, but reads come from localhost. This also speeds things up.

Average of ratings: Useful (1)
In reply to Tim Hunt

Re: Cache Settings in config.php - help

by Noveck Gowandan -

Thanks Tim, this certainly clears things up - the fact that if not explicitly defined in the config.php that there is a default fallback on the moodledata. I won't interfere with these then - I'll just create a local cache on each webserver using the third config item!


Awesome!

In reply to Tim Hunt

Re: Cache Settings in config.php - help

by Andrew Lyons -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi Tim,

The tempdir must be shared. The comment and all related docs were changed to reflect this in about 2.9.

If you're aware of any places where this needs to be improved, please let me know.

Tempdir and cache are always shared. The previous advice that they did not need to be was wrong and was always wrong. Backup uses tempdir, as do several other areas involving multi-page temporary storage.

Andrew

Average of ratings: Useful (2)
In reply to Noveck Gowandan

Re: Cache Settings in config.php - help

by Nadav Kavalerchik -
Picture of Core developers Picture of Plugin developers Picture of Testers Picture of Translators

We are using "clustered" (Moodle managed) memcached on the local nodes, and found it to work fine with a few instances of Moodle on each node, but if you have too many instances... you will get too many (a few dozen K) cross connections from each Moodle instance to each of the other memcached on the other nodes, and at some point memcached hangs sad

We tried switching memcached to couchbase at some point, but it did not purge the caches so well. hoped Redis had a solution to this (master - master topology) but it does not, as far as I can understand.