# Mlockall vs vm.swappiness

**URL:** <https://discuss.elastic.co/t/mlockall-vs-vm-swappiness/10336>\
**Category:** Elasticsearch\
**Created:** [January 14, 2013, 7:19pm UTC](https://discuss.elastic.co/t/mlockall-vs-vm-swappiness/10336 "2013-01-14T19:19:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ppearcy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ppearcy/32/980_2.png) [@ppearcy](https://discuss.elastic.co/u/ppearcy)\
**Post date:** [January 14, 2013, 7:19pm UTC](https://discuss.elastic.co/t/mlockall-vs-vm-swappiness/10336/1 "2013-01-14T19:19:59Z")

</div>

We recently figured out that mlockall is not working for us. Unfortunately,  
even with setting common.jna logging level to debug, no message was getting  
printed out indicating this (it really would be nice to have a definitive  
yes/no mlockall worked in the logs).

For the moment, instead of locking the elasticsearch JVM heap in memory,  
we've set the vm.swappiness level to 0. Setting the swappiness level to 0  
does effect all processes, not just elasticsearch, but these machines are  
single purpose search boxes, so I doubt that will be a problem.

Anybody know if there any tradeoffs between the mlockall and vm.swappiness  
for dedicated search boxes?

Thanks!  
Paul

--

---

<div class="post-metadata">

**Author:** ![otisg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/otisg/32/492_2.png) [@otisg](https://discuss.elastic.co/u/otisg)\
**Post date:** [January 15, 2013, 4:21am UTC](https://discuss.elastic.co/t/mlockall-vs-vm-swappiness/10336/2 "2013-01-15T04:21:13Z")

</div>

Others can address the mlockall part, but I'll say that I set swappiness to  
0 on servers as soon as I get my hands on them and have never regretted it,  
but seen only positives - no swapping.

## Otis

Solr & Elasticsearch Support

> **[Sematext | IT System Monitoring Tools for DevOps](https://sematext.com/)**
>
> IT system monitoring and management tools for DevOps who need 24x7 live visibility into their infrastructure.

On Monday, January 14, 2013 2:19:59 PM UTC-5, ppearcy wrote:

> We recently figured out that mlockall is not working for us.  
> Unfortunately, even with setting common.jna logging level to debug, no  
> message was getting printed out indicating this (it really would be nice to  
> have a definitive yes/no mlockall worked in the logs).
> 
> For the moment, instead of locking the elasticsearch JVM heap in memory,  
> we've set the vm.swappiness level to 0. Setting the swappiness level to 0  
> does effect all processes, not just elasticsearch, but these machines are  
> single purpose search boxes, so I doubt that will be a problem.
> 
> Anybody know if there any tradeoffs between the mlockall and vm.swappiness  
> for dedicated search boxes?
> 
> Thanks!  
> Paul

--

---

<div class="post-metadata">

**Author:** ![ppearcy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ppearcy/32/980_2.png) [@ppearcy](https://discuss.elastic.co/u/ppearcy)\
**Post date:** [January 15, 2013, 6:36am UTC](https://discuss.elastic.co/t/mlockall-vs-vm-swappiness/10336/3 "2013-01-15T06:36:22Z")

</div>

Thanks Otis!

On Monday, January 14, 2013 9:21:13 PM UTC-7, Otis Gospodnetic wrote:

> Others can address the mlockall part, but I'll say that I set swappiness  
> to 0 on servers as soon as I get my hands on them and have never regretted  
> it, but seen only positives - no swapping.
> 
> ## Otis
> 
> Solr & Elasticsearch Support  
> [http://sematext.com/](http://sematext.com/)
> 
> On Monday, January 14, 2013 2:19:59 PM UTC-5, ppearcy wrote:
> 
> > We recently figured out that mlockall is not working for us.  
> > Unfortunately, even with setting common.jna logging level to debug, no  
> > message was getting printed out indicating this (it really would be nice to  
> > have a definitive yes/no mlockall worked in the logs).
> > 
> > For the moment, instead of locking the elasticsearch JVM heap in memory,  
> > we've set the vm.swappiness level to 0. Setting the swappiness level to 0  
> > does effect all processes, not just elasticsearch, but these machines are  
> > single purpose search boxes, so I doubt that will be a problem.
> > 
> > Anybody know if there any tradeoffs between the mlockall and  
> > vm.swappiness for dedicated search boxes?
> > 
> > Thanks!  
> > Paul

--

---

<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 6, 2017, 2:56am UTC](https://discuss.elastic.co/t/mlockall-vs-vm-swappiness/10336/4 "2017-07-06T02:56:26Z")

</div>


