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

    • MOODLE_35_STABLE, MOODLE_36_STABLE, MOODLE_37_STABLE
    • MOODLE_35_STABLE, MOODLE_36_STABLE
    • 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)

      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)

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

            timhunt Tim Hunt
            HuongNV Huong Nguyen
            Huong Nguyen Huong Nguyen
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Glyn (Mathew) May Glyn (Mathew) May
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.