Hello,
How can I prevent ElasticSearch 1.7 from swapping when running inside a docker container?
I am running the container with the -memory-swap=-1 flag, and still seeing around 500 MB of swapping.
Is this normal?
Also tried to add bootstrap.mlockall: true to the elasticsearch.yml file, but then got the message: Unable to lock JVM memory (ENOMEM). This can result in part of the JVM being swapped out. Increase RLIMIT_MEMLOCK (ulimit).
Thanks.
There are 3 ways to achieve this, two of them require a system-wide change which I am currently not able to do.
Is there any way to do this from within a Docker container without affecting the whole server, and succeed?
Self-Answer:
I was using the wrong docker run flag.
To prevent swapping, you should use something like --memory-swappiness=0 --memory 40G --memory-swap 40G.
By stating the memory is X and memory+swap is X, you prevent swapping.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.