We are using Moodle 2.6.4+ containing about 3200 course categories in one single instance and Moodle File cache.
For profiling reasons we've installed XHProf.
- login as user with course categories editing rights
- go to a editable course category
- click on "Edit this category"
- do any changes and click on "Save changes"
- There are several caching frameworks
- File cache
- memcache (We can't use this in our environment)
- memcaches (We also can't use this in our environment)
- There are several caching scopes
- There is a course categories tree cache (in the application cache)
- The coursecattree is needed for building the navigation e.g. on the "Course and category management" page
- There are several invalidation-events that trigger the purging of the cache
- There is an event called "changesincoursecat" that is purging the whole application cache
When editing a course category the coursecattree-cache will be purged and the user is forwarded to the "Course and category management" page, where parts of the coursecattree-cache are needed. Because of the reason that the coursecattree-cache is invalid at this moment the tree has to be rebuilt. On a local environment this step takes about 15 seconds. At this step about 6000 cache-files are written (2.5 ms per file).
The coursecattree-cache is an application cache. During the regeneration of this application cache, the cache is locked for other users until the cache is generated. This leads to long waiting times. The productive environment shows waiting times up to 2 minutes.
We checked the problem with a small Moodle installation and counldn't reproduce the problem. Therefore the problem must be in coincidence with the large number of course categories.
We also tested with Moodle 2.6.5+ and 2.7.2+. Same problems.
- course/management.php with purged cache >> 2014-11-05_withPurgedCache.mpr
- course/management.php with caching >> 2014-11-05_withCaching.mpr
As you can see the Call Graph with purged Cache shows a total time of 25838.202 ms where writing the files consumes 12607.197 ms (= 5940 files (= 2 x 2970 course categories)).
We already had a look at some related Moodle issues. No success...
Hopefully someone can help.