Elastic not using all RAM

I have a Ubuntu server with 4GB RAM. After starting kibana and logstash the server have 2.5GB of available RAM. When i try to start elasticsearch service with -Xms1g -Xmx1g it wont start and log the following error

There is insufficient memory for the Java Runtime Environment to continue. Native memory allocation (mmap) failed to map 1073741824 bytes for committing reserved memory.

If I try to lower the heap sizes to 512m or lower it will start, after a couple of minutes the service stop with similar error even if I have half of the memory available.
It look like JVM is not using all the available memory.

Any help is appreciated.


Lucene (and so elasticsearch) uses MMAP technology in order to cache files into available system memory. It looks like with Kibana and logstash already started your server does not have enough memory in order to allow elasticsearch to start with a 1gb initial heap size and use mmap.
Can you try to reduce logstach and elasticsearch JVM HEAP and see it elasticsearch starts ?




I see you already tried to reduce elasticsearch heap size, but by default :

  • kibana memory limit is configured to 4Gb (nodes.options),
  • logstach also use by default -Xms1g and -Xmx1g in its jvm.options file

So after a few minutes even with -Xmx256m for elasticserach, you can have nearly 3Gb or more used by kibana + logstach + elasticsearch. The error message says elasticsearch is trying to map 1Gb in system memory. I guess you really need more 4Gb in order to run the all Elastic Stack on one single server.