Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-34109

Issue Type Scheme association takes an excessive amount of time

    XMLWordPrintable

Details

    Description

      NOTE: This bug report is for JIRA Server. Using JIRA Cloud? See the corresponding bug report.

      • 830 projects
      • 284 issue types
      • 1828 custom fields! (many with different project contexts)

      Now when we associate an issue type scheme with a project the following code is where all the time is taken up:

      "http-8080-6@12301" daemon prio=5 tid=0x51 nid=NA runnable
        java.lang.Thread.State: RUNNABLE
      	  at com.google.common.cache.CustomConcurrentHashMap$HashIterator.advanceTo(CustomConcurrentHashMap.java:4050)
      	  at com.google.common.cache.CustomConcurrentHashMap$HashIterator.nextInChain(CustomConcurrentHashMap.java:4021)
      	  at com.google.common.cache.CustomConcurrentHashMap$HashIterator.advance(CustomConcurrentHashMap.java:3995)
      	  at com.google.common.cache.CustomConcurrentHashMap$HashIterator.nextEntry(CustomConcurrentHashMap.java:4072)
      	  at com.google.common.cache.CustomConcurrentHashMap$KeyIterator.next(CustomConcurrentHashMap.java:4087)
      	  at com.atlassian.jira.issue.context.persistence.CachingFieldConfigContextPersister.invalidateMatchingKeys(CachingFieldConfigContextPersister.java:201)
      	  at com.atlassian.jira.issue.context.persistence.CachingFieldConfigContextPersister.store(CachingFieldConfigContextPersister.java:157)
      	  at com.atlassian.jira.issue.fields.config.manager.FieldConfigSchemeManagerImpl.setValue(FieldConfigSchemeManagerImpl.java:83)
      	  at com.atlassian.jira.issue.fields.config.manager.FieldConfigSchemeManagerImpl.storeAssociateContexts(FieldConfigSchemeManagerImpl.java:327)
      	  at com.atlassian.jira.issue.fields.config.manager.FieldConfigSchemeManagerImpl.updateFieldConfigScheme(FieldConfigSchemeManagerImpl.java:232)
      	  at com.atlassian.jira.web.action.admin.issuetypes.pro.AssociateIssueTypeSchemes.run(AssociateIssueTypeSchemes.java:135)
      	  at com.atlassian.jira.web.action.admin.issuetypes.MigrateIssueTypes.doPerform(MigrateIssueTypes.java:164)
      	  at sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:-1)
      	  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	  at java.lang.reflect.Method.invoke(Method.java:597)
      

      Essentially in at com.atlassian.jira.issue.fields.config.manager.FieldConfigSchemeManagerImpl.storeAssociateContexts(FieldConfigSchemeManagerImpl.java:327) we have 613 contexts. For each context we then get into a loop in com.atlassian.jira.issue.context.persistence.CachingFieldConfigContextPersister.invalidateMatchingKeys(CachingFieldConfigContextPersister.java:201) where we have a cache that contains 413467 entries.

      So in total we end up iterating 613 * 413467 = 253455271 times. That's a lot . As far as I can tell that's simply done to invalidate cache entries in the CachingFieldConfigContextPersister. This is where I ran out of time to investigate further but given the customer data and information above should be enough for someone on bugfix to reproduce. There's probably more efficient ways we could be clearing cache entries (using map.remove(key) rather than iterating with a predicate perhaps).

      Attachments

        Issue Links

          Activity

            People

              edalgliesh Eric Dalgliesh
              pkirkeby Pelle Kirkeby (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: