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

course overview block performance

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Requires an advanced level of knowledge to test.

      Requires a site that contains a large number of discussion posts from a large number of different courses and a user that is enrolled in many of these courses. Be careful with auto-populating data script based sites as these sites may list courses/discussion posts in a sequential order but real-life discussions will have non-sequential discussion->ids.

      For a user with a large number of enrolments in courses where there are lots of discussion posts from other people, view the course overview block with the performance stats turned on. Before the patch you will see the page load really slowly with a large number of sql queries. Hopefully after the patch you will see a big improvement in the number of queries used to build the page.

      Show
      Requires an advanced level of knowledge to test. Requires a site that contains a large number of discussion posts from a large number of different courses and a user that is enrolled in many of these courses. Be careful with auto-populating data script based sites as these sites may list courses/discussion posts in a sequential order but real-life discussions will have non-sequential discussion->ids. For a user with a large number of enrolments in courses where there are lots of discussion posts from other people, view the course overview block with the performance stats turned on. Before the patch you will see the page load really slowly with a large number of sql queries. Hopefully after the patch you will see a big improvement in the number of queries used to build the page.
    • Affected Branches:
      MOODLE_26_STABLE, MOODLE_27_STABLE
    • Fixed Branches:
      MOODLE_26_STABLE, MOODLE_27_STABLE
    • Pull Master Branch:
      master_MDL-47316

      Description

      The patch to MDL-31089 causes a crazy number of sql queries to run if there are a large number of enrolled courses that contain forums with a large number of discussions. I saw one page (that eventually loaded) with over 60000 SQL queries used to build the page.

      I think it's due to the use of:
      $instances = get_fast_modinfo($discussion->course)->get_instances();

      we have some users with over 200 course enrolments (mutliple clients use Moodle in this way) - so when they view the my moodle page it goes through each course, then obtains all discussions and does a get_fast_modinfo() on each causing a blow out to a crazy number of sql queries. usually this would be cached but as the modinfo is called sooo many times for each course (on every single discussion) it just can't cope.

      Hopefully there is a more efficient method to check this.

      1. Insert a vast amount of data (see attached script)
      2. Login as a user with access to many courses which have many forum discussions from many users in a non-sequential manner
      3. View the /my page
      4. Click to view all courses
      5. Note DB read/writes
        • Compare without this patch to ensure that performance is better with this patch

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                6 Vote for this issue
                Watchers:
                14 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  10/Nov/14