I want to validate a setup with Redis caching in combination with multiple webservers.
The goal is to keep page load times below 15 secs with 600 users running a quiz simultaneously which worked with memcached but we had to switch to Redis.
We have a setup with 4 webservers running Apache and PHP-FPM 7.0 running RHEL6 with a shared document root on NFS. In front of the webservers there is a F5 loadbalancer configured with sticky sessions.
On every webserver there is an independent Redis instance. Due to the fact that we have sticky sessions configured on the loadbalancer the client will have her/his session on the same webserver with access to the Redis cache.
The Moodle docs say this is OK for session caches but is this a valid setup to use as Application cache?
What are the errors we should look for if a shared application cache is not working like it should? Is there a simple way to test it?
We have had it running like this for a while but switched back to session-cache only after some performance (php-fpm timeout errors) issues that could be unrelated. Running a single shared Redis cache is not the question here - I know that should work.
Thanks for any help on this topic.
Some think it will work, others have doubts. I want to be sure. "Might work" is not convincing. Where and when will it go wrong?
Disadvantages of shared cache: single point of failure and adding nodes is more work. I think the replication features of Redis (Master-replica setup) could be the answer.
Still looking for a test scenario where using a not-completely-shared application cache will fail.
Still looking for a test scenario where using a not-completely-shared application cache will fail
Every time the (shared) cache content will be invalidated, Moodle will fail w/ unpredictable results due to stale data: in Moodle, each local cache has a timestamp-based - i.e. incremental - fingerprint which is "easy" to be invalidated by the whole set of nodes, regardless the node being the trigger for an invalidation; there are several use cases where such a mechanism cannot be applied i.e. an actual shared cache is required.
Replication is the right way to get rid of your SPoF.
Thanks everyone. So the answer to my question in this thread is definitively NO because Moodle needs SHARED caches for MOST of the application cache mappings.
"Unpredictable results" is a bad thing.
I did find there are some mapping in the application cache that CAN be mapped to local storage. A bit hard to find in the admin>plugins>configuration>known cache definitions. If you edit the coursemodinfo application cache mapping it says:
This cache can be safely mapped to a store that is local to each webserver
And there are some more that can be mapped to a local RAMDISK without problems. With slow NFS it is still faster that a (remote) redis cache.