# Question on segments in memory

**URL:** <https://discuss.elastic.co/t/question-on-segments-in-memory/21801>\
**Category:** Elasticsearch\
**Created:** [January 23, 2015, 4:28pm UTC](https://discuss.elastic.co/t/question-on-segments-in-memory/21801 "2015-01-23T16:28:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Han\_JU](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/han_ju/32/962_2.png) [@Han\_JU](https://discuss.elastic.co/u/Han_JU)\
**Post date:** [January 23, 2015, 4:28pm UTC](https://discuss.elastic.co/t/question-on-segments-in-memory/21801/1 "2015-01-23T16:28:44Z")

</div>

Hi,

Recently we experienced that some slow query and finally lots of the  
queries timeouted. We found that on some data nodes the heap usage is  
nearly \> 90% and GCs can not free much space.  
As we already marked many fields as doc values so at this time, the  
fielddata cache size is small (~ 100MB) but we found that there's lots of  
segments in memory and GCs seems not able to free them.

More precisely on data nodes we have 4GB heap and nearly 3GB is occupied by  
in memory segments. In the same time we checked that only a few (~5)  
segments are not committed.

Our questions are

- why we have these in memory segments in memory when they are all  
committed?
- why when there's pressure on the heap, GC can not free them?
- what brings these segments in memory? search, aggregation and maybe  
recovery process?

Thanks!

--  
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/05b2380d-7afe-4b43-822a-c5d1eeff2733%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/05b2380d-7afe-4b43-822a-c5d1eeff2733%40googlegroups.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:37am UTC](https://discuss.elastic.co/t/question-on-segments-in-memory/21801/2 "2017-07-06T00:37:01Z")

</div>

Closed on July 6, 2017, 12:37am UTC


