Hardware and performance

Moodle 2.6 amb Memcached for sessions

 
 
Picture of Antonio Piedras
Moodle 2.6 amb Memcached for sessions
 
Hi,
we are implementing memcached servers for sessions.
But i don't know if moodle store the session in all memcached servers or only in one, if when this crashes, uses the other for storage data session.
During testing with two memcached servers i have seen that when only one memcached server crash the user lost it's session and is mandatory login again.
Is that way correct?

Thanks in advance

 
Average of ratings: -
Picture of jason everling
Re: Moodle 2.6 amb Memcached for sessions
Group Particularly helpful Moodlers

If you want that scenario to happen, meaning the session is still valid on failure, You would either need to use the plugin,

https://moodle.org/plugins/view.php?plugin=cachestore_memcachedcluster

Or use Couchbase , http://www.couchbase.com/ for a replicated high availability memcache/d cluster. The only thing with Couchbase is that Moodle will throw a warning when trying to "flush all" because Couchbase by default has that function disabled. You would have to manually login to the Couchbase web app and flush the bucket so that it does it consistently throughout the cluster.

JASON

 
Average of ratings:Useful (1)
Picture of Antonio Piedras
Re: Moodle 2.6 amb Memcached for sessions
 

Thanks for the useful info big grin

 
Average of ratings: -
Picture of srikanth raju
Re: Moodle 2.6 amb Memcached for sessions
 

Hi Antonio,

    I am also trying to store the sessdata in memcache but i don't have idea how to enable this particuler table or field of database table. How did you implemented memcache for storing sessions in moodle(it means what are the files or functions do we need to change in source code of moodle )  ? can you give me any related links or give me procedure how to do ?

Thanks

 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: Moodle 2.6 amb Memcached for sessions
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

Please be very, very careful if you are using memcache for sessions. There is this bug: MDL-45375

Well, it is not really a bug, more a limitation of the memcache API. However, the up-shot is that if you are storing sessions in a particular memcache store, then you must not store any MUC caches in the same memcache store.

If you do, then any time that Moodle purges any memcache cache, every user will lose their session. And, it seems that Moodle does purge various caches in various places from time-to-time.

They are working on a warning for the admin notifications screen: MDL-45724.

Also, because of this bug, I just switched on server back from memcache sessions to DB sessions. Before doing that, I did a quick load-test, and I was surprised to find how similar the performance was between memcache sessions and DB sessions. Now this was on a very well-tuned Postgres database, but still food for thought.

(All the OU's busy sites are still on memcache sessions. In terms of Moodle scalability, the database is a single bottle-neck that is hard to scale. Hence, on a large a busy site, it does make sense to get the session storage off the DB server. However, if you are moving it to memcache storage, it must be a separate set of memcache storage, not shared with your caches.)

 
Average of ratings:Useful (1)
Picture of srikanth raju
Re: Moodle 2.6 amb Memcached for sessions
 
Thanks Tim for your valuable information.

  I am able to enable memcache successfully but i am not able to store memcache and other caches separately. If you have any idea for storing caches separately,  please tell me 
how to do ?

 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: Moodle 2.6 amb Memcached for sessions
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

You need two instances of memcache running, e.g. on different servers or different ports.

 
Average of ratings: -
Picture of srikanth raju
Re: Moodle 2.6 amb Memcached for sessions
 

Thank you Tim for your valuable information. 

      I created two different ports but now it is not created any logs in memcached.log. memcached enable 

Later, i came to know that data is not storing in memcache as shown above fig contains store value of memcache is 0.  I installed memcached, php5-memcached, php5-memcache and i created two different ports with changing configuration files of memcached then also it is not storing any data in memcache.

where am i doing wrong ? please let me know


 
Average of ratings: -
Sketch...
Re: Moodle 2.6 amb Memcached for sessions
Group Particularly helpful Moodlers

Does this bug also affect Memcached, or just Memcache?

 
Average of ratings: -
Picture of David Aylmer
Re: Moodle 2.6 amb Memcached for sessions
Group Particularly helpful Moodlers

http://docs.moodle.org/27/en/Caching#Memcache

http://docs.moodle.org/27/en/Caching#Memcached


(I'm thinking it affects both - as the implementation warning is included in both sections)

 
Average of ratings: -