History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: JRA-10111
Type: Task Task
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Scott Farquhar [Atlassian]
Reporter: Jeff Turner [Atlassian]
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
JIRA

Remove JiraLuceneFieldCache cache

Created: 09/May/06 12:18 AM   Updated: Thursday 08:33 AM
Component/s: None
Affects Version/s: None
Fix Version/s: 3.6.2

Time Tracking:
Original Estimate: Not Specified
Remaining Estimate: 0 minutes
Time Spent - 10 minutes
Time Spent: 10 minutes
Time Spent - 10 minutes

Issue Links:
Reference
 

Participants: Alexey Efimov, Anton Mazkovoi [Atlassian], Jeff Turner [Atlassian] and Scott Farquhar [Atlassian]
Since last comment: 3 days ago
Resolution Date: 16/May/06 03:50 AM
Labels:


 Description  « Hide
We have a cache of lucene values in JiraLuceneFieldCache. Apparently this is not of much use, and it simply takes up memory (~280Mb of ~700 in a recent dump) - although it's a WeakHashMap so this memory would be reclaimed if necessary.

So we should disable this cache. This can be done simply be commenting out line 157:

cache.put(reader, readerCache);


 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Alexey Efimov - 16/Jul/08 12:08 PM - edited
Guys, you still not fixed it as good as we all needed this one.

Please look on com.atlassian.jira.issue.search.parameters.lucene.sort.JiraLuceneFieldCache - it is a smell class, please remove it all (synchronizations and dummy creation of objects not making GC happy).

Also please look onto com.atlassian.jira.issue.search.parameters.lucene.sort.MappedSortComparator - we have suddenly OutOfMemory errors for JIRA intensive using. See on field cachedValues - it is an array with size = number of issues in JIRA (in our case ~80000), total count of comparators ~45 in our case. 45 * 80000 with values ~260mb retain size objects in memory. But on everyone issue update, you must recreate all 45 comparators with 80000 arrays in each of them.

Please review this place again and make customers happy with out patches...

This comparator should compare values directly from Indexer, do not cache values.


Anton Mazkovoi [Atlassian] - 16/Jul/08 10:40 PM
Hi Alexey,

Removing the synchronization from JiraLuceneFieldCache is tracked via JRA-13296.

The memory consumption is a separate issue. Unfortuantely the way things are done now (creating arrays) is the way Lucene does sorting. The reason for this is speed. We have not measured the effects of this but as far as we know the speed is affected to a large degree if values are compared directly from Indexex as a trip to disk for the document needs to be made for each value.

We do plan to look at this in the future however at the moment I do not have a timeline for this. We will need to ensure that the changes that we make do not bring people's dashboards to a grinding hault.

Cheers,
Anton


Alexey Efimov - 17/Jul/08 03:57 AM
I'm guess, creation 260-280mb objects per everyoone issue update is too much speed affected issue as reading from index by doc offset (via RandomAccessFile, i suppose). And i'm realy think that it is will be faster. I'm not will patch JIRA for this, and will measure results. If it will OK, i'm notify you.

Scott Farquhar [Atlassian] - 17/Jul/08 08:33 AM
Alexey,

It should only create objects for the comparators that are actually used. So if people do sort by 45 different columns between issue updates, then it will load this into memory. However, most people only sort by a certain subset of fields.

It should be stored in a WeakHashMap, so if the sorts are not being used, then they will be reclaimed by memory. So it should not be a memory issue that you run into. We have seen memory issues if you have hundreds of people concurrently searching at the same time that you have issue updates, so there become many copies of this comparator in memory.

Another thing we could do is reduce the size of those objects in memory. I haven't looked at each sortcomparator, but there is a chance that we could store smaller objects in memory than we do. One example of how we do this is the text sort comparators, where we just store the first 30 bytes in memory, and not the entire text field. This optimisation may be able to be applied to other fields.

I'd love to see any results you get from looking into this. It has been a problem with other customers also, so any creative solutions we can brainstorm together would be great.