# Question on Memory store type

**URL:** https://discuss.elastic.co/t/question-on-memory-store-type/9895
**Category:** Elasticsearch
**Created:** [November 29, 2012, 6:53pm UTC](https://discuss.elastic.co/t/question-on-memory-store-type/9895 "2012-11-29T18:53:04Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Jae](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jae/32/791_2.png) [@Jae](https://discuss.elastic.co/u/Jae)
#### Post date: [November 29, 2012, 6:53pm UTC](https://discuss.elastic.co/t/question-on-memory-store-type/9895/1 "2012-11-29T18:53:04Z")

</div>

1. If Memory store type stores indexes in the main memory, does merging  
happen in the memory?

2. I saw some postings saying local gateway with Memory store type does not  
work. If I want to close the index with Memory store type and flush to the  
disk, which API can I call?

3. Is there any performance data of Memory store type compared to MMap FS  
and NIO FS?

4. I saw "outside of JVM heapspace". What does this exactly mean? If I use  
Memory store type, what is recommended JVM heap space setting? With FS  
store type, recommended setting is 50% to elasticsearch and 50% to OS disk  
cache.

Thank you!  
Best, Jae

--

---

<div class="post-metadata">

### Author: ![radu\_gheorghe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/radu_gheorghe/32/556_2.png) [@radu\_gheorghe](https://discuss.elastic.co/u/radu_gheorghe)
#### Post date: [November 30, 2012, 4:47pm UTC](https://discuss.elastic.co/t/question-on-memory-store-type/9895/2 "2012-11-30T16:47:00Z")

</div>

Hello Jae,

On Thu, Nov 29, 2012 at 8:53 PM, Jae [metacret@gmail.com](mailto:metacret@gmail.com) wrote:

> 1. If Memory store type stores indexes in the main memory, does merging  
> happen in the memory?

Yes, as far as I know.

> 1. I saw some postings saying local gateway with Memory store type does  
> not work.

Right. Local gateway assumes you have File System store with no memory  
caching. For consistency.

> If I want to close the index with Memory store type and flush to the disk,  
> which API can I call?

I don't think you can do that. But maybe someone else can confirm or show a  
way to do it.

> 1. Is there any performance data of Memory store type compared to MMap FS  
> and NIO FS?

I'm not aware of such benchmarks. But I assume results would depend heavily  
on lots of variables, like how often you'd index and search, how big are  
your documents and indices, how much RAM you have and how fast are the  
disks, etc.

> 1. I saw "outside of JVM heapspace". What does this exactly mean?

The in-memory index can be either stored in JVM's memory or outside of it.  
The default is to store it outside, since that should put less stress on  
the GC.

> If I use Memory store type, what is recommended JVM heap space setting?  
> With FS store type, recommended setting is 50% to elasticsearch and 50% to  
> OS disk cache.

It depends on the size of your index and the size of your memory. If you  
store it outside the JVM heap, you might do with less than 50%. If you  
store it inside, you'll probably need more. Ultimately, I think the best  
way to do is to run some performance tests while monitoring your cluster -  
especially in terms of memory and GC.

## Best regards, Radu

[http://sematext.com/](http://sematext.com/) -- Elasticsearch -- Solr -- Lucene

--

---

<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: [December 3, 2012, 6:11pm UTC](https://discuss.elastic.co/t/question-on-memory-store-type/9895/3 "2012-12-03T18:11:04Z")

</div>

On Thursday, November 29, 2012 7:53:04 PM UTC+1, Jae wrote:

> 1. I saw "outside of JVM heapspace". What does this exactly mean?

Note, "memory" is not necessarily equal to "heap". Elasticsearch extends  
Lucene by a custom memory index type implementation. "Outside of the JVM  
heap" in the docs refer to the method java.nio.ByteBuffer.allocateDirect()  
in this implementation, that is, the byte buffer is stored in direct access  
memory, a contiguous place for most efficient input/output by the operating  
system. The direct memory is not garbage collected.

Jörg

--

---

<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:01am UTC](https://discuss.elastic.co/t/question-on-memory-store-type/9895/4 "2017-07-06T03:01:46Z")

</div>


