# Mlockall vs ES\_HEAP\_SIZE

**URL:** <https://discuss.elastic.co/t/mlockall-vs-es-heap-size/57511>\
**Category:** Elasticsearch\
**Created:** [August 8, 2016, 5:44pm UTC](https://discuss.elastic.co/t/mlockall-vs-es-heap-size/57511 "2016-08-08T17:44:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maxwell\_Flanders](https://avatars.discourse-cdn.com/v4/letter/m/eb8c5e/32.png) [@Maxwell\_Flanders](https://discuss.elastic.co/u/Maxwell_Flanders)\
**Post date:** [August 8, 2016, 5:44pm UTC](https://discuss.elastic.co/t/mlockall-vs-es-heap-size/57511/1 "2016-08-08T17:44:07Z")

</div>

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??

Thanks!!

---

<div class="post-metadata">

**Author:** ![DiscussBuster](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/discussbuster/32/11042_2.png) [@DiscussBuster](https://discuss.elastic.co/u/DiscussBuster)\
**Post date:** [August 8, 2016, 6:27pm UTC](https://discuss.elastic.co/t/mlockall-vs-es-heap-size/57511/2 "2016-08-08T18:27:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 10:29pm UTC](https://discuss.elastic.co/t/mlockall-vs-es-heap-size/57511/3 "2017-07-05T22:29:18Z")

</div>


