Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-28961

Cache $CFG on disk



    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 2.0
    • Fix Version/s: None
    • Labels:
    • Environment:
      CentOS6, Apache 2, PHP 5.3.5, Oracle 10g
    • Database:
    • Affected Branches:


      When there is a big installation with many frontends and a single DBMS server (even if it is a cluster) the most critical factor we observed for the scalability of the system is the number of requests done (in reading mode) to the table

      {prefix}config: almost every page requires to include these information.

      So, based on the availability of a local filesystem area on each front-end (web server Apache), we developed a slight modification of the code to store in a local file the JSON representation of the actual configuration settings (the main modification is in the file lib/setuplib.php : lines 588-677 of attached code).

      The modification could be activate trough the usage of a subfield of the dboption property in the CFG object, created starting by the config.php file.

      The modification also includes a small change in a single file of admin directory (admin/settings.php : lines 39-44), in order to flush this cache when data is saved in the {prefix}


      Our modifications are based on the 2.0.1 versione of the code, but should be possible to apply it to almost all the version of Moodle available, as far as I have the possibility to check (maybe on 2.2 should be checked, I haven't done it, right now).

      We tested it with Oracle 10g, but maybe could laso help with other DBMS, and it seems to us it improves quite a lot the speed-up for page loading, even on a single server...

      Hope this could help, regards from the staff of eLab at USI/SUPSI - Switzerland http://www.elearninglab.org/


        1. config.php
          0.8 kB
        2. settings.php
          5 kB
        3. setuplib.php
          47 kB

          Issue Links



              moodle.com moodle.com
              mazzolal Luca Mazzola
              Component watchers:
              Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona), Matteo Scaramuccia, Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              1 Vote for this issue
              2 Start watching this issue