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

Role definition caching & accesslib refactoring

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      Automated tests
      1. Run PHPUnit and Behat tests.
        • Confirm that everything passes.
      Manual testing
      Role assignment
      1. Enrol some users on a course, give them some roles
        • Confirm that you can assign roles
      2. Login as those users and confirm that you can login accordingly
      3. Confirm that you can rename a role within a course
      4. Confirm that you can create and assign a new role to someone.
      Role switching
      1. Login as an editing teacher and go to a course.
        • Confirm you can see the edit cog button.
      2. Switch your role to a student
        • Confirm that edit cog is not displayed.
      3. Switch back to your normal role.
        • Confirm you can see the edit cog button again.
      Learning plan templates.
      1. Login as an admin
      2. Assign a manager system role to a user.
      3. Login as the manager.
      4. Create a competency framework
      5. Add competencies to the framework
      6. Create a learning plan template and add the competencies from the framework.
      7. After creating the learning plan template, click on the "Edit" link of the learning plan template.
      8. Click "Create learning plans"
      9. Expand the "Select users to create learning plans for" dropdown menu.
        • Confirm that the dropdown menu gets populated with a list of users.
      Show
      Automated tests Run PHPUnit and Behat tests. Confirm that everything passes. Manual testing Role assignment Enrol some users on a course, give them some roles Confirm that you can assign roles Login as those users and confirm that you can login accordingly Confirm that you can rename a role within a course Confirm that you can create and assign a new role to someone. Role switching Login as an editing teacher and go to a course. Confirm you can see the edit cog button. Switch your role to a student Confirm that edit cog is not displayed. Switch back to your normal role. Confirm you can see the edit cog button again. Learning plan templates. Login as an admin Assign a manager system role to a user. Login as the manager. Create a competency framework Add competencies to the framework Create a learning plan template and add the competencies from the framework. After creating the learning plan template, click on the "Edit" link of the learning plan template. Click " Create learning plans " Expand the " Select users to create learning plans for " dropdown menu. Confirm that the dropdown menu gets populated with a list of users.
    • Affected Branches:
      MOODLE_29_STABLE, MOODLE_34_STABLE
    • Fixed Branches:
      MOODLE_34_STABLE
    • Pull Master Branch:
      MDL-49398_final4

      Description

      So, for a long time accesslib has had commentary like this:
      //TODO: MUC - this could be cached in shared memory to speed up first page loading, web crawlers, etc.
      ...and lots of complexity around loading role definition information down to only courses, based on the assumption going to modules/blocks would take a large amount more memory.

      Anybody familiar with high traffic Moodle sites will also know that the login process is pretty heavy on the database, due to some of those big queries in accesslib.

      It appears sites do not really use role overrides or assignments below the course level, so it cannot use much more space to preload those extra cases.

      I've put together a proof of concept which removes the limit on how much role definition data to load, and caches this new "site wide" role definition in MUC, removing the most of the expensive portion of queries involved in initial session setup.

      Looking for some input to determine if this approach is something worth pursuing...

        Attachments

        1. Activity_view_5_op.pdf
          203 kB
        2. Comparison without and with cache .png
          Comparison without and with cache .png
          85 kB
        3. comparsion_view_activities.png
          comparsion_view_activities.png
          1021 kB
        4. ExtraSmall(XS).png
          ExtraSmall(XS).png
          1.02 MB
        5. Forum_post_5_op.pdf
          194 kB
        6. Forum-post.png
          Forum-post.png
          876 kB
        7. Medium.png
          Medium.png
          1.03 MB
        8. performance-comparison.png
          performance-comparison.png
          79 kB
        9. prod_profile.png
          prod_profile.png
          74 kB
        10. rdefcache_1vs2.png
          rdefcache_1vs2.png
          18 kB
        11. Screenshot from 2017-03-23 16-56-18.png
          Screenshot from 2017-03-23 16-56-18.png
          77 kB
        12. sky_comparison.png
          sky_comparison.png
          119 kB
        13. Small(S).png
          Small(S).png
          1.02 MB
        14. vanilla_vs_rdefcache2.png
          vanilla_vs_rdefcache2.png
          17 kB

          Issue Links

            Activity

              People

              • Votes:
                18 Vote for this issue
                Watchers:
                31 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  13/Nov/17