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

Course overview block courselimit > MAX_MODINFO_CACHE_SIZE and causes frequent partial resets of the get_fast_modinfo cache

XMLWordPrintable

    • MOODLE_21_STABLE, MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE
    • MOODLE_24_STABLE, MOODLE_25_STABLE
    • wip-MDL-34785-master
    • Hide

      Add

      define('MAX_MODINFO_CACHE_SIZE', 21);
      

      in config.php

      Show
      Add define('MAX_MODINFO_CACHE_SIZE', 21); in config.php
    • Hide
      1. Create a course with several modules in it, such as assignments, forums, quizzes, chat, lesson
      2. Enrol student and make sure that student's /my/ page shows activities requiring attention.
      3. Duplicate the course or create several similar ones. Should be at least 5 courses but the more the better.
      4. Add in your config.php
        define('MAX_MODINFO_CACHE_SIZE', 10);
      5. Repeat this step 3 times by setting the value to more than, equal to and less than half the number of courses on student's /my/ page, make sure the content of the page is not changing. Copy and save the page performance information.
      6. Revert the patch and compare the performance information with the previously saved results (with the same MAX_MODINFO_CACHE_SIZE setting)
      Show
      Create a course with several modules in it, such as assignments, forums, quizzes, chat, lesson Enrol student and make sure that student's /my/ page shows activities requiring attention. Duplicate the course or create several similar ones. Should be at least 5 courses but the more the better. Add in your config.php define('MAX_MODINFO_CACHE_SIZE', 10); Repeat this step 3 times by setting the value to more than, equal to and less than half the number of courses on student's /my/ page, make sure the content of the page is not changing. Copy and save the page performance information. Revert the patch and compare the performance information with the previously saved results (with the same MAX_MODINFO_CACHE_SIZE setting)

      The course overview block used frequently on the /my page has a default $courseslimit of 21 which means that it will show up to 21 courses on the /my page at a time.

      The way in which this works means that get_fast_modinfo is called several times for each course (foreach module; foreach course), however, get_fast_modinfo tries to ensure that it doesn't run away with RAM and after MAX_MODINFO_CACHE_SIZE courses are found, it starts to remove entries.

      The default value for MAX_MODINFO_CACHE_SIZE is 10, which means that if a user is enrolled on > 9 courses (+ the site itself), then the get_fast_modinfo cache is partially reset frequently, and on the next iteration, the data has to be re-requested massively reducing performance.

      We should either:

      • increase MAX_MODINFO_CACHE_SIZE; or
      • decrease $courseslimit

        1. master_2_wo_patch.png
          48 kB
          Mark Nelson
        2. master_2.png
          49 kB
          Mark Nelson
        3. master_20_wo_patch.png
          48 kB
          Mark Nelson
        4. master_20.png
          49 kB
          Mark Nelson
        5. master_5_wo_patch.png
          48 kB
          Mark Nelson
        6. master_5.png
          49 kB
          Mark Nelson

            marina Marina Glancy
            dobedobedoh Andrew Lyons
            Sam Hemelryk Sam Hemelryk
            Mark Nelson Mark Nelson
            Votes:
            7 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.