Lucene uses org.apache.lucene.search.FieldCache to improve sort for text fields.
Lucene loads corresponding structures from disk into memory and stores in FieldCache.
That means the bigger the Lucene Fields (including Jira CustomFields) size the more memory will be required for them in JVM heap
- For large Jira instances (4+ mln issues) FieldCache might use up to 9GB+, which adds extra pressure for the JVM
Optimize memory usage of the FieldCache.
According to Lucene docs, those structures are gone in latest versions, so upgrade of Lucene 7+ should fix the problem.
Jira 8.0 no longer uses field caches to store lucene index parts in Java heap. They migrated this functionality to sth called Doc Values which does exactly the same but does not consume JVM heap space - it's all stored on disk and mmaped into process virtual memory.
Since memory usage is proportional to the size of the Lucene Fields, there are a couple of workarounds here, in the order of preference:
- Disable Lucene search index for unused CustomFields
- Reduce scope for CustomFields (limit for specific projects)