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

Use question cache when starting a new quiz attempt to reduce DB load

    XMLWordPrintable

Details

    • MOODLE_400_STABLE, MOODLE_401_STABLE
    • MOODLE_403_STABLE
    • MDL-72493-master
    • Hide

      To enable query log in mysql you can edit /etc/mysql/my.cnf and add these lines after [mysqld] line 

      general_log_file = /tmp/mysql.log general_log = 1 

      Then restart mysql service 

      sudo service mysql restart 

      Now you can monitor queries written to /tmp/mysql.log

      1. Create a sample quiz with multiple qtypes include CLOZE, multiple choice etc.
      2. Preview quiz to ensure that question definitions are loaded into the MUC.
      3. Monitor DB queries
      4. Start exam as student
      5. Check if queries are being made to the DB for question construction information.

      Expected outcome, queries to {question} table etc are not being made when starting an attempt in quiz. I.e. there shouldn't be any

      SELECT * FROM mdl_question 

      when student starts attempt

      Once finished don't forget to remove those lines from mysql config and restart mysql service to stop watching queries

      Show
      To enable query log in mysql you can edit /etc/mysql/my.cnf  and add these lines after [mysqld] line  general_log_file = /tmp/mysql.log general_log = 1 Then restart mysql service  sudo service mysql restart Now you can monitor queries written to /tmp/mysql.log Create a sample quiz with multiple qtypes include CLOZE, multiple choice etc. Preview quiz to ensure that question definitions are loaded into the MUC. Monitor DB queries Start exam as student Check if queries are being made to the DB for question construction information. Expected outcome, queries to {question} table etc are not being made when starting an attempt in quiz. I.e. there shouldn't be any SELECT * FROM mdl_question when student starts attempt Once finished don't forget to remove those lines from mysql config and restart mysql service to stop watching queries
    • 1
    • Team Alpha - Sprint 3 I1-2023, Team Alpha - Sprint 4 I1-2023, Team Alpha - Planning sprint, Team Alpha - Sprint 1 I2-2023, Team Alpha - Sprint 2 I2-2023

    Description

      We(Monash University) has noticed that when we have a lot of students starting at the same time there are certain queries that run a lot.

      We did some digging and found that the core question data was being written to and then read back from the MUC repeatedly. However the question->options was being loaded from the DB every single time.

      We believe that loading this data into the MUC as well would reduce performance impacts especially with complicated quizzes that have large cohorts.

      Attachments

        Activity

          People

            Geshoski Mihail Geshoski
            dcocco Darren Cocco
            Tim Hunt Tim Hunt
            Ilya Tregubov Ilya Tregubov
            Kim Jared Lucas Kim Jared Lucas
            Votes:
            2 Vote for this issue
            Watchers:
            13 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 1 day, 3 hours, 45 minutes
                1d 3h 45m
                Remaining:
                Time Spent - 3 hours, 52 minutes Remaining Estimate - 1 hour, 43 minutes
                1h 43m
                Logged:
                Time Spent - 3 hours, 52 minutes Remaining Estimate - 1 hour, 43 minutes Time Not Required
                3h 52m

                Clockify

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