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

JQL autocomplete suggestions on Epic field may cause performance issues

    XMLWordPrintable

Details

    Description

      Issue Summary

      When a user writes JQL queries via Jira's Advanced Search, certain fields support autocompletion, which will suggest values as the user types.

      As the user types, Jira will use a thread to perform a search against what they've typed and return possible results back to the user. In large or slow instances, and depending on the field being autocompleted, this functionality may not return quickly, and can take multiple seconds.

      It is possible for the user to continue typing and end up making multiple autocompletion requests before the previous requests ever complete and return to the user. Jira will not cancel or otherwise terminate previously ongoing autocompletion threads in this case.

      The instance may experience high CPU load and thread utilization if too many of these threads are working on these autocompletion tasks.

      Example fields include, but aren't limited to:

      • Epic Link
      • Components

      Steps to Reproduce

      This issue is best reproduced in environments with high concurrent user load and activity, as well as large datasets. Otherwise, the issue may be partially induced in a stock Jira instance per the following:

      1. Create a new Software project.
      2. Using the Data Generator for Jira (do not use in Production), create at least 100,000 Epics in this project.
        • More will cause the issue to reproduce more severely, but will take more time to generate and index the issues.
      3. Using the Issue Navigator, begin creating a new JQL query (i.e. "Epic Link" = )
      4. Through multiple windows and perhaps through the help of other users, begin typing values into the Epic Link field. They do not have to be real values (i.e "Epic Link" = abcde..."). Avoid typing more quickly than 2-3 characters/second.

      Expected Results

      When users stop typing, suggested results will be shown.

      Actual Results

      Observe that CPU usage on the instance elevates, with the severity and duration depending on the frequency that new characters are being typed, and how many concurrent submissions are being made (i.e. other windows or users).

      Thread Dumps taken during this time will show many threads consuming CPU with stack traces containing (in the below example, for Epic Links):

      ...
      	at com.atlassian.greenhopper.service.issue.IssueDataServiceImpl.findImpl(IssueDataServiceImpl.java:183)
      	at com.atlassian.greenhopper.service.issue.IssueDataServiceImpl.find(IssueDataServiceImpl.java:46)
      	at com.atlassian.greenhopper.service.issuelink.EpicPickerServiceImpl.listEpicNames(EpicPickerServiceImpl.java:68)
      	at com.atlassian.greenhopper.customfield.epiclink.EpicLinkClauseValueGenerator.getPossibleValues(EpicLinkClauseValueGenerator.java:27)
      	at com.atlassian.jira.rest.internal.jql.FieldAndPredicateAutoCompleteResultGenerator.generateResults(FieldAndPredicateAutoCompleteResultGenerator.java:82)
      	at com.atlassian.jira.rest.internal.jql.FieldAndPredicateAutoCompleteResultGenerator.getAutoCompleteResultsForField(FieldAndPredicateAutoCompleteResultGenerator.java:53)
      	at com.atlassian.jira.rest.v2.search.SearchAutoCompleteResource.getFieldAutoCompleteForQueryString(SearchAutoCompleteResource.java:136)
      ...
      

      The following HTTP requests can be seen made against the Access Logs, showing an individual GET request per character typed:

      GET /node0/rest/api/2/jql/autocompletedata/suggestions?fieldName=component&fieldValue=c&_=1571178278998
      GET /node0/rest/api/2/jql/autocompletedata/suggestions?fieldName=component&fieldValue=ci&_=1571178279798
      GET /node0/rest/api/2/jql/autocompletedata/suggestions?fieldName=component&fieldValue=ciw&_=1571178280504
      GET /node0/rest/api/2/jql/autocompletedata/suggestions?fieldName=component&fieldValue=ciwo&_=1571178281180
      GET /node0/rest/api/2/jql/autocompletedata/suggestions?fieldName=component&fieldValue=ciwor&_=1571178281744
      GET /node0/rest/api/2/jql/autocompletedata/suggestions?fieldName=component&fieldValue=ciworh&_=1571178282340
      GET /node0/rest/api/2/jql/autocompletedata/suggestions?fieldName=component&fieldValue=ciworhe&_=1571178282909

      Workaround

      Avoid creating or editing multiple JQL queries at the same time, or in rapid succession.

      Disable JQL Auto-complete per Administration >> System >> General Configuration

      Suggested Solution

      Allow administrators to configure the frequency at which the browser may submit search requests.

      Attachments

        Issue Links

          Activity

            People

              snatkovskyi Stanislav Natkovskyi (Inactive)
              kliou Kevin Liou
              Votes:
              26 Vote for this issue
              Watchers:
              39 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: