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

Reduce de-referencing on MUC and static acceleration

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Critical Critical
    • 3.1
    • 3.0.2
    • Caching, Performance
    • MOODLE_30_STABLE
    • MOODLE_31_STABLE
    • Hide

      1. Run all unit and behat tests. They must pass.

      Setup

      • Ensure your language string cache (langstringcache) is turned on.
      • Ensure your DEVELOPER_DEBUG is turned off, as is performance debugging.
      • Ensure you visit the Moodle homepage (as a login in user if required) after each cache purge.

      1. Run attached test performance script on the previous weekly build a number of times.
      2. move to this weeks build that includes the changes.
      3. Run attached test performance script again. Compare the changes.

      Show
      1. Run all unit and behat tests. They must pass. Setup Ensure your language string cache (langstringcache) is turned on. Ensure your DEVELOPER_DEBUG is turned off, as is performance debugging. Ensure you visit the Moodle homepage (as a login in user if required) after each cache purge. 1. Run attached test performance script on the previous weekly build a number of times. 2. move to this weeks build that includes the changes. 3. Run attached test performance script again. Compare the changes.

      1. serialize and unserialize are used widely to manage objects in the cache. There are multiple layers of completing this resulting in wasted cycles.
      2. There are a large amount of function calls to check the if and how something should be unreferenced. This could be simplified and reduced.
      3. most stores already store data in a serialized fashion, so when it comes back from the store it's already had references resolved. This can be told to the loader and be a performance win.
      4. static acceleration is designed to be write low and read high. However it does all the heavy lifting for dereferencing on a get call. Objects could be serialized on set if required and just a single unserialize on loading. This will reduce the serialize or clone overhead when using the static cache.
      5. uses_simple_data should be trusted by the loader to know unreference is never required, including from the static acceleration. This can be determined without nesting into the unref function.
      6. static acceleration delete does an array_search, when the keys are available and an isset() and unset() would be sufficient to remove entries.
      7. static acceleration does not need keys parsed as it's stored on a per cache basis.

      These changes can provide a significant performance improvement for complex structures and some improvement for simple data cases. In cases where simpledata is used with static acceleration but the simpledata is an object, there can be good gains because in the current structure static acceleration still did function calls when simple_data was set.

      Overall see the basic attached file that tests the runtime of a complex array of objects (databasemeta) and also does the same for simple_data and simple_keys by testing get_string. Those two formed the basis for the performance improvements.

      Basic loading of pages has not seen significant performance improvements for smaller faster pages. However for pages that complete lots of databasemeta lookups, there are much bigger gains.

        1. test.php
          2 kB
          Russell Smith
        2. integration.mpr
          11 kB
          Dan Poltawski
        3. production.mpr
          10 kB
          Dan Poltawski
        4. master-coursemod-php56-filestore.mpr
          9 kB
          Eric Merrill
        5. patch-coursemod-php56-filestore.mpr
          9 kB
          Eric Merrill
        6. master-string-php56-memcache.mpr
          8 kB
          Eric Merrill
        7. patch-string-php56-memcache.mpr
          9 kB
          Eric Merrill

            mr-russ Russell Smith (Inactive)
            mr-russ Russell Smith (Inactive)
            Eric Merrill Eric Merrill
            Dan Poltawski Dan Poltawski
            Rajesh Taneja Rajesh Taneja
            Votes:
            3 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved:

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