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

Repopulating coursecat cache is expensive for lots of categories

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.1.4, 3.2.1, 3.3
    • Fix Version/s: 3.1.6, 3.2.3
    • Component/s: Caching
    • Labels:
    • Testing Instructions:
      Hide

      Please setup your coursecat cache to use redis

      This changes how the coursecat tree cache gets populated. So make some changes to categories (add/delete/move them).

      Verify that the categories appear in the correct order in the course management screen.

      If you enable perfdebug mode so that you can see the number of cache hits/misses/sets at the bottom of the page you can verify that:

      • in a moodle with 10 categories and without this patch, moving one of those will result in ~20 SETs to the coursecat cache
      • in the same moodle, but with this patch, moving one of those will result in ~1 SET to the coursecat cache
      Show
      Please setup your coursecat cache to use redis This changes how the coursecat tree cache gets populated. So make some changes to categories (add/delete/move them). Verify that the categories appear in the correct order in the course management screen. If you enable perfdebug mode so that you can see the number of cache hits/misses/sets at the bottom of the page you can verify that: in a moodle with 10 categories and without this patch, moving one of those will result in ~20 SETs to the coursecat cache in the same moodle, but with this patch, moving one of those will result in ~1 SET to the coursecat cache
    • Affected Branches:
      MOODLE_31_STABLE, MOODLE_32_STABLE, MOODLE_33_STABLE
    • Fixed Branches:
      MOODLE_31_STABLE, MOODLE_32_STABLE
    • Pull from Repository:
    • Pull 3.1 Branch:
    • Pull Master Branch:

      Description

      When the course category cache needs to be repopulated, two entries are added to the cache for each category. In core this is currently done in a for-loop, resulting in N set calls to the cache (where N is twice the number of categories in Moodle).

      For sites with a lot of categories, this can quickly add up to a large amount of cache set's whenever the coursecat cache is invalidated.

        Attachments

          Activity

            People

            • Assignee:
              aolley Adam Olley
              Reporter:
              aolley Adam Olley
              Peer reviewer:
              Marina Glancy
              Integrator:
              Dan Poltawski
              Tester:
              Ryan Wyllie
              Participants:
              Component watchers:
              Matteo Scaramuccia, David Monllaó, Víctor Déniz Falcón
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                8/May/17