# Memory management

**URL:** <https://discuss.elastic.co/t/memory-management/10056>\
**Category:** Elasticsearch\
**Created:** [December 12, 2012, 6:56pm UTC](https://discuss.elastic.co/t/memory-management/10056 "2012-12-12T18:56:16Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marcin\_Dojwa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marcin_dojwa/32/2307_2.png) [@Marcin\_Dojwa](https://discuss.elastic.co/u/Marcin_Dojwa)\
**Post date:** [December 12, 2012, 6:56pm UTC](https://discuss.elastic.co/t/memory-management/10056/1 "2012-12-12T18:56:16Z")

</div>

Hi,

Heap-Memory in my ES nodes still increases while filter and field cache is  
bounded. Filter cache is max 800MB, field cache is max 1.4GB (I check it in  
bigdesk plugin). Heap-Memory grows up to 7.9GB (max) after few hours and I  
get OutOfMemory exceptions (because field cache is resident). What else can  
take memory in ES and how to control it ?

Thank you.  
Best regards.  
Marcin Dojwa.

--

---

<div class="post-metadata">

**Author:** ![ferhatsb](https://avatars.discourse-cdn.com/v4/letter/f/977dab/32.png) [@ferhatsb](https://discuss.elastic.co/u/ferhatsb)\
**Post date:** [December 13, 2012, 9:01pm UTC](https://discuss.elastic.co/t/memory-management/10056/2 "2012-12-13T21:01:23Z")

</div>

Hi,

That may help [ElasticSearch Cache Usage - Sematext](http://blog.sematext.com/2012/05/17/elasticsearch-cache-usage/)

Best,

Ferhat  
[www.searchbox.io](http://www.searchbox.io)

On Wednesday, December 12, 2012 8:56:16 PM UTC+2, Marcin Dojwa wrote:

> Hi,
> 
> Heap-Memory in my ES nodes still increases while filter and field cache is  
> bounded. Filter cache is max 800MB, field cache is max 1.4GB (I check it in  
> bigdesk plugin). Heap-Memory grows up to 7.9GB (max) after few hours and I  
> get OutOfMemory exceptions (because field cache is resident). What else can  
> take memory in ES and how to control it ?
> 
> Thank you.  
> Best regards.  
> Marcin Dojwa.

--

---

<div class="post-metadata">

**Author:** ![Marcin\_Dojwa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marcin_dojwa/32/2307_2.png) [@Marcin\_Dojwa](https://discuss.elastic.co/u/Marcin_Dojwa)\
**Post date:** [December 14, 2012, 6:23am UTC](https://discuss.elastic.co/t/memory-management/10056/3 "2012-12-14T06:23:55Z")

</div>

Hi, thanks, unfortunatelly this does not help ☹ all the caches are bounded  
and monitored. I think the problem is in GC that frees memory too late and  
field cache does not have enough memory to allocate. I will experiment with  
G1, maybe this would help combaining with soft field cache.

Best regards

W dniu czwartek, 13 grudnia 2012 użytkownik ferhatsb napisał:

> Hi,
> 
> That may help  
> [ElasticSearch Cache Usage - Sematext](http://blog.sematext.com/2012/05/17/elasticsearch-cache-usage/)
> 
> Best,
> 
> Ferhat  
> [www.searchbox.io](http://www.searchbox.io)
> 
> On Wednesday, December 12, 2012 8:56:16 PM UTC+2, Marcin Dojwa wrote:
> 
> > Hi,
> > 
> > Heap-Memory in my ES nodes still increases while filter and field cache  
> > is bounded. Filter cache is max 800MB, field cache is max 1.4GB (I check it  
> > in bigdesk plugin). Heap-Memory grows up to 7.9GB (max) after few hours and  
> > I get OutOfMemory exceptions (because field cache is resident). What else  
> > can take memory in ES and how to control it ?
> > 
> > Thank you.  
> > Best regards.  
> > Marcin Dojwa.
> 
> --

--

---

<div class="post-metadata">

**Author:** ![otisg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/otisg/32/492_2.png) [@otisg](https://discuss.elastic.co/u/otisg)\
**Post date:** [December 15, 2012, 4:21am UTC](https://discuss.elastic.co/t/memory-management/10056/4 "2012-12-15T04:21:17Z")

</div>

Hi,

Last time I tried G1 while helping a client with performance was maybe a  
year ago. It did worse than what we were able to achieve with other  
garbage collectors and various JVM params to control when GC kicks in and  
such. If memory serves me well, SurvivorRatio helped us a lot.

Have a look  
at [http://jprante.github.com/2012/11/28/Elasticsearch-Java-Virtual-Machine-settings-explained.html](http://jprante.github.com/2012/11/28/Elasticsearch-Java-Virtual-Machine-settings-explained.html)

## Otis

ELASTICSEARCH Performance Monitoring - [Sematext Monitoring | Infrastructure Monitoring Service](http://sematext.com/spm/index.html)  
Search Analytics - [Cloud Monitoring Tools & Services | Sematext](http://sematext.com/search-analytics/index.html)

On Friday, December 14, 2012 1:23:55 AM UTC-5, Marcin Dojwa wrote:

> Hi, thanks, unfortunatelly this does not help ☹ all the caches are  
> bounded and monitored. I think the problem is in GC that frees memory too  
> late and field cache does not have enough memory to allocate. I will  
> experiment with G1, maybe this would help combaining with soft field cache.
> 
> Best regards
> 
> W dniu czwartek, 13 grudnia 2012 użytkownik ferhatsb napisał:
> 
> > Hi,
> > 
> > That may help  
> > [Sematext ElasticSearch Services](http://blog.sematext.com/2012/05/17/elasticsearch-cache-usage/)
> > 
> > Best,
> > 
> > Ferhat  
> > [www.searchbox.io](http://www.searchbox.io)
> > 
> > On Wednesday, December 12, 2012 8:56:16 PM UTC+2, Marcin Dojwa wrote:
> > 
> > > Hi,
> > > 
> > > Heap-Memory in my ES nodes still increases while filter and field cache  
> > > is bounded. Filter cache is max 800MB, field cache is max 1.4GB (I check it  
> > > in bigdesk plugin). Heap-Memory grows up to 7.9GB (max) after few hours and  
> > > I get OutOfMemory exceptions (because field cache is resident). What else  
> > > can take memory in ES and how to control it ?
> > > 
> > > Thank you.  
> > > Best regards.  
> > > Marcin Dojwa.
> > 
> > --

--

---

<div class="post-metadata">

**Author:** ![Marcin\_Dojwa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marcin_dojwa/32/2307_2.png) [@Marcin\_Dojwa](https://discuss.elastic.co/u/Marcin_Dojwa)\
**Post date:** [December 15, 2012, 9:43am UTC](https://discuss.elastic.co/t/memory-management/10056/5 "2012-12-15T09:43:17Z")

</div>

Hi,

Thank you. I set the following parameters:  
-XX:SurvivorRatio=3  
-XX:+UseConcMarkSweepGC  
-XX:+UseParNewGC  
-XX:+CMSIncrementalMode

and it seems it works fine now. I continue testing to check if it works, if  
not I will continue playing with GC settings 🙂

Best regards.  
Marcin Dojwa

2012/12/15 Otis Gospodnetic [otis.gospodnetic@gmail.com](mailto:otis.gospodnetic@gmail.com)

> Hi,
> 
> Last time I tried G1 while helping a client with performance was maybe a  
> year ago. It did worse than what we were able to achieve with other  
> garbage collectors and various JVM params to control when GC kicks in and  
> such. If memory serves me well, SurvivorRatio helped us a lot.
> 
> Have a look at  
> [http://jprante.github.com/2012/11/28/Elasticsearch-Java-Virtual-Machine-settings-explained.html](http://jprante.github.com/2012/11/28/Elasticsearch-Java-Virtual-Machine-settings-explained.html)
> 
> ## Otis
> 
> ELASTICSEARCH Performance Monitoring - [Sematext Monitoring | Infrastructure Monitoring Service](http://sematext.com/spm/index.html)  
> Search Analytics - [Cloud Monitoring Tools & Services | Sematext](http://sematext.com/search-analytics/index.html)
> 
> On Friday, December 14, 2012 1:23:55 AM UTC-5, Marcin Dojwa wrote:
> 
> > Hi, thanks, unfortunatelly this does not help ☹ all the caches are  
> > bounded and monitored. I think the problem is in GC that frees memory too  
> > late and field cache does not have enough memory to allocate. I will  
> > experiment with G1, maybe this would help combaining with soft field cache.
> > 
> > Best regards
> > 
> > W dniu czwartek, 13 grudnia 2012 użytkownik ferhatsb napisał:
> > 
> > > Hi,
> > > 
> > > That may help [http://blog.sematext.com/2012/\*\*05/17/elasticsearch-cache-](http://blog.sematext.com/2012/**05/17/elasticsearch-cache-)  
> > > \*\*usage/[http://blog.sematext.com/2012/05/17/elasticsearch-cache-usage/](http://blog.sematext.com/2012/05/17/elasticsearch-cache-usage/)
> > > 
> > > Best,
> > > 
> > > Ferhat  
> > > [www.searchbox.io](http://www.searchbox.io)
> > > 
> > > On Wednesday, December 12, 2012 8:56:16 PM UTC+2, Marcin Dojwa wrote:
> > > 
> > > > Hi,
> > > > 
> > > > Heap-Memory in my ES nodes still increases while filter and field cache  
> > > > is bounded. Filter cache is max 800MB, field cache is max 1.4GB (I check it  
> > > > in bigdesk plugin). Heap-Memory grows up to 7.9GB (max) after few hours and  
> > > > I get OutOfMemory exceptions (because field cache is resident). What else  
> > > > can take memory in ES and how to control it ?
> > > > 
> > > > Thank you.  
> > > > Best regards.  
> > > > Marcin Dojwa.
> > > 
> > > --
> > 
> > --

--

---

<div class="post-metadata">

**Author:** ![Marcin\_Dojwa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marcin_dojwa/32/2307_2.png) [@Marcin\_Dojwa](https://discuss.elastic.co/u/Marcin_Dojwa)\
**Post date:** [December 15, 2012, 10:06am UTC](https://discuss.elastic.co/t/memory-management/10056/6 "2012-12-15T10:06:31Z")

</div>

I've just read that CMSIncrementalMode is good for low processors number. I  
removed that and check how it works.

2012/12/15 Marcin Dojwa [m.dojwa@livechatinc.com](mailto:m.dojwa@livechatinc.com)

> CMSIncrementalMode

--

---

<div class="post-metadata">

**Author:** ![revdev](https://avatars.discourse-cdn.com/v4/letter/r/ecb155/32.png) [@revdev](https://discuss.elastic.co/u/revdev)\
**Post date:** [December 31, 2012, 8:23pm UTC](https://discuss.elastic.co/t/memory-management/10056/7 "2012-12-31T20:23:22Z")

</div>

From  
here [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/index-modules/cache.html:)

index.cache.field.max\_sizeThe max size (count, not byte size) of the cache  
(per search segment in a shard). Defaults to not set (-1).It's a count  
which is the number of documents per segment and not total size in bytes.  
Hope that helps.

On Saturday, December 15, 2012 2:06:31 AM UTC-8, Marcin Dojwa wrote:

> I've just read that CMSIncrementalMode is good for low processors number.  
> I removed that and check how it works.
> 
> 2012/12/15 Marcin Dojwa \<[m.d...@livechatinc.com](mailto:m.d...@livechatinc.com) \<javascript:\>\>
> 
> > CMSIncrementalMode

--

---

<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, 2:58am UTC](https://discuss.elastic.co/t/memory-management/10056/8 "2017-07-06T02:58:06Z")

</div>


