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

Calendar slow performance loading contexts with large number of courses

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Deferred
    • 3.4
    • None
    • Calendar

    Description

      From dmonllao:
      DavidMonllao, [Oct 10, 2017 at 10:42:06 PM]
      ...have you noticed any performance issue being logged as admin in a course with the calendar block in screen?

      I've loaded a real site database (around 5000 courses) and it takes me more than 1 minute to load moodle index

      more info: it needs like 300.000 db queries to load the page; I am logged as admin and there is a calendar block in the frontpage; I've tried to track wtf is going on and I've seen that most queries are "SELECT * FROM mdl_context WHERE contextlevel = ? AND instanceid = ?"; debugging a bit more it seems that the problem comes from calendar_get_view and month_exporter, week_exporter and day_exporter; you can see the trace in https://pastebin.com/xkqzxANa

      the sql dump I've used is https://drive.google.com/drive/u/1/folders/0B0DMrAQRleD4YnhfdXNFdm41dzA

      I've just deleted calendar_month record from mdl_block_instances and the frontpage loads instantly (I couldn't do it using the web UI)

      Attachments

        1. 0_no_changes.png
          0_no_changes.png
          111 kB
        2. 1_event_collection_changes.png
          1_event_collection_changes.png
          100 kB
        3. 10_remove_duplicate_course_name_format.png
          10_remove_duplicate_course_name_format.png
          88 kB
        4. 11_async_load_3_month_block.png
          11_async_load_3_month_block.png
          89 kB
        5. 2_related_course_in_exporter.png
          2_related_course_in_exporter.png
          88 kB
        6. 3_duplicate_course_export.png
          3_duplicate_course_export.png
          98 kB
        7. 4_later_enrolment_check.png
          4_later_enrolment_check.png
          91 kB
        8. 5_batch_load_groups.png
          5_batch_load_groups.png
          91 kB
        9. 6_remove_duplicate_events_export.png
          6_remove_duplicate_events_export.png
          89 kB
        10. 7_related_cache_for_module_instances.png
          7_related_cache_for_module_instances.png
          88 kB
        11. 8_lazy_load_calendar_contexts.png
          8_lazy_load_calendar_contexts.png
          89 kB
        12. 9_pass_contexts_to_external_format.png
          9_pass_contexts_to_external_format.png
          92 kB
        13. admin_after.png
          admin_after.png
          91 kB
        14. admin_before.png
          admin_before.png
          99 kB

        Issue Links

          Activity

            People

              ryanwyllie Ryan Wyllie
              ryanwyllie Ryan Wyllie
              Votes:
              2 Vote for this issue
              Watchers:
              13 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: