Support for storing sessions in memcache/redis

Bug #785469 reported by François Marier on 2011-05-20
22
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Mahara
Wishlist
Son Nguyen

Bug Description

On a busy cluster, storing sessions on an NFS mount creates lot of contention on the locks.

A better solution would be to store sessions in memcache or redis.

tags: added: scalability
Changed in mahara:
assignee: nobody → Christopher Tombleson (christopher-k)
Changed in mahara:
milestone: none → 1.7.0
assignee: Christopher Tombleson (christopher-k) → nobody
Aaron Wells (u-aaronw) wrote :

Here's a partial implementation of memcache sessions by Darrin at Catalyst Australia. This is just the session.php code switched to use memcache instead of file; a full implementation will require an admin interface (or at least a $cfg variable) to let the user switch between them.

Aaron Wells (u-aaronw) wrote :

Actually, yeah, a $cfg variable would probably be more appropriate for this than an admin screen. Especially since, if you change your session handler, your session is immediately killed and you're force-logged out.

Aaron Wells (u-aaronw) on 2013-04-19
Changed in mahara:
milestone: 1.7.0 → 1.8.0
importance: Wishlist → Medium
Aaron Wells (u-aaronw) on 2013-09-30
Changed in mahara:
milestone: 1.8rc1 → 1.8.0
Aaron Wells (u-aaronw) on 2013-10-03
Changed in mahara:
milestone: 1.8.0 → 1.9.0
Aaron Wells (u-aaronw) wrote :

Here's a branch on my personal gitorious repo that has this implementation: https://gitorious.org/mahara/agwells-mahara/source/79bda3f3d2da7b9b45333bf1d449eff5f94059d5:

That's 1.8_STABLE, with the initial memcache patch and a further commit that fixes a bug with session.gc_maxlifetime in that initial patch. We've been using these two patches on several production sites for the past couple of months without any problems.

As mentioned above, what we need in order to be able to upstream this, is a $cfg variable to allow the site admin to specify whether to use standard filesystem sessions, or memcache. Ideally, this would be a pluggable system to allow for further session types to be implemented, but at the minimum it'd be fine to just have it hard-coded to memcache or filesystem.

Son Nguyen (ngson2000) wrote :

Hi Aaron;
Yes, It would be good to have session plugins. +1 for this

Aaron Wells (u-aaronw) on 2014-04-15
Changed in mahara:
milestone: 1.9.0 → 1.10.0
Changed in mahara:
milestone: 1.10.0 → none
importance: Medium → Wishlist
Aaron Wells (u-aaronw) wrote :

I've moved the "official" source of this patch to the Catalyst Github account. There are branches ending in "-memcache" for each Mahara version I've needed to port it to so far: https://github.com/catalyst/mahara/tree/mh1504-memcache

Son Nguyen (ngson2000) on 2015-09-27
Changed in mahara:
assignee: nobody → Son Nguyen (ngson2000)

Reviewed: https://reviews.mahara.org/5378
Committed: https://git.mahara.org/mahara/mahara/commit/bbd333b7a68cc727041762f5362612220caeaa19
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit bbd333b7a68cc727041762f5362612220caeaa19
Author: Robert Lyon <email address hidden>
Date: Fri Dec 23 11:36:07 2016 +1300

Bug 785469: Add support for memcached session save handler

Introduce new global setting:
$cfg->sessionhandler

behatnotneeded

Change-Id: I386c94c4d1ab06fbde110c705789f9dcfaaead67
Signed-off-by: Robert Lyon <email address hidden>

Robert Lyon (robertl-9) on 2017-11-20
Changed in mahara:
status: Triaged → Fix Committed
milestone: none → 18.04.0
tags: added: nominatedfeature

For Redis see bug #1747297

Robert Lyon (robertl-9) on 2018-04-05
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers