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

Moving many courses very quickly can make Moodle unusable on busy sites



    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.8.5
    • Fix Version/s: None
    • Component/s: Caching, Performance
    • Labels:
    • Affected Branches:


      We have a course archiving process that moves course that have finished running to an archive category (which restricts the ability of users to make changes to the courses) at the end of an academic year. This year it seems to have caused Moodle to become unusable while it was moving the courses, in previous years we have not noticed any slowdowns during the process.

      The scheduled task doing this was moving the courses in batches of 2500 every even hour, each batch was taking about 20 minutes.

      Looking at some of the slow traces we could see that there was a file lock in affect for over two minutes in most of them while the page was trying to get the category tree.

      My conclusion is that it is caused by the changes in MDL-67674, because we are moving so many courses so quickly I think that the cache entries are constantly being invalided and since only one user can now rebuild the cache entry it meant that most users where constantly waiting for the lock so that they could have their go at generating the entry that would then be almost immediately invalid again.

      The slowdowns lined up with when the task was scheduled to run:

      Memecache writes were rather high:

      A typical slow trace:

      My guess is that in pervious years we would have had more activity on our database when doing this as users would have been able to regenerate cache entries in parallel (and possibly even more writing to our cache server; but end users were less affected by that.


        1. memcache-profile.png
          42 kB
          Neill Magill
        2. periods-of-slowdown.png
          53 kB
          Neill Magill
        3. slowtrace-details.png
          97 kB
          Neill Magill
        4. slow-trace-summary.png
          64 kB
          Neill Magill

          Issue Links



              Unassigned Unassigned
              nmagill Neill Magill
              Component watchers:
              Matteo Scaramuccia, 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
              3 Start watching this issue