Elastic search process memory consumption continuously increasing

I am using the elastic search 2.4.0 with java version "1.8.0_111" .

I have only indexed 100's of documents into 3 indexes and the total store size is around 100KB.

System configuration: 16 GB RAM.
ES Configuration:
ES_HEAP_SIZE = 7 GB
bootstrap.memory_lock = false, so I don't want elastic search to lock the memory.

Now elastic search process memory consumption is continuously increasing.
From last 2 days, memory consumption increased from 500 MB to 7.5 GB , It increases by around 4KB every second.

This is weird though there is not much data indexed in elastic search, why it has so high memory consumption.

jvm.mem.heap_used_in_bytes = 585293976 (~0.5 GB)
process.mem.total_virtual_in_bytes = 7699202048 (~7.69 GB)

Why process memory consumption is so high, though jvm heap size is quite low ?

Can the problem be memory leak in elastic search process ? Is there anyway to find it out ?

Virtual memory is really only address space (and a lot of magic behind the scenes in the OS and hardware to make it work). It's not necessarily the case that at any moment in time the entire used address space of a process is mapped to physical memory. For Elasticsearch, the used virtual memory will increase as the heap grows, and as Lucene index segments are memory mapped. There's nothing to worry about, what you really care about from the perspective of physical memory is the resident set size.

1 Like

Yes. You are right. We are not worried about virtual memory size.
We are concerned about the amount of physical memory consumed by Elasticsearch, even with less data indexed in ES. I am using process working set size in windows task manager to measure the RAM consumption of the process.

Probably I know the cause of the issue.
Assuming the below configuration,

ES_HEAP_SIZE = 7GB
As we know JVM divides the heap info young and old generation and default size of young generation is 1/3 of heap. JVM young generation maximum size = ~ 2GB . JVM doesn't do GC till young generation is filled.

So even when minimal amount of data is indexed in Elasticsearch (around 500MB) , still the RAM usage goes upto
2GB as GC is not done. And even after GC, JVM doesn't return the memory (RAM) to OS.

My question is can we tweak JVM parameters,

  1. So it can reduce the RAM usage when Elasticsearch has less data indexed.
    I know we can reduce the ES_HEAP_SIZE for this, but my requirement is I always set
    ES_HEAP_SIZE to half the machine memory, and Elasticsearch should use more RAM only with
    growing data indexed into it.

  2. After JVM performs the GC, it should return the memory to OS.
    Because I have a case when jvm heap size = ~200MB and process working set = ~2GB.

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