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

mod/scorm: significant memory improvements on large datasets with get_users_by_capability fix

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.3.8, 2.4.5, 2.5.1
    • 2.2.10, 2.3.7, 2.4, 2.5, 2.6
    • SCORM
    • MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE, MOODLE_26_STABLE
    • MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE
    • get_users_by_capability_fix_master
    • Hide

      View the reports page of a SCORM package that has some attempts from students.
      View both the Basic and interactions reports and make sure they display the users correctly - check the exports of the report to make sure those are generated correctly as well.

      Show
      View the reports page of a SCORM package that has some attempts from students. View both the Basic and interactions reports and make sure they display the users correctly - check the exports of the report to make sure those are generated correctly as well.

      In Moodle we have a database of about 40,000 users and our basic and interactions scorm reports span hundreds of pages.

      We've encountered PHP memory exhaustion errors that we've traced to the get_users_by_capability calls in mod/scorm/report/<basic|interactions>/report.php

      In order to fix the memory errors we had to set the PHP memory_limit > 512M from the default of 128M.

      Our fix involves limiting the fields returned from get_users_by_capability to user ID and unsetting variables to decrease memory utilization. These are the performance numbers (with APC cache enabled) when running the scorm reports before and after the applied patch:
      Pre-patch memory usage (peak MB): 616.4
      Post-patch memory usage (peak MB): 97.1

      After applying the patch we can use the PHP default memory limit of 128M.

      Please take a look at the the following branches at http://github.com/timgus/moodle
      get_users_by_capability_fix_m22
      get_users_by_capability_fix_m23
      get_users_by_capability_fix_m24
      get_users_by_capability_fix_m25
      get_users_by_capability_fix_master

            danmarsden Dan Marsden
            tgus Tim Gus
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Petr Skoda Petr Skoda
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

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