# JVM Heap usage spikes

**URL:** <https://discuss.elastic.co/t/jvm-heap-usage-spikes/61929>\
**Category:** Elasticsearch\
**Created:** [September 30, 2016, 2:10pm UTC](https://discuss.elastic.co/t/jvm-heap-usage-spikes/61929 "2016-09-30T14:10:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Greg\_5](https://avatars.discourse-cdn.com/v4/letter/g/f475e1/32.png) [@Greg\_5](https://discuss.elastic.co/u/Greg_5)\
**Post date:** [September 30, 2016, 2:10pm UTC](https://discuss.elastic.co/t/jvm-heap-usage-spikes/61929/1 "2016-09-30T14:10:03Z")

</div>

Hello,

I have a cluster 2.2.1 with 3 nodes. 4 CPU / 14 Gb RAM / SSD. Java(TM) SE 1.8.0\_66-b17  
ES\_HEAP is 7 gb.  
RefreshInterval set to 30s.  
mlockall: true  
ect.

I'm bulk indexing documents. There is no search query others than for Marvel monitoring.  
I see a lot of spikes on the JVM Heap usage - [https://infinit.io/\_/3jvRpGs](https://infinit.io/_/3jvRpGs)

What could explain the behaviour. Is it normal ? Any parameters to check ?

I have another cluster, with the same configuration and i don't see theses spikes.

Thanks for your help!

**EDIT:**

Here is a new screenshot: [https://infinit.io/\_/p3h5YDG](https://infinit.io/_/p3h5YDG)

Between 16h40 and 17h40 - Bulk index - And after the cluster is idle. Why the heap is increasing and then dropped ?

---

<div class="post-metadata">

**Author:** ![softwaredoug](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/softwaredoug/32/22681_2.png) [@softwaredoug](https://discuss.elastic.co/u/softwaredoug)\
**Post date:** [September 30, 2016, 5:12pm UTC](https://discuss.elastic.co/t/jvm-heap-usage-spikes/61929/2 "2016-09-30T17:12:03Z")

</div>

If you're indexing a ton with a 30s refresh, that's not terribly surprising.

Despite the [transaction log](https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules-translog.html), Lucene is building up data in memory to be flushed to a new segment. The point of the transaction log is to act as a backup to this process, if Elasticsearch goes down, you can replay the index updates.

So yes I'd expect quite a bit of JVM churn when writing, and probably a lot of in-memory objects with a 30s refresh interval.

---

<div class="post-metadata">

**Author:** ![Greg\_5](https://avatars.discourse-cdn.com/v4/letter/g/f475e1/32.png) [@Greg\_5](https://discuss.elastic.co/u/Greg_5)\
**Post date:** [September 30, 2016, 5:39pm UTC](https://discuss.elastic.co/t/jvm-heap-usage-spikes/61929/3 "2016-09-30T17:39:27Z")

</div>

So it could be interested to reduce this time to reduce the quantity of data in memory but. A lot of refresh interval is a costly operation and will have an impact on performance right ?

---

<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:15pm UTC](https://discuss.elastic.co/t/jvm-heap-usage-spikes/61929/4 "2017-07-05T22:15:45Z")

</div>


