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

mod_choice "choice_get_response_data" is too memory intensive for large amounts of responses

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Inactive
    • Icon: Minor Minor
    • None
    • 3.1.13, 3.4.2, 3.5.1
    • Choice
    • None
    • MOODLE_31_STABLE, MOODLE_34_STABLE, MOODLE_35_STABLE

      The function "choice_get_response_data" uses quite a lot of memory as there is duplication of the responses that come back from the DB.

      This is an issue for choices where there has been a large amount of responses(10,000+) as it's storing both the raw response and parsed response in memory.

      I have posted a quick solution to this, by offsetting the logic to a separate function, ensuring that the response data is not stored in memory longer than it has to be.

       

      Steps to Reproduce:

      1. Enrol 10,000+ users into a course.
      2. Answer choice for all 10,000 users(This can be done programmatically on a test site.)
      3. View a choice via /mod/choice/view.php?id=x
      4. Depending on your memory limit(ours was 128mb) the page will fail to load.

      Commit URL is here: https://github.com/LoneBeta/moodle/commit/4ecf02b3d3a5938b824471e22c6d15ce83056c89

            Unassigned Unassigned
            andrewavado Andrew Turnbull
            Votes:
            9 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

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