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

groups_get_all_groups($withusers=true) uses much memory e.g. on course participants page

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. Create a Course and annotate its course id.
      2. Create 10 groups with long group name (Ex: BA/BSc (Hons) Open degree (QD) qualification, ...) and annotate their group ids.
      3. Install the attached generate_user.php @ admin/cli.
      4. Invoke the script like this, ten times, using the annotated course id with a different group id on each execution.

        php admin/cli/generate_user.php -t=10000 -c=courseid -g=groupid
        

      5. Go to Course Participant page.
      6. Verify that you can see a list of users without any error. Both without filters ((there should be 50000 users enrolled) and filtering by any of the groups (there should be 10000 users on each).

       

      P/S: I created a CLI file that will generate, enrol, assign to a group to test this ticket. If you want to use, please refer attachment (Copy to admin/cli)

      Show
      Create a Course and annotate its course id. Create 10 groups with long group name (Ex: BA/BSc (Hons) Open degree (QD) qualification, ...) and annotate their group ids. Install the attached  generate_user.php  @ admin/cli. Invoke the script like this, ten times, using the annotated course id with a different group id on each execution. php admin/cli/generate_user.php -t=10000 -c=courseid -g=groupid Go to Course Participant page. Verify that you can see a list of users without any error. Both without filters ((there should be 50000 users enrolled) and filtering by any of the groups (there should be 10000 users on each).   P/S: I created a CLI file that will generate, enrol, assign to a group to test this ticket. If you want to use, please refer attachment (Copy to admin/cli)
    • Affected Branches:
      MOODLE_35_STABLE, MOODLE_36_STABLE, MOODLE_37_STABLE
    • Fixed Branches:
      MOODLE_35_STABLE, MOODLE_36_STABLE
    • Pull 3.5 Branch:
    • Pull Master Branch:

      Description

      We have a performance problem with the course participants page. With a very large course with ~50k users and 10 groups, each group have ~5k users,  sometimes it will load normally, but it fails to load most the time

      Please refer the attachment for more detail

      The problem come from lib/grouplib.php:207 (function groups_get_all_groups)

        Attachments

        1. generate_user.php
          3 kB
        2. Error.png
          Error.png
          49 kB
        3. Before patch.png
          Before patch.png
          34 kB
        4. After patch.png
          After patch.png
          35 kB

          Issue Links

            Activity

              People

              Assignee:
              timhunt Tim Hunt
              Reporter:
              HuongNV Huong Nguyen
              Peer reviewer:
              Huong Nguyen
              Integrator:
              Eloy Lafuente (stronk7)
              Tester:
              Mathew May
              Participants:
              Component watchers:
              Andrew Nicols, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Matteo Scaramuccia, Andrew Nicols, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                11/Mar/19