File vs Database for Sessions, moodle 3.3

File vs Database for Sessions, moodle 3.3

by Paul Lindgreen -
Number of replies: 6
Picture of Particularly helpful Moodlers

The default session is stored to disk

The following forum post suggest not using databases for busy site https://moodle.org/mod/forum/discuss.php?d=264600 My site has 5000 users and 300-500 logged on at any given time, would that be considered a busy site that should use file based session instead of our current database (mysql)?

I believe memcached is the preferred method for handling the sessions but I havent pursued it and wasnt certain how good windows 2008/2012 support was on this.

I was revisiting this as our test environment doesnt appear as fast as expected after a php 5.6->7.1 and moodle 3.1->3.3 upgrade, jmeter test show logging in and out among the slower processes. I like the fact sessions are preserved during web server IIS resets as our database is on another server, cant think of any other benefits though?

==

environment windows 2008/iis7.5/moodle3.3/mysql/php7.1

Average of ratings: -
In reply to Paul Lindgreen

Re: File vs Database for Sessions, moodle 3.3

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

If you are asking.... setup a proper cache for sessions (Redis is probably the best idea). 

File sessions are fine. Database sessions will give you all sorts of problems on a large site. It really burns up database resources.

Average of ratings: Useful (1)
In reply to Howard Miller

Re: File vs Database for Sessions, moodle 3.3

by Matteo Scaramuccia -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hello Everyone,

File sessions are fine

That's actually true but in a single web server deploy: when you need to horizontally scale the web traffic w/ a load balancer it will also depend on the type of the file system being shared among the web nodes i.e. probably better to use Redis.

HTH,
Matteo

Average of ratings: Useful (5)
In reply to Matteo Scaramuccia

Re: File vs Database for Sessions, moodle 3.3

by Chris Fryer -

+1 for Redis. We had great confidence in Memcached for Moodle 3.1 in PHP 5, but since PHP 7 and MDL-57477, that confidence has completely evaporated.

Average of ratings: Useful (2)
In reply to Howard Miller

Re: File vs Database for Sessions, moodle 3.3

by Paul Lindgreen -
Picture of Particularly helpful Moodlers
thanks Ill switch from DB to File for sessions and look into Redis for WIndows.
In reply to Paul Lindgreen

Re: File vs Database for Sessions, moodle 3.3

by Albert Ramsbottom -

Is this a load balanced, clustered set up or is it a single server? If it is multi-node then it will need to be clustered anyway, regardless of file or DB sessions ( I think smile

Interesting about file sessions and Redis, as I have been away for 18 months. Another post of that do not want to hijack a thread


Albert

In reply to Albert Ramsbottom

Re: File vs Database for Sessions, moodle 3.3

by Paul Lindgreen -
Picture of Particularly helpful Moodlers

single server, Windows 2008. about to upgrade to new server windows 2012

...looked into Redis for Windows, doesn't look promising, not fully supported.