Elasticsearch off-heap memory

(Steel Crow) #1

Hi, guys!

I have some problem with memory consumption, I jope you will help me with it.

OS: RHEL 7.3
Elasticsearch 5.4
RAM: 8GB (real 7.6GB)
Clear install of EL
Nothing in index
Nothing else run on machine
Nothing request EL

JVM Heap set to 4GB
swap off
all descriptors, threads tuning by EL guide

And I meet something strange as for me

* ps -eo pid,ppid,cmd,comm=,rss,vsz,%mem,%cpu --sort=-%mem | head

PID      PPID                      CMD               RSS     VSZ       %MEM      %CPU
46433     1     /bin/java -Xms4g -Xmx4g -XX java   4661496 6906888      58.2      0.2

VSZ show that virt memory consumption is ~6.5GB

* free -m

         total       used        free        shared      buff/cache     available
Mem:     7815        4575         837          96         2401             2697

Show that only ~4.5GB is used

* curl -X GET ',ip,port,v,m,ram.current,ram.percent,ram.max'

id       ip     port   v       m ram.current  ram.percent  ram.max
aRwE 9300 5.4.0 *       6.8gb          89        7.6gb

EL think it use about ~6.8GB (89%MEM)

* top

KiB Mem : 65.6/8002828 
KiB Swap:  0.0/2097148 

  PID    USER   PR   NI   VIRT   RES    SHR   S  %CPU   %MEM     TIME+    COMMAND
46433  elastic+ 20   0  6906888 4.447g 125296 S   0.0   58.3     0:40.56   java

Top said that ~6.8GB (58.3%MEM) but from simple math 6.8GB/7.6GB * 100% = 89% (like in EL request)

Where the truth? EL virt memory include some buff/cash from system? If it isn't true, why that much memory consumption (~4gb HEAP) + 2.5 GB [for what?], if no index and data...

(David Roberts) #2

Does it help if you set the environment variable MALLOC_ARENA_MAX=2 before starting Elasticsearch? (Don't set this in the environment you use to run non-Java programs - try to limit it just to Java programs. There's more background here.)

(Steel Crow) #3

Thank you droberts195, I understood what's going on much clearer. But, does changing MALLOC_ARENA_MAX is a good choice if I have only ELK stack on machine? I thought Kibana is not Java app, am I wrong?

(David Roberts) #4

That's right, Kibana is not a Java program, so do not set MALLOC_ARENA_MAX when you run it. Each program has different environment variables, so (assuming it helps with your problem) you want to set MALLOC_ARENA_MAX=2 when starting Elasticsearch but not when starting Kibana. The exact way to do this will depend on how you start these programs.

(system) #5

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