Issue Summary

      User mentions and assignee lookup are slow with Jira 8.14+/JSM 4.14+. Performance regression started after Jira upgrade from the previous LTS 8.13 to 8.14 release and this was caused by the internal upgrade of the Embedded Crowd to 4.2.0+ version.
      EmbCrowd requests create an additional load on DB since UserDao method doesn't have a specific cache.

      Environments Affected

      Jira Software - all versions between 8.14 and 8.19.0
      Jira Service Management - all versions between 4.14 and 4.19.0

      Steps to Reproduce

      1. Setup Jira with large user base (50k+)
      2. Created new Jira project and issue
      3. @ mention user in the issue comment

      Expected Results

      @ mention user lookup result returns instantaneously, especially the one that user have searched recently/repeatedly

      Actual Results

      @ mention user lookup takes a substantial amount of time (few minutes) to return the list of matching users

      Investigation

      No error from logs.

      Capturing the SQL logs in local testing, we noticed that Jira is querying every user:

      • every internal user against internal directory once e.g:
        2021-01-22 21:16:57,072+1100 http-nio-48140-exec-9 admin 1276x1590x1 12f88sa /rest/internal/2/user/mention/search 1ms "SELECT user_name FROM public.cwd_user WHERE (lower_user_name =  'admin' ) AND (directory_id =  '1' ) ORDER BY lower_user_name"
        2021-01-22 21:16:57,072+1100 http-nio-48140-exec-9 admin 1276x1590x1 12f88sa /rest/internal/2/user/mention/search 1ms Connection returned. borrowed : 0
        2021-01-22 21:16:57,072+1100 http-nio-48140-exec-9 admin 1276x1590x1 12f88sa /rest/internal/2/user/mention/search 0ms Connection taken. borrowed : 1
      • every LDAP user against the internal directory and every LDAP integrated with Jira e.g:
        2021-01-22 21:16:57,097+1100 http-nio-48140-exec-9 admin 1276x1590x1 12f88sa /rest/internal/2/user/mention/search 1ms "SELECT user_name FROM public.cwd_user WHERE (lower_user_name =  'jack' ) AND (directory_id =  '1' ) ORDER BY lower_user_name"
        2021-01-22 21:16:57,097+1100 http-nio-48140-exec-9 admin 1276x1590x1 12f88sa /rest/internal/2/user/mention/search 1ms Connection returned. borrowed : 0
        2021-01-22 21:16:57,097+1100 http-nio-48140-exec-9 admin 1276x1590x1 12f88sa /rest/internal/2/user/mention/search 0ms Connection taken. borrowed : 1
        2021-01-22 21:16:57,098+1100 http-nio-48140-exec-9 admin 1276x1590x1 12f88sa /rest/internal/2/user/mention/search 1ms "SELECT user_name FROM public.cwd_user WHERE (lower_user_name =  'jack' ) AND (directory_id =  '10000' ) ORDER BY lower_user_name"
        2021-01-22 21:16:57,098+1100 http-nio-48140-exec-9 admin 1276x1590x1 12f88sa /rest/internal/2/user/mention/search 1ms Connection returned. borrowed : 0
        2021-01-22 21:16:57,099+1100 http-nio-48140-exec-9 admin 1276x1590x1 12f88sa /rest/internal/2/user/mention/search 0ms Connection taken. borrowed : 1

      This same is not observed with similar setup in Jira 8.13.

      With the above findings, a lot of queries are hitting the Jira database especially if many users are sync from LDAP and/or there are multiple LDAPs integrated with Jira.

      The same amount of queries are incurred, despite repeatedly @ mentioning the same user in the same issue.

      Workaround

      Reduce the users synchronized from the external directory as Jira may scan the whole database table in some corner cases. Doing this will also help with performance improvements in other areas.
      Reducing the number of users synchronized from LDAP to JIRA applications

        1. screen-813.png
          screen-813.png
          71 kB
        2. screen-814.png
          screen-814.png
          106 kB

            [JRASERVER-72101] Performance regression in user lookup

            ThomasB added a comment - - edited

            We are also affected by this Bug , and right now its very painful to work in Jira. Opening any issue takes a long time! We "just" have 200 Users, but many groups in our Active Directory. 

            When this bug will be fixed? 

            ThomasB added a comment - - edited We are also affected by this Bug , and right now its very painful to work in Jira. Opening any issue takes a long time! We "just" have 200 Users, but many groups in our Active Directory.  When this bug will be fixed? 

            David added a comment -

            Hi Kelly,

             

            Why has this gone to backlog again!

            David added a comment - Hi Kelly,   Why has this gone to backlog again!

            Hi David,

            The dev team is working on getting this bug in the code base. I'm afraid I can't say exactly how since it is still in development. The regression is regarding cache, so I would expect there to be an improvement in how Jira caches the user directories in memory (thereby preventing repeat queries hitting back the DB)

            Best
            Alex

            Alex [Atlassian,PSE] added a comment - Hi David, The dev team is working on getting this bug in the code base. I'm afraid I can't say exactly how since it is still in development. The regression is regarding cache, so I would expect there to be an improvement in how Jira caches the user directories in memory (thereby preventing repeat queries hitting back the DB) Best Alex

            David added a comment -

            What approach are you taking to correct the issue?

            David added a comment - What approach are you taking to correct the issue?

            Hi Team,

            I can share that this bug is marked as a blocker for the next Jira LTS release. This means it will be fixed before the next LTS, so the next LTS will include the fix.

            Also to note, this particular regression is not present in the current LTS, 8.13.x

            Cheers,
            Alex

            Alex [Atlassian,PSE] added a comment - Hi Team, I can share that this bug is marked as a blocker for the next Jira LTS release. This means it will be fixed before the next LTS, so the next LTS will include the fix. Also to note, this particular regression is not present in the current LTS, 8.13.x Cheers, Alex

            Hi Team, the "long term backlog" status was set in error. Apologies for that. We understand the impact and haven't dropped this. I have reverted the status.

            I wish I had a better update for you on a fix date at this time. When we have one, we will share it here.

            Alex [Atlassian,PSE] added a comment - Hi Team, the "long term backlog" status was set in error. Apologies for that. We understand the impact and haven't dropped this. I have reverted the status. I wish I had a better update for you on a fix date at this time. When we have one, we will share it here.

            Really? Long term backlog? For a severity 1 - critical issue? What sort of status does a severity 5 issue get? Next millennia backlog?

            Atlassian wants to be in the Enterprise Service Management business for large customers - surely having a user base this size is not uncommon for a large Enterprise. The code is flawed and should be fixed. 

            Alex Evans added a comment - Really? Long term backlog? For a severity 1 - critical issue? What sort of status does a severity 5 issue get? Next millennia backlog? Atlassian wants to be in the Enterprise Service Management business for large customers - surely having a user base this size is not uncommon for a large Enterprise. The code is flawed and should be fixed. 

            David added a comment -

            How does a critical issue become long term backlog?????

            David added a comment - How does a critical issue become long term backlog?????

            David added a comment -

            Hi Bi,

            Sounds exactly like everything that happened to us. We also go the line of rollback to 8.5.5 or 8.13 and it may improve. I am sure you have the same thought when a roll back is involved days post upgrade. I will keep this thread posted but feel free to get in touch here

            David added a comment - Hi Bi, Sounds exactly like everything that happened to us. We also go the line of rollback to 8.5.5 or 8.13 and it may improve. I am sure you have the same thought when a roll back is involved days post upgrade. I will keep this thread posted but feel free to get in touch here

            BI added a comment -

            Hi David,

            Thanks for confirming. We're seeing the same symptoms, which in our case causes such high I/O of the DB that it causes Jira to halt entirely for 30+ seconds every time it needs to load any page or resource that requires a user lookup. Atlassian's response was that we should just delete all users that are not in Active Directory but of course this is not possible in our situation since we use Jira and Jira Service Management together and the users they were asking us to delete (in Jira's local database) were our customers!

            Look forward to your plugin in the marketplace!

            BI added a comment - Hi David, Thanks for confirming. We're seeing the same symptoms, which in our case causes such high I/O of the DB that it causes Jira to halt entirely for 30+ seconds every time it needs to load any page or resource that requires a user lookup. Atlassian's response was that we should just delete all users that are not in Active Directory but of course this is not possible in our situation since we use Jira and Jira Service Management together and the users they were asking us to delete (in Jira's local database) were our customers! Look forward to your plugin in the marketplace!

              jreczycki Jakub Reczycki
              kwong2@atlassian.com KellyW (Inactive)
              Affected customers:
              18 This affects my team
              Watchers:
              44 Start watching this issue

                Created:
                Updated:
                Resolved: