-
Bug
-
Resolution: Fixed
-
Major
-
2.6.3, 2.7.1, 2.8
-
MOODLE_26_STABLE, MOODLE_27_STABLE, MOODLE_28_STABLE
-
MOODLE_26_STABLE, MOODLE_27_STABLE
-
wip_
MDL-46552_m28_memcached -
In Moodle 2.5 and previous, Moodlerooms had a custom patch to support memcached sessions. Session storage capped out at a few hundred megabytes per memcache node. In Moodle 2.6 (and later), we are using the default Core behavior. We are now seeing a dramatic increase of our session storage - roughly 10-20x that usage.
Moodle has the following snippet of code around session timeouts:
// Moodle does normal session timeouts, this is for leftovers only.
|
ini_set('session.gc_probability', 1);
|
ini_set('session.gc_divisor', 1000);
|
ini_set('session.gc_maxlifetime', 60*60*24*4);
|
This requires your session backend to be dozens of times larger than it needs to be for memcached, based on $CFG->sessiontimeout. For example, if sessiontimeout is set to the default of 2 hours and a user happens to login consistently just after 2 hours, the user will be timed out correctly but there will be orphaned sessions collecting for 4 days, requiring about 48x more session storage than we actually need. This likely explains the huge increase in session storage.
In MR's previous memcache patch, gc_maxlifetime was actually set to $CFG->sessiontimeout. This makes sense as garbage collection for the session should happen automatically on the memcache server based on the key's TTL, which is set to the same as gc_maxlifetime. However it may not make sense for other session drivers (file, database). It would probably make sense for gc_maxlifetime to be set based on the session driver.
- has a non-specific relationship to
-
MDL-31501 New session infrastructure - file, database and memcached storage
- Closed
-
MDL-46561 \core\session\manager::session_exists() does not check sessions table
- Closed
- has been marked as being related by
-
MDL-46711 memcache session driver does not seem to support multiple servers
- Closed