Uploaded image for project: 'Jira Software Data Center'
  1. Jira Software Data Center
  2. JSWSERVER-19230

REST call lastVisited executes board-scope-filter which leads to performance overhead

      Summary

      REST API call PUT /rest/projects/1.0/project/<PRJ>/lastVisited is used to track last visited project.
      While executing the call, method started to load the context thus executing com.atlassian.greenhopper.web.sidebar.BoardScopeFilterContextProviderImpl#getContext which leads to expensive computations (see JSWSERVER-16185).
      Due to excessive computation, it puts extra pressure for the permission cache and increases CPU usage, which may lead to degraded performance of the whole Jira instance.

      Steps to Reproduce

      1. Load any issue, Jira will execute PUT /rest/projects/1.0/project/<PRJ>/lastVisited as part of page loading
      2. Put a break point and collect stack-trace

      Expected Results

      getContext is not executed

      Actual Results

      getContext is executed

      Notes

      Taking into account that /lastVisited is executed for each issue load, this adds extra CPU overhead for Jira.
      Snippet from stacktrace:

      ...
      	at com.atlassian.greenhopper.service.query.QueryServiceImpl.getProjectsForRapidView(QueryServiceImpl.java:137)
      	at com.atlassian.greenhopper.service.query.QueryServiceImpl.getExplicitProjectsForRapidViewFilterQuery(QueryServiceImpl.java:128)
      	at com.atlassian.greenhopper.service.rapid.ProjectRapidViewServiceImpl.findProjectsByRapidView(ProjectRapidViewServiceImpl.java:69)
      	at com.atlassian.greenhopper.service.rapid.ProjectRapidViewServiceImpl.findRapidViewsByProject(ProjectRapidViewServiceImpl.java:51)
      	at com.atlassian.greenhopper.web.sidebar.ProjectBoardsHelper.getProjectBoards(ProjectBoardsHelper.java:53)
      	at com.atlassian.greenhopper.web.sidebar.BoardScopeFilterContextProviderImpl.getContext(BoardScopeFilterContextProviderImpl.java:47)
      	at com.atlassian.jira.projects.context.ProjectContextPopulatorImpl.populateWithProject(ProjectContextPopulatorImpl.java:82)
      	at com.atlassian.jira.projects.sidebar.navigation.SidebarNavigationService.getNavigationItemById(SidebarNavigationService.java:49)
      	at com.atlassian.jira.projects.sidebar.lastvisited.LastVisitedNavigationItemHelper.getNavigationItemById(LastVisitedNavigationItemHelper.java:58)
      	at com.atlassian.jira.projects.sidebar.lastvisited.LastVisitedItemInProjectService.isValid(LastVisitedItemInProjectService.java:101)
      	at com.atlassian.jira.projects.sidebar.lastvisited.LastVisitedItemInProjectService.setLastVisitedItemIdForProject(LastVisitedItemInProjectService.java:59)
      	at com.atlassian.jira.projects.sidebar.lastvisited.LastVisitedItemResource.updateLastVisitedItem(LastVisitedItemResource.java:51)
      ...
      

      Based on performance data, /lastVisited calls might be up to 10% of all CPU active threads.

      Workaround

      Please check JSWSERVER-16717 to be able to disable sidebar loading code.

          Form Name

            [JSWSERVER-19230] REST call lastVisited executes board-scope-filter which leads to performance overhead

            Solution introduced in JSWSERVER-16185 will also solve the problem of lastVisited REST call.

            Grzegorz Tanczyk (Inactive) added a comment - Solution introduced in  JSWSERVER-16185 will also solve the problem of lastVisited REST call.

            domruf
            Thanks for sharing your observation.

            Can you please open a support case with us (refering this ticket) and share more context.
            This will help us shape the problem more properly.

            Thanks.

            Andriy Yakovlev [Atlassian] added a comment - domruf Thanks for sharing your observation. Can you please open a support case with us (refering this ticket) and share more context. This will help us shape the problem more properly. Thanks.

            domruf added a comment -

            I think we experience this problem on out Jira instance.

            I see a request to /rest/projects/1.0/project/<PRJ>/lastVisited that took more then 80 seconds.

            At the same time there is a peak of active DB connections. So the fact that Jira runs out of DB connections makes the performance problem even worse.

            domruf added a comment - I think we experience this problem on out Jira instance. I see a request to /rest/projects/1.0/project/<PRJ>/lastVisited that took more then 80 seconds. At the same time there is a peak of active DB connections. So the fact that Jira runs out of DB connections makes the performance problem even worse.

              gtanczyk Grzegorz Tanczyk (Inactive)
              ayakovlev@atlassian.com Andriy Yakovlev [Atlassian]
              Affected customers:
              1 This affects my team
              Watchers:
              10 Start watching this issue

                Created:
                Updated:
                Resolved: