Server stopping by OutOfMemoryError: Java heap space

I'm using ElasticSearch 6.2 on a server with 4GB of RAM and 2 vCPUs.

Recently I have seen many errors of the type:

[ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [main-node] fatal error in thread [elasticsearch[main-node][search][T#4]], exiting

java.lang.OutOfMemoryError: Java heap space

[ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [main-node] fatal error in thread [Thread-11269], exiting

java.lang.OutOfMemoryError: Java heap space

If I increase the RAM of the server, for example, to 8GB and modify the value of the heap size (according to Article https://www.elastic.co/guide/en/elasticsearch/reference/6.2/heap-size.html). Will this correct the problem?

Hi,

it depends a bit what is causing your OutOfMemoryErrors. It might be because you are running very heavy aggregations that create too many aggregation buckets - in that case increasing the heap size might not help and only defer the problem. In general, increasing the heap size will give you more headroom though. If you stay on the same hardware, increasing the heap size means that there is less RAM available for the page cache though so it might be the case that see worse performance. In any case it is hard to accurately predict the impact and I recommend that you run targeted experiments to get hard data but I hope I could provide some pointers.

Daniel

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.