Issue Details (XML | Word | Printable)

Key: JRA-8489
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Nick Menere [Atlassian]
Reporter: Jeff Turner [Atlassian]
Votes: 10
Watchers: 10
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
JIRA

View Issue take a long time (slow) after search returning lots of issues

Created: 11/Nov/05 02:02 AM   Updated: 03/Feb/09 06:43 PM   Resolved: 07/Jan/09 05:27 PM
Return to search
Issue 25259 of 63008 issue(s)
<< Previous | JRA-8489 | Next >>
Component/s: Issue navigator, Performance
Affects Version/s: None
Fix Version/s: 3.13.3

Time Tracking:
Not Specified

File Attachments: 1. Zip Archive 3.13 or higher patch.zip (11 kB) 03/Feb/09 06:43 PM - Jonathan Costello [Atlassian]
2. Text File PagerManager.patch (1.0 kB) 21/Nov/08 10:50 AM - Deniz Turkoglu
3. File ViewIssue.class (25 kB) 16/Oct/07 11:18 PM - Andreas Knecht [Atlassian]
4. Text File ViewIssue.patch (0.9 kB) 16/Oct/07 11:18 PM - Andreas Knecht [Atlassian]

Issue Links:
Duplicate
 
Reference
 

Participants: Aggelos Paraskevopoulos, Andreas Knecht [Atlassian], Anton Mazkovoi [Atlassian], Deniz Turkoglu, Dushan Hanuska [Atlassian], Dylan Etkin [Atlassian], Jed Wesley-Smith [Atlassian], Jeff Turner [Atlassian], Jonathan Costello [Atlassian], Markus, Nick Menere [Atlassian] and Scott Farquhar [Atlassian]
Since last comment: 1 year, 6 days ago
Labels: engine_room


 Description  « Hide

If one searches 'all issues' in a large JIRA database, and then clicks an issue to view, JIRA will take a long time to display the issue. Subsequent issue views will be fast, until a new search is done.

The length of the delay depends on the number of issues return in the search. For instance, after doing a full search in a database of 81870 issues, displaying the first issue takes 2m 10s (1.6s per 1,000 issues).



Jeff Turner [Atlassian] added a comment - 11/Nov/05 02:04 AM

This happens because JIRA is loading all search hits in order to display the ' << Previous | ABC-123 | Next >>' navigation in the top-right of each issue.


Scott Farquhar [Atlassian] added a comment - 25/Jul/06 03:36 AM

We now have a customer with 300k issues, and this is starting to cause issues. We can either lazy-load it, or find a smarter way of doing the searching.

I have a lot of ideas about how this could be improved - please ping me before implementation.


Nick Menere [Atlassian] added a comment - 15/Aug/07 12:14 AM

We should use FieldableDocumentHitcollector as we don't need to pull in the whole document, but just the key.

There is also a Synch issue, in that we store the pager in the session. 5 threads could hit this at the same time, see that it is null and all do a search (bots love to do things like this).


Nick Menere [Atlassian] added a comment - 15/Aug/07 12:27 AM

And it really isn't thread safe.
Each thread will update currentKey on the pager and since they all share it.....


Dylan Etkin [Atlassian] added a comment - 30/Aug/07 08:01 PM

The only way to work around this issue for now is to remove the next/prev panel from the view issue page.

This can be accomplished by editing the includes/panels/issue_headertable.jsp

There is a section that looks like this:

