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

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

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2.10, 2.3.7, 2.4, 2.5, 2.6
    • Fix Version/s: 2.3.8, 2.4.5, 2.5.1
    • Component/s: SCORM
    • Labels:
    • Testing Instructions:
      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.
    • Affected Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE, MOODLE_26_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      get_users_by_capability_fix_master

      Description

      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

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    8/Jul/13