# JVM Heap usage didn't decline after clearing field data cache

**URL:** https://discuss.elastic.co/t/jvm-heap-usage-didnt-decline-after-clearing-field-data-cache/16446
**Category:** Elasticsearch
**Created:** [March 19, 2014, 3:17am UTC](https://discuss.elastic.co/t/jvm-heap-usage-didnt-decline-after-clearing-field-data-cache/16446 "2014-03-19T03:17:57Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Gary\_Gao](https://avatars.discourse-cdn.com/v4/letter/g/eb9ed0/32.png) [@Gary\_Gao](https://discuss.elastic.co/u/Gary_Gao)
#### Post date: [March 19, 2014, 3:17am UTC](https://discuss.elastic.co/t/jvm-heap-usage-didnt-decline-after-clearing-field-data-cache/16446/1 "2014-03-19T03:17:57Z")

</div>

Hi,  
I have a total 8GB of JVM Heap, it't usage was near 50%,  
While I cleared field data cache（almost 1GB） using Clear Cache API:  
$curl -XPOST '[http://localhost:9200/\_cache/clear?field\_data=true](http://localhost:9200/_cache/clear?field_data=true)  
'  
field data cahced size decreased, indeed, but JVM heap usage didn't  
declined.  
What's the reasons ?

--  
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/5e4a1e94-d6f0-4069-9d62-481c5a974f2c%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/5e4a1e94-d6f0-4069-9d62-481c5a974f2c%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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: [March 19, 2014, 1:22pm UTC](https://discuss.elastic.co/t/jvm-heap-usage-didnt-decline-after-clearing-field-data-cache/16446/2 "2014-03-19T13:22:51Z")

</div>

JVM heap objects are reclaimed by garbage collection, not by clear cache  
command.

Jörg

On Wed, Mar 19, 2014 at 4:17 AM, Gary Gao [garygaowork@gmail.com](mailto:garygaowork@gmail.com) wrote:

> Hi,  
> I have a total 8GB of JVM Heap, it't usage was near 50%,  
> While I cleared field data cache（almost 1GB） using Clear Cache API:  
> $curl -XPOST '[http://localhost:9200/\_cache/](http://localhost:9200/_cache/)  
> clear?field\_data=true'  
> field data cahced size decreased, indeed, but JVM heap usage didn't  
> declined.  
> What's the reasons ?
> 
> --  
> 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/5e4a1e94-d6f0-4069-9d62-481c5a974f2c%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/5e4a1e94-d6f0-4069-9d62-481c5a974f2c%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/5e4a1e94-d6f0-4069-9d62-481c5a974f2c%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/5e4a1e94-d6f0-4069-9d62-481c5a974f2c%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/CAKdsXoGnmE44ikZb03Km-nr9CKwL%2BMuOjQvQ1LD0XLf0ZxuAbA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGnmE44ikZb03Km-nr9CKwL%2BMuOjQvQ1LD0XLf0ZxuAbA%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![Gary\_Gao](https://avatars.discourse-cdn.com/v4/letter/g/eb9ed0/32.png) [@Gary\_Gao](https://discuss.elastic.co/u/Gary_Gao)
#### Post date: [March 21, 2014, 7:19am UTC](https://discuss.elastic.co/t/jvm-heap-usage-didnt-decline-after-clearing-field-data-cache/16446/3 "2014-03-21T07:19:39Z")

</div>

So, What is Clear Cache API for ?

On Wed, Mar 19, 2014 at 9:22 PM, [joergprante@gmail.com](mailto:joergprante@gmail.com) \<  
[joergprante@gmail.com](mailto:joergprante@gmail.com)\> wrote:

> JVM heap objects are reclaimed by garbage collection, not by clear cache  
> command.
> 
> Jörg
> 
> On Wed, Mar 19, 2014 at 4:17 AM, Gary Gao [garygaowork@gmail.com](mailto:garygaowork@gmail.com) wrote:
> 
> > Hi,  
> > I have a total 8GB of JVM Heap, it't usage was near 50%,  
> > While I cleared field data cache（almost 1GB） using Clear Cache API:  
> > $curl -XPOST '[http://localhost:9200/\_cache/](http://localhost:9200/_cache/)  
> > clear?field\_data=true'  
> > field data cahced size decreased, indeed, but JVM heap usage didn't  
> > declined.  
> > What's the reasons ?
> > 
> > --  
> > 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/5e4a1e94-d6f0-4069-9d62-481c5a974f2c%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/5e4a1e94-d6f0-4069-9d62-481c5a974f2c%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/5e4a1e94-d6f0-4069-9d62-481c5a974f2c%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/5e4a1e94-d6f0-4069-9d62-481c5a974f2c%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 a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/PWbqlVw9OEE/unsubscribe](https://groups.google.com/d/topic/elasticsearch/PWbqlVw9OEE/unsubscribe).  
> To unsubscribe from this group and all its topics, 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/CAKdsXoGnmE44ikZb03Km-nr9CKwL%2BMuOjQvQ1LD0XLf0ZxuAbA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGnmE44ikZb03Km-nr9CKwL%2BMuOjQvQ1LD0XLf0ZxuAbA%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGnmE44ikZb03Km-nr9CKwL%2BMuOjQvQ1LD0XLf0ZxuAbA%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGnmE44ikZb03Km-nr9CKwL%2BMuOjQvQ1LD0XLf0ZxuAbA%40mail.gmail.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/CAAgk9rx2t8pDJ86Nwd0t6zE\_DLKhupB8TZcoRG7khufucWfGAA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAAgk9rx2t8pDJ86Nwd0t6zE_DLKhupB8TZcoRG7khufucWfGAA%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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: [March 21, 2014, 8:07am UTC](https://discuss.elastic.co/t/jvm-heap-usage-didnt-decline-after-clearing-field-data-cache/16446/4 "2014-03-21T08:07:05Z")

</div>

For example, if you have a resident filter cache configured and there is  
heap congestion, clear cache may temporarily help to release objects back  
to the JVM. After a while they are GCed.

Usually, in most other cases, cached objects are GCed when memory becomes  
low, so there is not much to worry about clearing cache by command.

Jörg

On Fri, Mar 21, 2014 at 8:19 AM, Gary Gao [garygaowork@gmail.com](mailto:garygaowork@gmail.com) wrote:

> So, What is Clear Cache API for ?
> 
> On Wed, Mar 19, 2014 at 9:22 PM, [joergprante@gmail.com](mailto:joergprante@gmail.com) \<  
> [joergprante@gmail.com](mailto:joergprante@gmail.com)\> wrote:
> 
> > JVM heap objects are reclaimed by garbage collection, not by clear cache  
> > command.
> > 
> > Jörg
> > 
> > On Wed, Mar 19, 2014 at 4:17 AM, Gary Gao [garygaowork@gmail.com](mailto:garygaowork@gmail.com) wrote:
> > 
> > > Hi,  
> > > I have a total 8GB of JVM Heap, it't usage was near 50%,  
> > > While I cleared field data cache（almost 1GB） using Clear Cache API:  
> > > $curl -XPOST '[http://localhost:9200/\_cache/](http://localhost:9200/_cache/)  
> > > clear?field\_data=true'  
> > > field data cahced size decreased, indeed, but JVM heap usage  
> > > didn't declined.  
> > > What's the reasons ?
> > > 
> > > --  
> > > 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/5e4a1e94-d6f0-4069-9d62-481c5a974f2c%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/5e4a1e94-d6f0-4069-9d62-481c5a974f2c%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/5e4a1e94-d6f0-4069-9d62-481c5a974f2c%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/5e4a1e94-d6f0-4069-9d62-481c5a974f2c%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 a topic in the  
> > Google Groups "elasticsearch" group.  
> > To unsubscribe from this topic, visit  
> > [https://groups.google.com/d/topic/elasticsearch/PWbqlVw9OEE/unsubscribe](https://groups.google.com/d/topic/elasticsearch/PWbqlVw9OEE/unsubscribe).  
> > To unsubscribe from this group and all its topics, 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/CAKdsXoGnmE44ikZb03Km-nr9CKwL%2BMuOjQvQ1LD0XLf0ZxuAbA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGnmE44ikZb03Km-nr9CKwL%2BMuOjQvQ1LD0XLf0ZxuAbA%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGnmE44ikZb03Km-nr9CKwL%2BMuOjQvQ1LD0XLf0ZxuAbA%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGnmE44ikZb03Km-nr9CKwL%2BMuOjQvQ1LD0XLf0ZxuAbA%40mail.gmail.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/CAAgk9rx2t8pDJ86Nwd0t6zE\_DLKhupB8TZcoRG7khufucWfGAA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAAgk9rx2t8pDJ86Nwd0t6zE_DLKhupB8TZcoRG7khufucWfGAA%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CAAgk9rx2t8pDJ86Nwd0t6zE\_DLKhupB8TZcoRG7khufucWfGAA%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAAgk9rx2t8pDJ86Nwd0t6zE_DLKhupB8TZcoRG7khufucWfGAA%40mail.gmail.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/CAKdsXoEYBZQkEc%2BU6YUysHrB3c%2B4bDq-QCV4GO%3DbHCKncykx\_A%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEYBZQkEc%2BU6YUysHrB3c%2B4bDq-QCV4GO%3DbHCKncykx_A%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, 1:41am UTC](https://discuss.elastic.co/t/jvm-heap-usage-didnt-decline-after-clearing-field-data-cache/16446/5 "2017-07-06T01:41:39Z")

</div>