<%-- Display next/previous nav panel unless a search has been executed --%>
            <webwork:if test="searchRequest != null">
                <%--    Next/Previous nav panel--%>
                <webwork:if test="pagerManager/pager/hasCurrentKey == false">
                    <td valign="top" align="right">
                        <table cellpadding="1" cellspacing="0" border="0" bgcolor="#bbbbbb"><tr><td>
                            <table cellpadding="2" cellspacing="0" border="0" bgcolor="#f0f0f0">
                                <tr>
                                    <td bgcolor="#dddddd">
                                        <img src="<%= request.getContextPath() %>/images/icons/undo_16.gif" alt=""
                                             width="16" height="16" border="0" align="absmiddle" />
                                        <b><a href="<%= request.getContextPath() %>/secure/IssueNavigator.jspa"
                                              title="<webwork:text name="'navigator.return.search'"/> (ALT+<webwork:text name="'navigator.return.search.accesskey'"/>)"
                                              accesskey="<webwork:text name="'navigator.return.search.accesskey'"/>">
                                            <webwork:text name="'navigator.return.search'"/></a></b>
                                        <webwork:if test="searchRequest/name != null">
                                            <font size="1">"<webwork:property value="searchRequest/name"/>"</font>
                                        </webwork:if>
                                    </td>
                                </tr>
                            </table>
                        </td></tr></table>
                    </td>
                </webwork:if>
                <webwork:else>
                    <td valign="top" align="right">
                        <table cellpadding="1" cellspacing="0" border="0" bgcolor="#bbbbbb"><tr><td>
                            <table cellpadding="2" cellspacing="0" border="0" bgcolor="#f0f0f0">
                                <tr>
                                    <td bgcolor="#dddddd">
                                        <img src="<%= request.getContextPath() %>/images/icons/undo_16.gif" alt=""
                                             width="16" height="16" border="0" align="absmiddle" />
                                        <b><a href="<%= request.getContextPath() %>/secure/IssueNavigator.jspa"
                                              title="<webwork:text name="'navigator.return.search'"/> (ALT+<webwork:text name="'navigator.return.search.accesskey'"/>)"
                                              accesskey="<webwork:text name="'navigator.return.search.accesskey'"/>">
                                            <webwork:text name="'navigator.return.search'"/></a></b>
                                        <webwork:if test="searchRequest/name != null">
                                            <font size="1">"<webwork:property value="searchRequest/name"/>"</font>
                                        </webwork:if>
                                    </td>
                                </tr>
                                <tr>
                                    <td nowrap>
                                        <font size="1">
                                            <webwork:text name="'pager.results.displayissues'">
                                                <webwork:param name="'value0'"><b><webwork:property
                                                        value="pagerManager/pager/currentPosition"/></b></webwork:param>
                                                <webwork:param name="'value1'"><b><webwork:property
                                                        value="pagerManager/pager/currentSize"/></b></webwork:param>
                                            </webwork:text>
                                            <br>
                                        </font>

                                        <div align="center">
                                            <font size="1">
                                                <webwork:if test="pagerManager/pager/previousKey != null">
                                                    <a href="<%= request.getContextPath() %>/browse/<webwork:property value="pagerManager/pager/previousKey" />"
                                                       title="<webwork:text name="'navigator.previous.title'"/> '<webwork:property value="pagerManager/pager/previousKey" />' (ALT+<webwork:text name="'navigator.previous.accesskey'"/>)"
                                                       accesskey="<webwork:text name="'navigator.previous.accesskey'"/>">
                                                        &lt;&lt; <webwork:text name="'navigator.previous'"/></a>
                                                </webwork:if>
                                                <webwork:else>
                                                    <span class="hiddenField">&lt;&lt; <webwork:text
                                                            name="'navigator.previous'"/></span>
                                                </webwork:else>
                                                | <webwork:property value="pagerManager/pager/currentKey"/>
                                                |
                                                <webwork:if test="pagerManager/pager/nextKey != null">
                                                    <a href="<%= request.getContextPath() %>/browse/<webwork:property value="pagerManager/pager/nextKey" />"
                                                       title="<webwork:text name="'navigator.next.title'"/> '<webwork:property value="pagerManager/pager/nextKey" />' (ALT+<webwork:text name="'navigator.next.accesskey'"/>)"
                                                       accesskey="<webwork:text name="'navigator.next.accesskey'"/>">
                                                        <webwork:text name="'navigator.next'"/> &gt;&gt;</a>
                                                </webwork:if>
                                                <webwork:else>
                                                    <span class="hiddenField"> <webwork:text name="'navigator.next'"/> &gt;&gt;</span>
                                                </webwork:else>
                                            </font>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                        </td></tr></table>
                    </td>
                </webwork:else>
            </webwork:if>

