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

restore_search_base::search should use a recordset

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.5.1
    • Fix Version/s: 2.6
    • Component/s: Backup
    • Labels:
    • Testing Instructions:
      Hide
      1. Perform the first steps without the patch applied (eg. on stable).
      2. Create a site that contains 5000 courses and 1000 course categories.
      3. Visit <yoursite>/admin/settings.php?section=debugging and ensure 'Performance info' is checked (debugging should obviously also be on as well), so that you can see "RAM peak" in page footers.
      4. Backup one of the courses.
      5. Start a restore process using the backup you just created.
      6. When you're on the step "2 -> Destination" page, note the RAM peak.
      7. Reload the page a couple of times and note the RAM peak.
      8. Stay on that page and open another tab.
      9. Upgrade your branch to the latest integration and run the update in the tab you just opened.
      10. Once the update has finished you can close the tab and reload the step "2 -> Destination" page, note the RAM peak.
      11. Reload the page a few times and note the RAM peak.
      12. Confirm that the RAM peak is lower after applying the patch.
      13. Confirm that you can restore the course.
      Show
      Perform the first steps without the patch applied (eg. on stable). Create a site that contains 5000 courses and 1000 course categories. Visit <yoursite>/admin/settings.php?section=debugging and ensure 'Performance info' is checked (debugging should obviously also be on as well), so that you can see "RAM peak" in page footers. Backup one of the courses. Start a restore process using the backup you just created. When you're on the step "2 -> Destination" page, note the RAM peak. Reload the page a couple of times and note the RAM peak. Stay on that page and open another tab. Upgrade your branch to the latest integration and run the update in the tab you just opened. Once the update has finished you can close the tab and reload the step "2 -> Destination" page, note the RAM peak. Reload the page a few times and note the RAM peak. Confirm that the RAM peak is lower after applying the patch. Confirm that you can restore the course.
    • Affected Branches:
      MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_26_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      mdl26_MDL-41403_backup_reduce_memory_usage

      Description

      Currently, search() calls $DB->get_records_sql with a limit of 5000. On Moodles that have 1000s of courses, this uses a chunk of memory.

      The proposed improvement uses get_recordset_sql instead, to keep memory usage down.

      On the Moodle instance I tested on (> 5000 courses, > 1200 course categories), this reduced PEAK RAM usage for this page from 118 MB to 101 MB - about 15% less memory.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  18/Nov/13