File or Database Sessions?

File or Database Sessions?

بواسطة - Marcus Green
عدد الردود: 6
صورة Core developers صورة Particularly helpful Moodlers صورة Plugin developers صورة Testers
I am researching performance on a Moodle 2.5 instance that may be upgraded to 2.6
in the not too far future. We have web load balancers feeding two Debian/Apache servers
that use the Oracle OCFS clustered file system. We are using a mysql/innodb database on a
separate server. Could anyone advise on selecting between File or Database sessions.
The admin page option at

moodle/admin/settings.php?section=sessionhandling

Has a checkbox for
Use database for session information

The help next to it says
"...This is especially useful for large/busy sites or sites built on cluster of servers. "
Which I think describes our use

So I was thinking of switching to database sessions. However the documentation at
http://docs.moodle.org/27/en/sessions#Database

Says
"The performance is relatively low, it is not recommended for large sites."

Can anyone advise?

متوسط التقييمات:Useful (1)
رداً على Marcus Green

Re: File or Database Sessions?

بواسطة - Howard Miller
صورة Core developers صورة Documentation writers صورة Particularly helpful Moodlers صورة Peer reviewers صورة Plugin developers

You almost certainly can't use file-based sessions if you are load-balancing. They need to be located in a shared-file area and the chances are that this will be far too slow (if NFS for example). 

You also shouldn't use the database on a very busy site (almost certainly you) as it can bung up the database quite easily with the high levels of activity.

If you search down config-dist.php a bit further, you will see that you can set up sessions on memcache/memcached. This is the way forward. 

A word of warning, if you are using memcache/memcached in the MUC then you will need to set up another instance for sessions. If you don't, purging the MUC caches will also throw out all your users. 

See... http://docs.moodle.org/26/en/Session_handling#Session_drivers

رداً على Howard Miller

Re: File or Database Sessions?

بواسطة - Marcus Green
صورة Core developers صورة Particularly helpful Moodlers صورة Plugin developers صورة Testers

It looks like we are using file based sessions and they are on a shared area done through OCFS. Is there a way of getting a metric on the creation and access of sessions, i.e. to compare what happens at the moment with what would happen if it were on non shared disk space.

رداً على Marcus Green

Re: File or Database Sessions?

بواسطة - Jeff White
Recommend checking out moodle-performance-comparison tool. 


What do you mean by non shared disk space? If you are using a cluster then all the apache nodes need their session files on a shared location otherwise each time a user's request jumps to a different apache node they will have to log in again. 

رداً على Howard Miller

Re: File or Database Sessions?

بواسطة - Luis de Vasconcelos
صورة Particularly helpful Moodlers

Thanks Howard,

So memcache/memcached seems to be the only way to go for big Moodle sites. But does memcache/ memcached run well on Windows Server OS? Is it a viable way to do session management on Windows*?

I've got a test server running Memcached, but working out what Memcached is doing, how it's doing it and if it's doing it well is another story!

* Ok some may argue that nothing runs well on Windows, but lets not go there...

رداً على Luis de Vasconcelos

Re: File or Database Sessions?

بواسطة - Mark Picker


Hi Luis,

How did you go with setting up Memcached on Windows? I was looking at this a couple of months ago and kept hitting issues and could only use memcache not memcached.

Out of interest are you running on Windows 2012 or something earlier? We recently went from 2008 to 2012 and are having a lot of performance issues (which is why I was looking at the caching solutions).

Cheers
Mark