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

Cache the siteidentifier and site contextid in local cache

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 4.0
    • Fix Version/s: 4.0
    • Component/s: Performance
    • Testing Instructions:
      Hide

      Performance test

      Before applying the patch

      1. Turn on performance debugging in config.php:

        $CFG->perfdebug = 15;
        

      2. Load any page, reload it a couple times to get everything warm and look at DB reads in the footer (eg I see 48)

      After applying the patch

      1. Apply the patch
      2. Reload the same page several times
        1. Confirm that the DB reads went down by 2 (e.g. I see 46 instead of 48)

      Upgrade test

      1. Open the version.php file in your editor
      2. Find the $version variable and increment it by one at the end
      3. Run an upgrade in the UI (visit /admin)
        1. Confirm that there were no errors
      4. Increment the version number in $version again
      5. Perform a CLI upgrade:

        php admin/cli/upgrade.php
        

        1. Confirm that there were no errors

      Installation test

      1. Ensure that the code is up-to-date and clean:

        git checkout .
        git reset --hard origin/[branch]
        git clean -df
        

      2. Uninstall your current site and remove the config.php
      3. Perform a fresh install via the UI
        1. Confirm that there were no errors
      4. Drop the database again but retain the config.php
      5. Perform a fresh install via the UI
        1. Confirm that there were no errors
      6. Uninstall your current site and remove the config.php
      7. Perform a fresh install via the CLI using php admin/cli/install.php
        1. Confirm that there were no errors
      8. Drop the database again but retain the config.php
      9. Perform a fresh install via the CLI using php admin/cli/install_database.php
        1. Confirm that there were no errors
      Show
      Performance test Before applying the patch Turn on performance debugging in config.php: $CFG->perfdebug = 15; Load any page, reload it a couple times to get everything warm and look at DB reads in the footer (eg I see 48) After applying the patch Apply the patch Reload the same page several times Confirm that the DB reads went down by 2 (e.g. I see 46 instead of 48) Upgrade test Open the version.php file in your editor Find the $version variable and increment it by one at the end Run an upgrade in the UI (visit /admin) Confirm that there were no errors Increment the version number in $version again Perform a CLI upgrade: php admin/cli/upgrade.php Confirm that there were no errors Installation test Ensure that the code is up-to-date and clean: git checkout . git reset --hard origin/[branch] git clean -df Uninstall your current site and remove the config.php Perform a fresh install via the UI Confirm that there were no errors Drop the database again but retain the config.php Perform a fresh install via the UI Confirm that there were no errors Uninstall your current site and remove the config.php Perform a fresh install via the CLI using php admin/cli/install.php Confirm that there were no errors Drop the database again but retain the config.php Perform a fresh install via the CLI using php admin/cli/install_database.php Confirm that there were no errors
    • Affected Branches:
      MOODLE_400_STABLE
    • Fixed Branches:
      MOODLE_400_STABLE
    • Pull Master Branch:
      MDL-71014-cache-siteid

      Description

      As MDL-47456 was reverted this is a second attempt to avoid this call but using a different approach which should be much safer: just caching the siteid in localcache

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              brendanheywood Brendan Heywood
              Reporter:
              brendanheywood Brendan Heywood
              Peer reviewer:
              Kevin Pham Kevin Pham
              Integrator:
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              Tester:
              Simey Lameze Simey Lameze
              Participants:
              Component watchers:
              Matteo Scaramuccia, Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              4 Vote for this issue
              Watchers:
              13 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                13/Dec/21

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 3 hours, 52 minutes
                  3h 52m