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

The admin /admin/search.php page is slow due to analytics + classloading size

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      1) Install some heavy plugins which add massive amounts of classes to the auto class loading list, eg tool_objectfs + local_aws

      2) Visit the admin search page, note the page performance is much slower. Do a ?PROFILEME to see the bottleneck

      3) Apply patch, re-test

       

      Show
      1) Install some heavy plugins which add massive amounts of classes to the auto class loading list, eg tool_objectfs + local_aws 2) Visit the admin search page, note the page performance is much slower. Do a ?PROFILEME to see the bottleneck 3) Apply patch, re-test  
    • Affected Branches:
      MOODLE_35_STABLE
    • Fixed Branches:
      MOODLE_37_STABLE
    • Pull Master Branch:
      MDL-64284-36_get_component_classes_cache

      Description

      The admin page has become noticeably slower on big sites which have many plugins installed, especially plugins that have large numbers of autoloaded classes (eg the local_aws which pulls in a ton of libraries)

      Some profiling points towards the core_component::get_component_classes_in_namespace being either slow or just called too much (eg on my dev box it is called 505 times, and takes 1.5 seconds wall clock time).

      But I think the root cause is actually the core_analytics\manager::get_analytics_classes which hammers this repeatedly with very similar calls searching for similar classes eg 'time_splitting'. Each time it is searching the entire list of classes. If I temp comment out the analytics code then the admin search is 1.5 seconds or 3x times faster.

      I'm thinking a way to speed is up is here:

      https://github.com/moodle/moodle/blob/master/analytics/classes/manager.php#L613

      Search for just all 'analytics' classes, statically caching that much smaller list, and then search that for the $element class.

       

       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                tom_d Tom Dickman
                Reporter:
                brendanheywood Brendan Heywood
                Peer reviewer:
                David Monllaó
                Integrator:
                Eloy Lafuente (stronk7)
                Tester:
                Eloy Lafuente (stronk7)
                Participants:
                Component watchers:
                Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Elizabeth Dalton, Matteo Scaramuccia
              • Votes:
                3 Vote for this issue
                Watchers:
                10 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  20/May/19

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 35 minutes
                  35m