Mlockall vs ES_HEAP_SIZE

Hi there!

I've been trying to follow your recommended configurations for performance when setting up my ES cluster, by setting both the variable ES_HEAP_SIZE to half my available ram on a dedicated machine, and additionally, setting bootstrap.mlockall to true in the yml configuration file. However, running:

curl http://localhost:9200/_nodes/process?pretty

shows that mlockall is still false on all nodes.

From looking at other posts on this topic, I can see that I can probably fix the mlockall value by granting the elasticsearch user running ES memlock unlimited, however my question is this: if I have set the variable ES_HEAP_SIZE, do I still need to set mlockall to true?? Would I likely get performance increases from that, or are they simply different methods for acheiving the same goal of guaranteeing elasticsearch a set amount of memory??


mlockall allows the JVM to prevent the OS from swapping out memory in the range it has reserved for heap. The fact that Java was started with min heap equal to max heap doesn't accomplish that.

You could also just completely disable swap on your host. That would actually be even better than mlockall, because then nothing would be swapping.