How to make sure Solr/Lucene won't die with java.lang.OutOfMemoryError?

前端 未结 8 673
失恋的感觉
失恋的感觉 2021-02-04 06:31

I\'m really puzzled why it keeps dying with java.lang.OutOfMemoryError during indexing even though it has a few GBs of memory.

Is there a fundamental reason why it needs

8条回答
  •  情话喂你
    2021-02-04 07:01

    I'm not certain there is a steadfast way to ensure you won't run into OutOfMemoryExceptions with Lucene. The problem you are facing is problem related to the use of FieldCache. From the Lucene API "Maintains caches of term values.". If your terms exceed the amount of memory allocated to the JVM you'll get the exception.

    The documents are being sorted "at org.apache.lucene.search.FieldComparator$StringOrdValComparator.setNextReader(FieldComparator.java:667)", which will take up as much memory as is needed to store the terms being sorted for the index.

    You'll need to review projected size of the fields that are sortable and adjust the JVM settings accordingly.

提交回复
热议问题