This whole block needs to be removed so that the panel will not appear.


Scott Farquhar [Atlassian] added a comment - 15/Sep/07 10:47 PM

When Nick talks about a FieldableHitCollector he means that we call:

IndexReader.document(int,org.apache.lucene.document.FieldSelector)

We may get an improvement (but probably not anywhere near as much) similar to this:
http://wiki.apache.org/lucene-java/FieldSelectorPerformance


Scott Farquhar [Atlassian] added a comment - 15/Sep/07 11:06 PM

When we do this, we will have to change the SearchProvider interface to take a HitCollector instead of a DocumentHitCollector in searchAndSort. It was only a DocumentHitCollector more for documentation reasons rather than needing to be that.


Andreas Knecht [Atlassian] added a comment - 16/Oct/07 11:18 PM - edited

*Please note, the solution in the comment above above is not correct.*

Removing the pager dialog from the JSP will not have any effect on performance when it comes to viewing an issue. What you'll have to do is to edit the ViewIssue action, and comment out the following lines in the doExecute() method:

final PagerManager pagerManager = getPagerManager();
pagerManager.updatePager(getSearchRequest(), getRemoteUser());
pagerManager.getPager().setCurrentKey(issue.getString("key"));

I've attached a patch as well as a compiled ViewIssue.class (tested on JIRA 3.8.1. Use on any other version of JIRA at your own risk) to this issue. To deploy the patched class file do the following:

  1. Shutdown your JIRA instance.
  2. Backup atlassian-jira/WEB-INF/classes/com/atlassian/jira/web/action/issue/ViewIssue.class to atlassian-jira/WEB-INF/classes/com/atlassian/jira/web/action/issue/ViewIssue.OLD
  3. Copy the attached ViewIssue.class to atlassian-jira/WEB-INF/classes/com/atlassian/jira/web/action/issue/
  4. Restart JIRA

Jed Wesley-Smith [Atlassian] added a comment - 06/Dec/07 08:00 PM

The fix for this issue has not been able to make it into JIRA v3.12. We are hoping to incorporate it into v3.12.1. As of writing however, there are 163 items scheduled as Fix For v3.12.1. We will not be able to include all of them.


Aggelos Paraskevopoulos added a comment - 04/Jun/08 03:58 AM

Any news about when this will be implemented?


Dushan Hanuska [Atlassian] added a comment - 04/Jun/08 05:22 AM - edited

Aggelos, this issue is on our to-do list, however no fix date has been set for it yet.


Aggelos Paraskevopoulos added a comment - 04/Jun/08 05:53 AM

Thanks for the update Dushan. We have a customer with 150K issues db and we are getting some negative feedback on the performance front. So an improvement on this area would certainly help. I know that returning large resultsets and browsing though them, is not the right way to use JIRA, but in a 1000+ user base is not that easy to enforce best practices.


Deniz Turkoglu added a comment - 21/Nov/08 10:50 AM

I have created a patch for PagerManager to limit the number of searches the pager object can handle. It is hardcoded to 100 but feel free to change it. We didn't want the database to slow down on large queries and wanted to have the pager for small datasets. I hope this one proves to be useful for someone.

Patch src/java/com/atlassian/jira/issue/pager/PagerManager.java from jira top directory. This patch was created for JIRA 3.13.1.


Nick Menere [Atlassian] added a comment - 07/Jan/09 05:27 PM

Hi all, this has been fixed.

I have committed a fix to 3.13.3 that should improve times significantly. Though for 4.0 I went a step further and the performance is crazy fast. Even for 150K issues it was taking less than a second on my local machine.

Cheers,
Nick Menere

JIRA Developer


Markus added a comment - 03/Feb/09 01:30 AM

Hi!

We installed this patch on jira 3.13 on Atlassian support advice.

The patch results in that sub tasks stops working, due to patch beeing incompatible with 3.13.

Is there a patch available for jira 3.13?

Please attach it to this issue.

Kind regards,
Markus


Jonathan Costello [Atlassian] added a comment - 03/Feb/09 06:43 PM

There is now a patch to versions 3.13 or high. The file is zipped.