# JVM heap sizing when using MEMORY index

**URL:** <https://discuss.elastic.co/t/jvm-heap-sizing-when-using-memory-index/6379>\
**Category:** Elasticsearch\
**Created:** [January 14, 2012, 12:21am UTC](https://discuss.elastic.co/t/jvm-heap-sizing-when-using-memory-index/6379 "2012-01-14T00:21:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![derrickburns](https://avatars.discourse-cdn.com/v4/letter/d/50afbb/32.png) [@derrickburns](https://discuss.elastic.co/u/derrickburns)\
**Post date:** [January 14, 2012, 12:21am UTC](https://discuss.elastic.co/t/jvm-heap-sizing-when-using-memory-index/6379/1 "2012-01-14T00:21:35Z")

</div>

What is the recommended JVM heap size when using a MEMORY based index with  
the index stored OUTSIDE the JVM heap?

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [January 14, 2012, 4:11pm UTC](https://discuss.elastic.co/t/jvm-heap-sizing-when-using-memory-index/6379/2 "2012-01-14T16:11:16Z")

</div>

Same as if you would have stored the index on the file system.

On Sat, Jan 14, 2012 at 2:21 AM, Derrick [derrickrburns@gmail.com](mailto:derrickrburns@gmail.com) wrote:

> What is the recommended JVM heap size when using a MEMORY based index with  
> the index stored OUTSIDE the JVM heap?

---

<div class="post-metadata">

**Author:** ![derrickburns](https://avatars.discourse-cdn.com/v4/letter/d/50afbb/32.png) [@derrickburns](https://discuss.elastic.co/u/derrickburns)\
**Post date:** [January 16, 2012, 7:30pm UTC](https://discuss.elastic.co/t/jvm-heap-sizing-when-using-memory-index/6379/3 "2012-01-16T19:30:58Z")

</div>

Should I configure the memory for the index to be OUTSIDE the JVM heap? If  
so, then how big should the heap be?

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [January 17, 2012, 9:44am UTC](https://discuss.elastic.co/t/jvm-heap-sizing-when-using-memory-index/6379/4 "2012-01-17T09:44:31Z")

</div>

You can either configure the memory index to be outside the heap or not  
(the direct flag). If its outside the heap, then you need to configure  
-XX:MaxDirectMemorySize  
to the max value of that index. If its outside the heap, then you will need  
to allocate to ES heap memory the same value that you would have set if it  
was using a file based index (that value depends on what you do with the  
index, like if you do sorting/faceting for example).

I would suggest not using in memory indices to start with, do you really  
need it? You can configure the index store to be mmapfs (index.store.type)  
which will use memory mapped files in this case.

On Mon, Jan 16, 2012 at 9:30 PM, Derrick [derrickrburns@gmail.com](mailto:derrickrburns@gmail.com) wrote:

> Should I configure the memory for the index to be OUTSIDE the JVM heap?  
> If so, then how big should the heap be?

---

<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, 3:42am UTC](https://discuss.elastic.co/t/jvm-heap-sizing-when-using-memory-index/6379/5 "2017-07-06T03:42:32Z")

</div>

Closed on July 6, 2017, 3:42am UTC


