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

Bulk issue move operations are slow and performance is degraded with small EagerLoadingOfBizCustomFieldPersister cache

    XMLWordPrintable

Details

    Description

      Summary

      In JRASERVER-68806 we decreased the size of the EagerLoadingOfBizCustomFieldPersister cache from infinite to 10. This works well for operations such as CSV export and indexing, which access each issue only once. However, there are some bulk operations that iterate over the same issues multiple times. So far we have identified these:

      • bulk issue move
      • changing project issue type scheme (requires issue type mapping) (70 mins for 21k issues)

      In these cases, the cache that holds values for the last 10 issues is constantly being reloaded, which makes it practically as there is no cache (see notes below).

      Steps to Reproduce

      1. <TBD>

      Expected Results

      • Bulk issue operations are fast
      • DB is not overloaded with requests

      Actual Results

      • bulk issue operations are slow
      • Large number of SQL operations querying customfieldvalue table:
        SELECT ID, ISSUE, CUSTOMFIELD, UPDATED, PARENTKEY, STRINGVALUE, NUMBERVALUE, TEXTVALUE, DATEVALUE, VALUETYPE FROM customfieldvalue WHERE ISSUE='<ID>'
        

      Notes

      Example of thread doing BulkMigrateOperation, merged by operations, you can see that cache constantly being reloaded:

      "https-jsse-nio-8443-exec-6 url:/secure/admin/M...chooseContext.jspa username:user1" count=11 prio=5 tid=0x00007f18a9bc8800 nid=0xa70b runnable [0x00007f1739d67000]
         java.lang.Thread.State: RUNNABLE100.00%   [11/11]\ at com.atlassian.jira.web.action.admin.issuetypes.MigrateIssueTypes.doChooseContext(MigrateIssueTypes.java:81)
      100.00%   [11/11] \ at com.atlassian.jira.bulkedit.operation.BulkMigrateOperation.chooseContextNoValidate(BulkMigrateOperation.java:248)
      100.00%   [11/11]  \ at com.atlassian.jira.bulkedit.operation.BulkMoveOperationImpl.chooseContextNoValidate(BulkMoveOperationImpl.java:333)
      100.00%   [11/11]   \ at com.atlassian.jira.bulkedit.operation.BulkMoveOperationImpl.finishChooseContext(BulkMoveOperationImpl.java:482)
      100.00%   [11/11]    \ at com.atlassian.jira.bulkedit.operation.BulkMoveOperationImpl.setMoveFieldLayoutItems(BulkMoveOperationImpl.java:919)
      100.00%   [11/11]     X at com.atlassian.jira.bulkedit.operation.BulkMoveOperationImpl.fieldNeedsMove(BulkMoveOperationImpl.java:958)
        9.09%    [1/11]     |\ at com.atlassian.jira.web.bean.BulkEditBeanImpl.getFirstTargetIssueObject(BulkEditBeanImpl.java:685)
        9.09%    [1/11]     | \ at com.atlassian.jira.web.bean.BulkEditBeanImpl.getTargetIssueObjects(BulkEditBeanImpl.java:697)
        ....
       90.91%   [10/11]      \ at com.atlassian.jira.bulkedit.operation.BulkMoveOperationImpl.fieldNeedsMove(BulkMoveOperationImpl.java:989)
       90.91%   [10/11]       \ at com.atlassian.jira.issue.fields.ImmutableCustomField.needsMove(ImmutableCustomField.java:1058)
       90.91%   [10/11]        \ at com.atlassian.jira.issue.fields.ImmutableCustomField.doesFieldHaveValue(ImmutableCustomField.java:1179)
       90.91%   [10/11]         \ at com.atlassian.jira.issue.fields.ImmutableCustomField.getValue(ImmutableCustomField.java:350)
       90.91%   [10/11]          \ at com.atlassian.jira.issue.customfields.impl.AbstractSingleFieldType.getValueFromIssue(AbstractSingleFieldType.java:73)
       90.91%   [10/11]           \ at com.atlassian.jira.issue.customfields.impl.AbstractSingleFieldType.getValueFromIssue(AbstractSingleFieldType.java:87)
       90.91%   [10/11]            \ at com.atlassian.jira.issue.customfields.persistence.OfBizCustomFieldValuePersister.getValues(OfBizCustomFieldValuePersister.java:65)
       90.91%   [10/11]             \ at com.atlassian.jira.issue.customfields.persistence.OfBizCustomFieldValuePersister.getValues(OfBizCustomFieldValuePersister.java:73)
       90.91%   [10/11]              \ at com.atlassian.jira.issue.customfields.persistence.EagerLoadingOfBizCustomFieldPersister.getValuesForTypeAndParent(EagerLoadingOfBizCustomFieldPersister.java:86)
       90.91%   [10/11]               \ at com.atlassian.jira.issue.customfields.persistence.EagerLoadingOfBizCustomFieldPersister.getValuesForIssueId(EagerLoadingOfBizCustomFieldPersister.java:103)
       90.91%   [10/11]                \ at com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:4739)
       .... 
       90.91%   [10/11]                   X at org.ofbiz.core.entity.GenericHelperDAO.findByAnd(GenericHelperDAO.java:166)
       45.45%    [5/11]                      \ at oracle.jdbc.driver.InsensitiveScrollableResultSet.next(InsensitiveScrollableResultSet.java:406)
      

       

      Workaround

      • Increase the cache size (jira.customfield.values.cache.max.size) to hold required number of issues (default 10). This is done by introducing the following JVM startup argument, for example, to increase the cache size to 1000:
        -Djira.customfield.values.cache.max.size=1000
        

      Attachments

        Issue Links

          Activity

            People

              ddudziak Stasiu
              kcichy Kamil Cichy
              Votes:
              24 Vote for this issue
              Watchers:
              49 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: