# Beginning Question: Memory consumption while idle

**URL:** <https://discuss.elastic.co/t/beginning-question-memory-consumption-while-idle/21816>\
**Category:** Elasticsearch\
**Created:** [January 24, 2015, 2:33pm UTC](https://discuss.elastic.co/t/beginning-question-memory-consumption-while-idle/21816 "2015-01-24T14:33:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![austin\_lee](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@austin\_lee](https://discuss.elastic.co/u/austin_lee)\
**Post date:** [January 24, 2015, 2:33pm UTC](https://discuss.elastic.co/t/beginning-question-memory-consumption-while-idle/21816/1 "2015-01-24T14:33:31Z")

</div>

I'm doing some initial POC with es building a single index into elastic  
search. Here is my setup running elastic search out of the box while  
chanting the memory params.

JVM: Java 7 jre 1.7\_76  
GC: CMS  
OS: Windows 7  
OS Mem: 32 GB  
ES mem: 10 GB  
Index Size: 3.8 GB

# of docs in index: 159,316,035

Single node cluster.  
5 primary shards are assigned to this cluster each approx (800mb).

After consuming the log file and doing nothing else (ie no queries are  
executed) I notice two things in regards to memory usage. 1) The memory  
usage spikes up to 10GB and never goes back down. 2) Restarting ES will  
trim down the mem usage back down toward 4.5GG (4.2 of that is for old gen).

Using the RESTful api and Marvell, I've been trying to figure out why the  
memory usage is this high when I haven't executed any searches yet.  
Essentially all that my cluster is doing is creating a single index large  
index and just idling. No searches have ever been requested against this  
cluster.

My impression is the ElasticSearch is loading the index into memory, which  
leads me to believe either I'm doing something wrong or this is expected  
behavior. My initial impression was that Elastic search wouldn't by default  
attempt to load an index into memory unless a search request against the  
index is required but I may be wrong on that.

If anyone know can explain what I'm doing wrong it would be greatly  
appreciated.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/526dc4a5-b433-43d8-987e-5274870f2356%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/526dc4a5-b433-43d8-987e-5274870f2356%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![austin\_lee](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@austin\_lee](https://discuss.elastic.co/u/austin_lee)\
**Post date:** [January 24, 2015, 3:23pm UTC](https://discuss.elastic.co/t/beginning-question-memory-consumption-while-idle/21816/2 "2015-01-24T15:23:17Z")

</div>

Reading some more and running vmmap to confirm, looks to be memory mapped  
file store which is the default for win 64 systems.

On Saturday, January 24, 2015 at 6:33:31 AM UTC-8, austin lee wrote:

> I'm doing some initial POC with es building a single index into elastic  
> search. Here is my setup running Elasticsearch out of the box while  
> chanting the memory params.
> 
> JVM: Java 7 jre 1.7\_76  
> GC: CMS  
> OS: Windows 7  
> OS Mem: 32 GB  
> ES mem: 10 GB  
> Index Size: 3.8 GB
> 
> # of docs in index: 159,316,035
> 
> Single node cluster.  
> 5 primary shards are assigned to this cluster each approx (800mb).
> 
> After consuming the log file and doing nothing else (ie no queries are  
> executed) I notice two things in regards to memory usage. 1) The memory  
> usage spikes up to 10GB and never goes back down. 2) Restarting ES will  
> trim down the mem usage back down toward 4.5GG (4.2 of that is for old gen).
> 
> Using the RESTful api and Marvell, I've been trying to figure out why the  
> memory usage is this high when I haven't executed any searches yet.  
> Essentially all that my cluster is doing is creating a single index large  
> index and just idling. No searches have ever been requested against this  
> cluster.
> 
> My impression is the Elasticsearch is loading the index into memory, which  
> leads me to believe either I'm doing something wrong or this is expected  
> behavior. My initial impression was that Elastic search wouldn't by default  
> attempt to load an index into memory unless a search request against the  
> index is required but I may be wrong on that.
> 
> If anyone know can explain what I'm doing wrong it would be greatly  
> appreciated.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/a8d0f85e-8fca-4e29-82d1-1839087992bb%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a8d0f85e-8fca-4e29-82d1-1839087992bb%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [January 24, 2015, 3:44pm UTC](https://discuss.elastic.co/t/beginning-question-memory-consumption-while-idle/21816/3 "2015-01-24T15:44:35Z")

</div>

You are likely observing how java heap works. Use a tool like jstat to  
check how much the heap is in use to see real usage. Nutshell: java never  
returns memory to the OS. You tell it a min it can use and it allocates  
that on startup. You tell it a max and it won't allocate more.

Memory mapping is another beast. That consumes tons of virtual memory which  
is virtually free on a 64 bit OS. It leaves the decision about which  
portion of the file stays in real memory mostly up to the OS.

Its all normal and safe.

Nik  
On Jan 24, 2015 7:23 AM, "austin lee" [austin7lee@gmail.com](mailto:austin7lee@gmail.com) wrote:

> Reading some more and running vmmap to confirm, looks to be memory mapped  
> file store which is the default for win 64 systems.
> 
> On Saturday, January 24, 2015 at 6:33:31 AM UTC-8, austin lee wrote:
> 
> > I'm doing some initial POC with es building a single index into elastic  
> > search. Here is my setup running Elasticsearch out of the box while  
> > chanting the memory params.
> > 
> > JVM: Java 7 jre 1.7\_76  
> > GC: CMS  
> > OS: Windows 7  
> > OS Mem: 32 GB  
> > ES mem: 10 GB  
> > Index Size: 3.8 GB
> > 
> > # of docs in index: 159,316,035
> > 
> > Single node cluster.  
> > 5 primary shards are assigned to this cluster each approx (800mb).
> > 
> > After consuming the log file and doing nothing else (ie no queries are  
> > executed) I notice two things in regards to memory usage. 1) The memory  
> > usage spikes up to 10GB and never goes back down. 2) Restarting ES will  
> > trim down the mem usage back down toward 4.5GG (4.2 of that is for old gen).
> > 
> > Using the RESTful api and Marvell, I've been trying to figure out why the  
> > memory usage is this high when I haven't executed any searches yet.  
> > Essentially all that my cluster is doing is creating a single index large  
> > index and just idling. No searches have ever been requested against this  
> > cluster.
> > 
> > My impression is the Elasticsearch is loading the index into memory,  
> > which leads me to believe either I'm doing something wrong or this is  
> > expected behavior. My initial impression was that Elastic search wouldn't  
> > by default attempt to load an index into memory unless a search request  
> > against the index is required but I may be wrong on that.
> > 
> > If anyone know can explain what I'm doing wrong it would be greatly  
> > appreciated.
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/a8d0f85e-8fca-4e29-82d1-1839087992bb%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a8d0f85e-8fca-4e29-82d1-1839087992bb%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/a8d0f85e-8fca-4e29-82d1-1839087992bb%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/a8d0f85e-8fca-4e29-82d1-1839087992bb%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAPmjWd01TYX3K\_79eJurMWXCVgDkCU-UnrXowQ%3DaQAYQ59k9NQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAPmjWd01TYX3K_79eJurMWXCVgDkCU-UnrXowQ%3DaQAYQ59k9NQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 12:36am UTC](https://discuss.elastic.co/t/beginning-question-memory-consumption-while-idle/21816/4 "2017-07-06T00:36:48Z")

</div>


