Moodle
  1. Moodle
  2. MDL-22478

Provide option to pre-compile language cache and store in configurable location

    Details

    • Database:
      Any
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE
    • Rank:
      6023

      Description

      Storing language strings (heavily included PHP code) cached in the Moodle data directory can adversely affect performance when the Moodle data directory resides on an NFS share.

      For users with this configuration it would be good to be able to pre-compile the language cache so it can be pushed out to each webserver node with the Moodle src.

      See chat log for more info.

      1. chat.log
        1 kB
        Matt Clarkson

        Activity

        Hide
        Tim Hunt added a comment -

        Actually, no need to pre-compile necessarily.

        You just need to be able to specify a $CFG->cachedir, which defaults to $CFG->dataroot . '/cache' if not otherwise set.

        And the code needs to work if you have several web servers, and $CFG->cachedir is set to somewhere on local disc for each one. If the cache files are populated the first time they are needed in some deterministic way, then that is all you need to do.

        The only difficult bit is when you want to clear the cache. Then you need to clear the cache folder on each server.

        Show
        Tim Hunt added a comment - Actually, no need to pre-compile necessarily. You just need to be able to specify a $CFG->cachedir, which defaults to $CFG->dataroot . '/cache' if not otherwise set. And the code needs to work if you have several web servers, and $CFG->cachedir is set to somewhere on local disc for each one. If the cache files are populated the first time they are needed in some deterministic way, then that is all you need to do. The only difficult bit is when you want to clear the cache. Then you need to clear the cache folder on each server.
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Sending this to stable backlog, with fixed components.

        David, does this need to be documented or so, or is it already? (config-dist, docs...)

        Feel free to close if not further action is needed... TIA and ciao

        Show
        Eloy Lafuente (stronk7) added a comment - Sending this to stable backlog, with fixed components. David, does this need to be documented or so, or is it already? (config-dist, docs...) Feel free to close if not further action is needed... TIA and ciao
        Hide
        Martin Dougiamas added a comment -

        David are you able to work on this?

        Show
        Martin Dougiamas added a comment - David are you able to work on this?
        Hide
        David Mudrak added a comment -

        Patch submitted for integration. See the information about $CFG->langcacheroot in config-dist.php.

        There is no way to pre-compile the cache as it gets populated automatically on the fly.

        Side note: we should consider general solution to specify alternative location of the whole $CFG->dataroot/cache/ maybe so that other caches (htmlpurifier and theme) are not in the shared moodledata, if possible. However, some caches may rely on being synced so probably approach like this (that is alternative location per each cache type) is better.

        Show
        David Mudrak added a comment - Patch submitted for integration. See the information about $CFG->langcacheroot in config-dist.php. There is no way to pre-compile the cache as it gets populated automatically on the fly. Side note: we should consider general solution to specify alternative location of the whole $CFG->dataroot/cache/ maybe so that other caches (htmlpurifier and theme) are not in the shared moodledata, if possible. However, some caches may rely on being synced so probably approach like this (that is alternative location per each cache type) is better.
        Hide
        Eloy Lafuente (stronk7) added a comment -

        +1 for alternative location per cache type, yup.

        Show
        Eloy Lafuente (stronk7) added a comment - +1 for alternative location per cache type, yup.
        Hide
        Helen Foster added a comment -

        Matt, thanks for your report and David, thanks for fixing.

        Show
        Helen Foster added a comment - Matt, thanks for your report and David, thanks for fixing.

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: