# Filter cache eviction cause lots of old gc and long stop

**URL:** <https://discuss.elastic.co/t/filter-cache-eviction-cause-lots-of-old-gc-and-long-stop/25869>\
**Category:** Elasticsearch\
**Created:** [July 20, 2015, 6:13am UTC](https://discuss.elastic.co/t/filter-cache-eviction-cause-lots-of-old-gc-and-long-stop/25869 "2015-07-20T06:13:26Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![limac](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/limac/32/3981_2.png) [@limac](https://discuss.elastic.co/u/limac)\
**Post date:** [July 20, 2015, 6:13am UTC](https://discuss.elastic.co/t/filter-cache-eviction-cause-lots-of-old-gc-and-long-stop/25869/1 "2015-07-20T06:13:26Z")

</div>

Hi, my cluster has 6 nodes with 32G heap and 5G filter cache set to 5G. The filter cache expiration set to -1. as soon as the query request increase to 300req/sec, the eviction of filter cache will cause the old gc occur more often. this will stop the whole jvm for several seconds and make the whole cluster just like frozen.  
my question is, the eviction of filter cache seems to be not avoidable, so, is there any way to make the cache eviction not to cause so many old gc and then stop the whole jvm?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [July 20, 2015, 6:19am UTC](https://discuss.elastic.co/t/filter-cache-eviction-cause-lots-of-old-gc-and-long-stop/25869/2 "2015-07-20T06:19:06Z")

</div>

They aren't related quite like that. Cache takes up heap, but it won't be cleaned in GC.

You should really reduce your heap to 30.5GB, beyond that and your pointers will no longer be compressed which leads to inefficiencies in the heap.

---

<div class="post-metadata">

**Author:** ![limac](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/limac/32/3981_2.png) [@limac](https://discuss.elastic.co/u/limac)\
**Post date:** [July 22, 2015, 12:31am UTC](https://discuss.elastic.co/t/filter-cache-eviction-cause-lots-of-old-gc-and-long-stop/25869/3 "2015-07-22T00:31:55Z")

</div>

Thank you, But if the filter cache eviction is not the root cause of the old gc, so what is the root cause. I remembered someone said that after the object is evicted from cache, it will be freed by gc, is that right?

Thank you again.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [July 23, 2015, 12:11am UTC](https://discuss.elastic.co/t/filter-cache-eviction-cause-lots-of-old-gc-and-long-stop/25869/4 "2015-07-23T00:11:37Z")

</div>

Once something is evicted from cache then it's no longer in memory.

But if you have set expiration to -1 then it will never expire anything, I don't know how ES handles that in those cases.

---

<div class="post-metadata">

**Author:** ![limac](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/limac/32/3981_2.png) [@limac](https://discuss.elastic.co/u/limac)\
**Post date:** [August 3, 2015, 12:19am UTC](https://discuss.elastic.co/t/filter-cache-eviction-cause-lots-of-old-gc-and-long-stop/25869/5 "2015-08-03T00:19:16Z")

</div>

I found this interesting blog:

> **[How we optimized 100 sec elasticsearch queries to be under a sub second.](https://abhishek376.wordpress.com/2014/11/24/how-we-optimized-100-sec-elasticsearch-queries-to-be-under-a-sub-second/)**
>
> In a SQL world, query optimizers are well matured and understood, distributed systems on other hand are new and not very mature. Understanding how the queries work is very important. Some of our El…

and in this blog it said that "the eviction of filter cache will cause a lot of old gc".

---

<div class="post-metadata">

**Author:** ![rockybean](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rockybean/32/11443_2.png) [@rockybean](https://discuss.elastic.co/u/rockybean)\
**Post date:** [August 18, 2016, 6:17am UTC](https://discuss.elastic.co/t/filter-cache-eviction-cause-lots-of-old-gc-and-long-stop/25869/6 "2016-08-18T06:17:30Z")

</div>

hi @limac I also meet this problem.

Have you found the reason or solutions for this problem?  
Any advice?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [August 18, 2016, 6:26am UTC](https://discuss.elastic.co/t/filter-cache-eviction-cause-lots-of-old-gc-and-long-stop/25869/7 "2016-08-18T06:26:45Z")

</div>

This is a very old thread. Please open up a new thread for your query.

---

<div class="post-metadata">

**Author:** ![rockybean](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rockybean/32/11443_2.png) [@rockybean](https://discuss.elastic.co/u/rockybean)\
**Post date:** [August 18, 2016, 6:41am UTC](https://discuss.elastic.co/t/filter-cache-eviction-cause-lots-of-old-gc-and-long-stop/25869/8 "2016-08-18T06:41:59Z")

</div>

I've post a new topic. Looking forward to you reply!

---

<div class="post-metadata">

**Author:** ![limac](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/limac/32/3981_2.png) [@limac](https://discuss.elastic.co/u/limac)\
**Post date:** [September 1, 2016, 6:29am UTC](https://discuss.elastic.co/t/filter-cache-eviction-cause-lots-of-old-gc-and-long-stop/25869/9 "2016-09-01T06:29:42Z")

</div>

hi @rockybean  
sorry for replying later, I found the cause of my situation is that I have set the max size of field cache to 40% of the heap size. That's too big and if the field cache becoming full, it will cause the heap full and old gc coming.  
So, after I set the max to 20%, everything goes smoothly. hope this help.

---

<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 5, 2017, 10:23pm UTC](https://discuss.elastic.co/t/filter-cache-eviction-cause-lots-of-old-gc-and-long-stop/25869/10 "2017-07-05T22:23:24Z")

</div>


