Uploaded image for project: 'Jira Server and Data Center'
  1. Jira Server and Data Center
  2. JRASERVER-22448

Comment Query Performance: Please Change CommentClauseQueryFactory.generateIssueIdFromCommentQuery from for loop to HitCollector

    XMLWordPrintable

    Details

      Description

      Please please please change CommentClauseQueryFactory.generateIssueIdFromCommentQuery() to use a DocumentHitCollector rather than a for() loop that iterates over Hits.

      We're still working on upgrading our Jira 3.13 to 4.1.2.
      One thing I noticed was that comment queries were taking forever on my test server when compared to 3.13 running on the same server.
      After a day of debugging and testing, I narrowed it down to looping through the Hits in CommentClauseQueryFactory.generateIssueIdFromCommentQuery().
      The Hits class is deprecated and states,

       /** 
       * Iterating over all hits is generally not desirable and may be the source of
       * performance issues. If you need to iterate over many or all hits, consider
       * using the search method that takes a {@link HitCollector}.
       */

      I modified our Jira to use a com.atlassian.jira.issue.statistics.util.DocumentHitCollector instead of a for() loop over Hits and our comment queries are now miraculously 6 to 8 times faster.

      Here are the statistics for one of my tests before and after the change. For this test I ran comment ~ power which returns about 7000 issues. In Jira 3 I ran the equivalent by putting 'power' into the query box and checking only 'Comments'.

      • Before the change
        • In Luke, the Lucene query took 3.5 seconds (and without the level restrictions it took 389 ms, which one should consider for another Improvement....)
        • In Jira, the Lucene query took the same amount time
        • Looping through the issue id's took 74 seconds
      • After the change
        • Lucene query with hit collection takes 12s

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              pleschev Peter Leschev
              Reporter:
              adc6ee404f6d Jeff Kirby
              Votes:
              4 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: