Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-13235

Improve performance by creating a threadlocal cache for space permission checks

    • We collect Confluence feedback from various sources, and we evaluate what we've collected when planning our product roadmap. To understand how this piece of feedback will be reviewed, see our Implementation of New Features Policy.

      Use a thread-local per-request cache to cache:

      • User + permission + space = true/false at the SpacePermissionManager level
      • user has useConfluence permission at the PermissionManager level

      This should remove a significant number of duplicated permission checks per request, hopefully helping performance on systems with unusual user management setups. It's unlikely to have a gigantic effect on systems with small numbers of users/groups/spaces, though.

            [CONFSERVER-13235] Improve performance by creating a threadlocal cache for space permission checks

            reworded title a bit to make it more obvious it is about performance improvements

            Per Fragemann [Atlassian] added a comment - reworded title a bit to make it more obvious it is about performance improvements

            Don Willis added a comment - - edited

            I think this improvement should go some way to improving page load time for pages with many links, as describe by CONF-5494, since time is taken to check the space permissions for each link. There is probably still room for improvement though.

            Don Willis added a comment - - edited I think this improvement should go some way to improving page load time for pages with many links, as describe by CONF-5494 , since time is taken to check the space permissions for each link. There is probably still room for improvement though.

            Matt Ryall added a comment -

            There's one additional commit by Charles related to this change that didn't get the JIRA issue in the commit message:

            https://svn.atlassian.com/atlaseye/changelog/confluence?cs=69160

            Matt Ryall added a comment - There's one additional commit by Charles related to this change that didn't get the JIRA issue in the commit message: https://svn.atlassian.com/atlaseye/changelog/confluence?cs=69160

            Matt Ryall added a comment -

            I've attached the scripts I've used for performance testing this. It was a single page load in a space with 100 group permissions, accessed by a user which is a member of 1000 groups.

            Matt Ryall added a comment - I've attached the scripts I've used for performance testing this. It was a single page load in a space with 100 group permissions, accessed by a user which is a member of 1000 groups.

            Matt Ryall added a comment -

            I've reviewed the change and tested the performance of permission checking with and without this change. The average response time in my test harness:

            • without this change: 5300 ms (cold cache), 240 ms (warm cache)
            • with this change: 5400 ms (cold cache), 150 ms (warm cache).

            I think the change in the cold cache time isn't statistically significant (it has high volatility across tests), but the improvement in time with a warm cache is substantial, as you'd expect from adding a new cache like this.

            We'll ship with it in 2.10, for sure.

            Matt Ryall added a comment - I've reviewed the change and tested the performance of permission checking with and without this change. The average response time in my test harness: without this change: 5300 ms (cold cache), 240 ms (warm cache) with this change: 5400 ms (cold cache), 150 ms (warm cache). I think the change in the cold cache time isn't statistically significant (it has high volatility across tests), but the improvement in time with a warm cache is substantial, as you'd expect from adding a new cache like this. We'll ship with it in 2.10, for sure.

            Unless it is a trivial change, my preference would be to back it out. I'll review the change later this week to confirm this.

            Matt Ryall added a comment - Unless it is a trivial change, my preference would be to back it out. I'll review the change later this week to confirm this.

            What should we do with this issue? Back it out due to no measurable improvements, or leave it in because in general confidence that it will help in certain scenarios?

            Per Fragemann [Atlassian] added a comment - What should we do with this issue? Back it out due to no measurable improvements, or leave it in because in general confidence that it will help in certain scenarios?

            Matt Ryall added a comment -

            The automated load tests didn't show any significant improvement between 2-5 October. If we have some time after the plugins bugs are fixed, I'll chat to Charles about some kind of specific test for this functionality.

            Matt Ryall added a comment - The automated load tests didn't show any significant improvement between 2-5 October. If we have some time after the plugins bugs are fixed, I'll chat to Charles about some kind of specific test for this functionality.

            Can you guys make sure this gets reviewed, and ideally also some automated loadtest by George that shows something has actually improved (or at least not gotten worse)?

            Per Fragemann [Atlassian] added a comment - Can you guys make sure this gets reviewed, and ideally also some automated loadtest by George that shows something has actually improved (or at least not gotten worse)?

              cmiller CharlesA
              cmiller CharlesA
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: