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

Avoid unnecessary calling of accesslib_clear_all_caches caused by notification banners.

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Waiting for peer review
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.5.11, 3.6.9, 3.7.5, 3.8.2
    • Fix Version/s: None
    • Component/s: Messages, Performance
    • Labels:

      Description

      As a quite large moodle instance we were recently able to identify a problem - caused due to high load.

      Increased calls for rebuilding the roledefs-cache and selects for cacheflags caused performance problems.
      We could identify a big portion of the calls coming from lib/outputrenders.php $this->page->requires->js_call_amd('core/notification', 'init',...
      causing a call to validate_context($context) leading in conjunction with dirty contexts to accesslib_clear_all_caches().
      Disabling the call to load notification.js reduced our load from >90% to 50-60% in high load situations - database wise.

       

      Details:

      The concerning webservice core_fetch_notifications calls fetch_notifications() which checks for the current context.
      (Stacktrace.txt)

      We couldnt identify the need to check for the current context, since the notification-banners (MDL-30811) itself are not contextsensitive and would be shown at the next possible instance, as they are still saved in $SESSION.

      So our suggested fix to this would be to check for not the current but the systemcontext instead, to avoid capability checks on dirty contexts later (by validate_context), which will unnecessarily cause a purge of the private session based access cache ($ACCESSLIB_PRIVATE).

      Best regards
      Andreas Wagner, Tobias Garske

        Attachments

          Activity

            People

            Assignee:
            toga Tobias Garske
            Reporter:
            toga Tobias Garske
            Participants:
            Component watchers:
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón, Matteo Scaramuccia, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            4 Vote for this issue
            Watchers:
            7 Start watching this issue

              Dates

              Created:
              Updated: