Moodle icon indicating copy to clipboard operation
Moodle copied to clipboard

Moodle config tuning related to file server (Gluster/NFS)

Open hosungsmsft opened this issue 6 years ago • 0 comments

It was pointed to us by a partner that our installed Moodle config might be improved for optimized performance in relation to the shared file server directory (/moodle on Gluster or NFS). It was also pointed that these are all available in the config-dist.php that's distributed with Moodle. Therefore, we should evaluate whether these are applicable to our architecture and incorporate anything that can improve performance. Here are the partner's verbatim:

First, here are the alternative configurations for getting session data off the gluster:

// Following settings may be used to select session driver, uncomment only one of the handlers.
//   Database session handler (not compatible with MyISAM):
//      $CFG->session_handler_class = '\core\session\database';
//      $CFG->session_database_acquire_lock_timeout = 120;
//   Redis session handler (requires redis server and redis extension):
//      $CFG->session_handler_class = '\core\session\redis';
//      $CFG->session_redis_host = '127.0.0.1';
//      $CFG->session_redis_port = 6379;  // Optional.
//      $CFG->session_redis_database = 0;  // Optional, default is db 0.
//      $CFG->session_redis_auth = ''; // Optional, default is don't set one.
//      $CFG->session_redis_prefix = ''; // Optional, default is don't set one.
//      $CFG->session_redis_acquire_lock_timeout = 120;
//      $CFG->session_redis_lock_expire = 7200;
//      Use the igbinary serializer instead of the php default one. Note that phpredis must be compiled with
//      igbinary support to make the setting to work. Also, if you change the serializer you have to flush the database!
//      $CFG->session_redis_serializer_use_igbinary = false; // Optional, default is PHP builtin serializer.

(Note from @hosungsmsft: We do configure redis as the session handler when redis is chosen, but we are not configuring database as the session handler when redis is not chosen. We should evaluate if database session handler is better when redis is not chosen and make it default in that case)

Next, at the very least the localcachedir should be somewhere fast and local - not on the gluster. I'm not sure whether you need to set the preventfilelocking flag.

// It is possible to specify different cache and temp directories, use local fast filesystem
// for normal web servers. Server clusters MUST use shared filesystem for cachedir!
//     $CFG->tempdir = '/var/www/moodle/temp';        // Directory MUST BE SHARED by all clsuter nodes.
//     $CFG->cachedir = '/var/www/moodle/cache';      // Directory MUST BE SHARED by all cluster nodes, locking required.
//     $CFG->localcachedir = '/var/local/cache';      // Intended for local node caching.
//
// Some filesystems such as NFS may not support file locking operations.
// Locking resolves race conditions and is strongly recommended for production servers.
//     $CFG->preventfilelocking = false;

(Note from @hosungsmsft: We should evaluate the localcachedir option in general and the preventfilelocking option for our NFS option)

I'm not sure about the impact of this next one but reading the description I would expect to use a local directory and not a gluster directory

// Moodle 2.4 introduced a new cache API.
// The cache API stores a configuration file within the Moodle data directory and
// uses that rather than the database in order to function in a stand-alone manner.
// Using altcacheconfigpath you can change the location where this config file is
// looked for.
// It can either be a directory in which to store the file, or the full path to the
// file if you want to take full control. Either way it must be writable by the
// webserver.
//
//     $CFG->altcacheconfigpath = '/var/www/shared/moodle.cache.config.php

(Note from @hosungsmsft: Not sure if this can be applied to our architecture. Need research)

hosungsmsft avatar May 16 '18 22:05 hosungsmsft