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

get_record cache might potentially use a lot of memory

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.7, 1.7.1, 1.8
    • Fix Version/s: 1.8
    • Component/s: Database SQL/XMLDB
    • Labels:
      None
    • Affected Branches:
      MOODLE_17_STABLE, MOODLE_18_STABLE
    • Fixed Branches:
      MOODLE_18_STABLE

      Description

      The new get_record cache might cause memory problems if there is code that follows a pattern like:

      while(EVERY_USER_ON_COURSE) {
      get_record(DIFFERENT_RECORD_FOR_EACH_USER);
      }

      While nobody has yet identified a situation like this that actually does cause a problem - and it is also possible to manually disable the cache in code - it is possible that some may exist, or may be developed in future. These can cause the type of issue that you don't notice for small courses but would see for large ones. For example, 10,000 user records would occupy about 30MB of memory according to my testing (I actually tested w/ 200 and extrapolated); probably still not a problem but it's quite a lot of unnecessary memory usage... And in this type of situation the cache does not usually give a performance advantage.

      My suggestion is to apply a simple limit to the cache size.

        Attachments

          Activity

            People

            • Assignee:
              quen Sam Marshall
              Reporter:
              quen Sam Marshall
              Tester:
              Nobody
              Participants:
              Component watchers:
              Jake Dallimore, Jun Pataleta, Ryan Wyllie
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                31/Mar/07