# I use mmapfs storage type, but es cluster doesn't use available memory

**URL:** https://discuss.elastic.co/t/i-use-mmapfs-storage-type-but-es-cluster-doesnt-use-available-memory/35261
**Category:** Elasticsearch
**Created:** [November 23, 2015, 4:04am UTC](https://discuss.elastic.co/t/i-use-mmapfs-storage-type-but-es-cluster-doesnt-use-available-memory/35261 "2015-11-23T04:04:24Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![t7s](https://avatars.discourse-cdn.com/v4/letter/t/b38774/32.png) [@t7s](https://discuss.elastic.co/u/t7s)
#### Post date: [November 23, 2015, 4:04am UTC](https://discuss.elastic.co/t/i-use-mmapfs-storage-type-but-es-cluster-doesnt-use-available-memory/35261/1 "2015-11-23T04:04:24Z")

</div>

I have a es cluster with 70gb data, using mmapfs. There is a lot of available memory, but es cluster don't use so performance is not good

5 servers  
-Xms32g -Xmx32g -XX:PermSize=1000m -XX:MaxPermSize=1000m -XX:NewSize=3000m -XX:MaxNewSize=3000m -XX:MaxDirectMemorySize=2000m  
vm.max\_map\_count: 262144  
max\_file\_descriptors: 512000

cluster info  
Nodes: 5 Indices: 9 Shards: 80 Data: 71.56 GB CPU: 10% Memory: 7.73 GB / 158.54 GB

How can I force es to use available memory

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [November 23, 2015, 4:11am UTC](https://discuss.elastic.co/t/i-use-mmapfs-storage-type-but-es-cluster-doesnt-use-available-memory/35261/2 "2015-11-23T04:11:09Z")

</div>

`mmapfs` isn't memory based storage for your indices.  
See [https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules-store.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules-store.html)

---

<div class="post-metadata">

### Author: ![t7s](https://avatars.discourse-cdn.com/v4/letter/t/b38774/32.png) [@t7s](https://discuss.elastic.co/u/t7s)
#### Post date: [November 23, 2015, 4:34am UTC](https://discuss.elastic.co/t/i-use-mmapfs-storage-type-but-es-cluster-doesnt-use-available-memory/35261/3 "2015-11-23T04:34:18Z")

</div>

I know, but can I force as more as possible index data to memory using mmapfs ?  
I have another es cluster using mmapfs, I think it take advantage of available memory so the search time is very low.

another es cluster info:  
Nodes: 40 Indices: 14 Shards: 868 Data: 265.25 GB CPU: 6300% Memory: 1.32 TB / 2.72 TB

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [November 23, 2015, 4:37am UTC](https://discuss.elastic.co/t/i-use-mmapfs-storage-type-but-es-cluster-doesnt-use-available-memory/35261/4 "2015-11-23T04:37:00Z")

</div>

> [@t7s](#):
>
> I know, but can I force as more as possible index data to memory using mmapfs ?

It doesn't index to memory, that is what I mean. It might just be terminology but it's important here.

Heap, and memory, is used in different ways so this isn't something that can be easily answered.  
What sort of data is it? What sort of queries? How often do they run? Are you using warmers?

---

<div class="post-metadata">

### Author: ![t7s](https://avatars.discourse-cdn.com/v4/letter/t/b38774/32.png) [@t7s](https://discuss.elastic.co/u/t7s)
#### Post date: [November 23, 2015, 5:11am UTC](https://discuss.elastic.co/t/i-use-mmapfs-storage-type-but-es-cluster-doesnt-use-available-memory/35261/5 "2015-11-23T05:11:25Z")

</div>

It doesn't index to memory, but I think the index using mmapfs is also in the memory

The MMap FS type stores the shard index on the file system (maps to Lucene MMapDirectory) by **mapping a file into memory (mmap)**. Memory mapping uses up a portion of the virtual memory address space in your process equal to the size of the file being mapped. Before using this class, be sure you have allowed plenty of virtual address space.

There are many warmer but feeling useless, the search time is not low as my another es cluster

---

<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: [November 23, 2015, 8:22am UTC](https://discuss.elastic.co/t/i-use-mmapfs-storage-type-but-es-cluster-doesnt-use-available-memory/35261/6 "2015-11-23T08:22:44Z")

</div>

Yes, mmapfs is using virtual memory. It is not using memory. That is an important difference.

Why do you think that you can blame mmapfs?

Look at slowest part of I/O and bottlenecks first and what workload pattern you exercise on the machines, they all create different requirements.

Note that `-XX:MaxDirectMemorySize=2000m` is a very tight restriction. Why do you select this setting?

Also you should not change GC settings, it will make your JVM much slower.

---

<div class="post-metadata">

### Author: ![t7s](https://avatars.discourse-cdn.com/v4/letter/t/b38774/32.png) [@t7s](https://discuss.elastic.co/u/t7s)
#### Post date: [November 23, 2015, 8:32am UTC](https://discuss.elastic.co/t/i-use-mmapfs-storage-type-but-es-cluster-doesnt-use-available-memory/35261/7 "2015-11-23T08:32:13Z")

</div>

I don't blame mmapfs, I am sure mmapfs type is high performance because of my another es cluster. I am just curious to why es process not to take available memory. Although I set the xms jvm args

Now I solve the problem:

> ulimit -m unlimited

Then everything is ok

---

<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: [November 23, 2015, 9:03am UTC](https://discuss.elastic.co/t/i-use-mmapfs-storage-type-but-es-cluster-doesnt-use-available-memory/35261/8 "2015-11-23T09:03:37Z")

</div>

> [@t7s](#):
>
> ulimit -m unlimited

This is just a temporary solution. For permanent change, please add the following to `/etc/security/limits.conf`

```auto
es soft memlock unlimited
es hard memlock unlimited

```

where `es` is the assumed Elasticsearch user. Do not forget to re-login the user to enable the settings.

---

<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, 11:36pm UTC](https://discuss.elastic.co/t/i-use-mmapfs-storage-type-but-es-cluster-doesnt-use-available-memory/35261/9 "2017-07-05T23:36:40Z")

</div>


