# How to debug why memory is not locking in ES5?

**URL:** <https://discuss.elastic.co/t/how-to-debug-why-memory-is-not-locking-in-es5/74344>\
**Category:** Elasticsearch\
**Created:** [February 8, 2017, 8:59am UTC](https://discuss.elastic.co/t/how-to-debug-why-memory-is-not-locking-in-es5/74344 "2017-02-08T08:59:20Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aivars\_Irmejs](https://avatars.discourse-cdn.com/v4/letter/a/e9a140/32.png) [@Aivars\_Irmejs](https://discuss.elastic.co/u/Aivars_Irmejs)\
**Post date:** [February 8, 2017, 8:59am UTC](https://discuss.elastic.co/t/how-to-debug-why-memory-is-not-locking-in-es5/74344/1 "2017-02-08T08:59:20Z")

</div>

I was forced to change a server recently and I upgraded to ES5.2.0 in process. I'm trying to lock memory and although there are no errors in the log, the memory does not seem to be locked at all.

Process command line looks like this:

/usr/bin/java -Xms1300m -Xmx1300m -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -server -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -Djdk.io.permissionsUseCanonicalPath=true -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Dlog4j.skipJansi=true -XX:+HeapDumpOnOutOfMemoryError -Des.path.home=/opt/elasticsearch-5.2.0 -cp /opt/elasticsearch-5.2.0/lib/elasticsearch-5.2.0.jar:/opt/elasticsearch-5.2.0/lib/\* org.elasticsearch.bootstrap.Elasticsearch -d

I don't have "Unable to lock JVM Memory" in log (I did have it before settings limits.conf).

curl -XGET 'localhost:9200/\_nodes?filter\_path=\*\*.mlockall&pretty' returns:  
{  
"nodes" : {  
"g-ioub2QRcuWjL4DRBcuxw" : {  
"process" : {  
"mlockall" : true  
}  
}  
}  
}

What else could I be missing? Why is there no error but the memory still does not lock? Could the error be somewhere else? Thanks.

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [February 8, 2017, 12:08pm UTC](https://discuss.elastic.co/t/how-to-debug-why-memory-is-not-locking-in-es5/74344/2 "2017-02-08T12:08:07Z")

</div>

Can you explain how you determine the process memory is not locked? What operating system is it? What kind of server?

---

<div class="post-metadata">

**Author:** ![Aivars\_Irmejs](https://avatars.discourse-cdn.com/v4/letter/a/e9a140/32.png) [@Aivars\_Irmejs](https://discuss.elastic.co/u/Aivars_Irmejs)\
**Post date:** [February 8, 2017, 12:24pm UTC](https://discuss.elastic.co/t/how-to-debug-why-memory-is-not-locking-in-es5/74344/3 "2017-02-08T12:24:39Z")

</div>

Thanks for replying.

The server has KiB Mem : 3407872 total. I have -Xms1300m -Xmx1300m configured, yet ES process uses 60% memory at this moment (and it's rising).

OS = CentOS Linux release 7.3.1611, it's a VPS.

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [February 8, 2017, 12:36pm UTC](https://discuss.elastic.co/t/how-to-debug-why-memory-is-not-locking-in-es5/74344/4 "2017-02-08T12:36:16Z")

</div>

So it's still not clear how you determined whether the memory of the ES process is locked or not.

Maybe you have a misunderstanding regarding mlockall. It means large parts of the ES process reside in memory and does not swap out to disk - which is not clear from your info.

Use the command `cat /proc/<espid>/status | grep VmLck` where `<espid>` is the ES JVM process ID to determine the amount of process memory locked.

---

<div class="post-metadata">

**Author:** ![Aivars\_Irmejs](https://avatars.discourse-cdn.com/v4/letter/a/e9a140/32.png) [@Aivars\_Irmejs](https://discuss.elastic.co/u/Aivars_Irmejs)\
**Post date:** [February 8, 2017, 1:16pm UTC](https://discuss.elastic.co/t/how-to-debug-why-memory-is-not-locking-in-es5/74344/5 "2017-02-08T13:16:07Z")

</div>

This is what I get:

cat /proc/1861/status | grep VmLck  
VmLck: 1703668 kB

It should be less than that, shouldn't it?

---

<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:** [March 8, 2017, 1:16pm UTC](https://discuss.elastic.co/t/how-to-debug-why-memory-is-not-locking-in-es5/74344/6 "2017-03-08T13:16:13Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
