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

Lots of calls to update course modinfo + sectioncache

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 2.5
    • Fix Version/s: None
    • Component/s: Course, Performance
    • Labels:
    • Affected Branches:
      MOODLE_25_STABLE

      Description

      Just a forewarning - this may turn out to be a wild goose chase.

      I've a site that has 501 courses on it.
      Each course has 3 managers, 20 teachers, and 250 students (can you tell I used a script to populate this site).
      The front page is set to show a list of courses for users who are not logged in.

      When viewing the front page without logging in I am seeing 9158 reads, and 1001 writes (consistently).
      The reads is fine, we know that area to be pretty horrid, but the writes looked mighty suspicious.

      I ran a simple hash count on the queries being executed and tracked the writes back to two SQL statements:

      Statement Calls
      UPDATE mdl_course SET modinfo = $1,sectioncache = $2 WHERE id=$3 501
      UPDATE mdl_cache_text SET md5key = $1,formattedtext = $2,timemodified = $3 WHERE id=$4 500

      Cache text lifetime is set to 1 minute and this page is taking 45s+ to generate so the cache_text statement probably makes sense in a (puke) kind of way.
      However I've no clue about the call to update modinfo and section cache. I would guess something is wrong there (why on earth would be update those every single request)

      So the point of this issue, work out why that is happening and see if we can't save a few DB writes.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              samhemelryk Sam Hemelryk
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona), Matteo Scaramuccia, Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: