General developer forum

 
 
Picture of Javier Baca
Problem with cache (Moodle 2.1)
 

We have a recurring problem related the the moodle caching system.

All works well for days, possbly up to two weeks. But at some point IE starts complaining about html errors. Usually these errors appear in javascript dependent features such as the rich text editor, collapsable menus, etc. I suspect that the cached data is not delivered to the browser in the way it is expected which causes the errors. Sometime certain browsers work (Chrome) while others don't (IE).

We can fix the problem by purging all caches. However, the problem eventually returns.

 

Here is our Moodle environment:

1 backend server running Mysql

3 Frontend servers running Apache 2.2.21 (FreeBSD)

The frontend servers mount the moodledata directory as an nfs mount.

1 Hardware load balancer which balances on least connections and maintains the host/server table for one day at a time.

 

Does anyone have any insight into how this can be resolved? One solution, although not ideal, would be to disable caching altogether but i have not been able to identify how that can be done, if possible.

 

Thanks in advance.

 

 

 
Average of ratings: -
Picture of Danny Wahl
Re: Problem with cache (Moodle 2.1)
Group DevelopersGroup Particularly helpful Moodlers

You haven't really said what your caching setup is, so it's hard to make a suggestion for revision.

Moodle doesn't recommend that you use conf level caching (e.g. expiresbytype) but instead you let the application level handle the caching (opcode, Moodle, etc...)

 
Average of ratings: -
Picture of Javier Baca
Re: Problem with cache (Moodle 2.1)
 

I have not made any specific changes to the caching setup. This is a clean Moodle install of 2.1.3 stable, identical on all three front-end servers. However, the same problem occured with 2.1.2.

I dont follow your question but does it imply there is a configuration change I can make to specify a certain caching setup? That is where I was going with my original question i.e. where can I adjust the caching system to address the problems we are having?

 
Average of ratings: -
Anne Krijger
Re: Problem with cache (Moodle 2.1)
Group Particularly helpful Moodlers

Hi Javier,

Do I undestand correctly that you have 3 instances (copies) of Moodle running,
all of which not only use the same Db but also
share the same moodle-data directory ($CFG->dataroot)?

Anne.

 
Average of ratings: -
Picture of Javier Baca
Re: Problem with cache (Moodle 2.1)
 

Hello Anne.

Yes, your understanding is correct. 3 identical instances in identical environments (memory, PHP, apache, only config.php differ obviously).

All three share the same moodledata directory. The moodledata directory is shared via NFS and mounted in the front-end servers so all share the idential moodledata.

So I have a load balanced webfarm behind a hardware load balancer. I have not configured the setting in Moodle to save session data to the database, so it is saved to disk on the particular front-end the client is connected to. I rely on the "sticky source IP" setting of my load balancer to maintain the client/server connection for 10 hours at a time. So any client connection will be maintained to the same front-end server for the entire day. That relationship expires after 10 hours and you have a 1/3 change of being sent to the same server after 10 hours of non connectivity.

 

Hope this helps. Thanks.

 
Average of ratings: -
Anne Krijger
Re: Problem with cache (Moodle 2.1)
Group Particularly helpful Moodlers

Hi Javier,

Not sure if still needed, but.

Sounds like you have (at least) 3 threads all accessing the same files in the same (cache) directory without anythread safety.

Not sure what gets purged when you clear the cache, but assuming this is only the cache directory, you could change you setup to where the 3 instances each points to a seperate datadirectory and in thos directories use symbolic links for all directories except the cache directory. This way you can share all but the cache directories for the instances.

Just a thought,

Anne.

 
Average of ratings: -
Picture of Javier Baca
Re: Problem with cache (Moodle 2.1)
 

One thing I forgot to include when describing the Moodle environment is that all of the apache servers are running the PHP accelerator APC.

Whatever is causing these cache problems is occuring more frequent and requiring the "purge all caches" now multiple times daily. Its bring usability down significantly.

 

Any thoughts? Thanks again in advance.

 
Average of ratings: -