# Why heap used of a new elasticsearch cluster with no document can be 26% ? What memory is Used for?

**URL:** https://discuss.elastic.co/t/why-heap-used-of-a-new-elasticsearch-cluster-with-no-document-can-be-26-what-memory-is-used-for/205455
**Category:** Elasticsearch
**Tags:** elastic-stack-monitoring
**Created:** [October 28, 2019, 12:16pm UTC](https://discuss.elastic.co/t/why-heap-used-of-a-new-elasticsearch-cluster-with-no-document-can-be-26-what-memory-is-used-for/205455 "2019-10-28T12:16:53Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![panxuelin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/panxuelin/32/56743_2.png) [@panxuelin](https://discuss.elastic.co/u/panxuelin)
#### Post date: [October 28, 2019, 12:16pm UTC](https://discuss.elastic.co/t/why-heap-used-of-a-new-elasticsearch-cluster-with-no-document-can-be-26-what-memory-is-used-for/205455/1 "2019-10-28T12:16:53Z")

</div>

unit is M and I use \_nodes/stats API

heap\_used\_in\_bytes = 4298.34  
heap\_used\_percent = 26  
heap\_max\_in\_bytes = 16067.875

---

<div class="post-metadata">

### Author: ![panxuelin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/panxuelin/32/56743_2.png) [@panxuelin](https://discuss.elastic.co/u/panxuelin)
#### Post date: [October 28, 2019, 12:22pm UTC](https://discuss.elastic.co/t/why-heap-used-of-a-new-elasticsearch-cluster-with-no-document-can-be-26-what-memory-is-used-for/205455/2 "2019-10-28T12:22:01Z")

</div>

What the memory is used for ? Something else possible need to be loaded is 0.0

segment\_memory\_in\_bytes = 0.0  
terms\_memory\_in\_bytes = 0.0  
stored\_fields\_memory\_in\_bytes = 0.0  
term\_vectors\_memory\_in\_bytes = 0.0  
norms\_memory\_in\_bytes = 0.0  
points\_memory\_in\_bytes = 0.0  
doc\_values\_memory\_in\_bytes = 0.0  
index\_writer\_memory\_in\_bytes = 0.0  
request\_cache = 0.0  
query\_cache = 0.0  
fielddata = 0.0

---

<div class="post-metadata">

### Author: ![Mike\_Place](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mike_place/32/39555_2.png) [@Mike\_Place](https://discuss.elastic.co/u/Mike_Place)
#### Post date: [October 28, 2019, 2:06pm UTC](https://discuss.elastic.co/t/why-heap-used-of-a-new-elasticsearch-cluster-with-no-document-can-be-26-what-memory-is-used-for/205455/3 "2019-10-28T14:06:50Z")

</div>

Hi @panxuelin

Have you indexed any documents into this cluster?

---

<div class="post-metadata">

### Author: ![panxuelin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/panxuelin/32/56743_2.png) [@panxuelin](https://discuss.elastic.co/u/panxuelin)
#### Post date: [October 29, 2019, 12:58am UTC](https://discuss.elastic.co/t/why-heap-used-of-a-new-elasticsearch-cluster-with-no-document-can-be-26-what-memory-is-used-for/205455/4 "2019-10-29T00:58:40Z")

</div>

It's a new cluster with no document

---

<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: [October 29, 2019, 4:39am UTC](https://discuss.elastic.co/t/why-heap-used-of-a-new-elasticsearch-cluster-with-no-document-can-be-26-what-memory-is-used-for/205455/5 "2019-10-29T04:39:44Z")

</div>

What does `_cat/nodes?v` and `_cat/indices?v` show?

---

<div class="post-metadata">

### Author: ![panxuelin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/panxuelin/32/56743_2.png) [@panxuelin](https://discuss.elastic.co/u/panxuelin)
#### Post date: [October 29, 2019, 6:17am UTC](https://discuss.elastic.co/t/why-heap-used-of-a-new-elasticsearch-cluster-with-no-document-can-be-26-what-memory-is-used-for/205455/6 "2019-10-29T06:17:01Z")

</div>

[root@node4 ~]# curl localhost:9200/\_cat/nodes?v  
ip heap.percent ram.percent cpu load\_1m load\_5m load\_15m node.role master name  
28.28.0.4 26 16 0 0.06 0.07 0.05 mdi \* node4

---

<div class="post-metadata">

### Author: ![panxuelin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/panxuelin/32/56743_2.png) [@panxuelin](https://discuss.elastic.co/u/panxuelin)
#### Post date: [October 29, 2019, 6:17am UTC](https://discuss.elastic.co/t/why-heap-used-of-a-new-elasticsearch-cluster-with-no-document-can-be-26-what-memory-is-used-for/205455/7 "2019-10-29T06:17:46Z")

</div>

It‘s same with \_node/stats API

---

<div class="post-metadata">

### Author: ![panxuelin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/panxuelin/32/56743_2.png) [@panxuelin](https://discuss.elastic.co/u/panxuelin)
#### Post date: [October 29, 2019, 6:34am UTC](https://discuss.elastic.co/t/why-heap-used-of-a-new-elasticsearch-cluster-with-no-document-can-be-26-what-memory-is-used-for/205455/8 "2019-10-29T06:34:00Z")

</div>

Are there anybody encounter the same problem ? Just create a new cluster and use python client to monitor. Heap\_used\_percent is alway high , from 12 percent to 26 percent

self.es\_rest = Elasticsearch(  
server,  
timeout=int(self.timeout),  
max\_retries=int(self.max\_retries),  
retry\_on\_timeout=True)  
stats\_response = self.es\_rest.nodes.stats()

---

<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: [October 29, 2019, 6:39am UTC](https://discuss.elastic.co/t/why-heap-used-of-a-new-elasticsearch-cluster-with-no-document-can-be-26-what-memory-is-used-for/205455/9 "2019-10-29T06:39:15Z")

</div>

There are a lot of things that will use heap apart from data. Elasticsearch itself use a certain amount and every request to the cluster is likely to use a bit more. This includes requests not directly related to data. If there is no data in the cluster heap usage typically grows slowly though, but it will grow over time as garbage collection usually only kicks in when the heap is 75% full.

The best way to see what the static overhead is is to restart the node and measure it before any requests have been served.

---

<div class="post-metadata">

### Author: ![panxuelin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/panxuelin/32/56743_2.png) [@panxuelin](https://discuss.elastic.co/u/panxuelin)
#### Post date: [October 29, 2019, 6:57am UTC](https://discuss.elastic.co/t/why-heap-used-of-a-new-elasticsearch-cluster-with-no-document-can-be-26-what-memory-is-used-for/205455/10 "2019-10-29T06:57:13Z")

</div>

My cluster is a new cluster with no other request cache. I try to restart elasticsearch and send the first request after 5min. The result show that memory size of  
query\_cache, fielddata and segments is 0. Are there any api to show what elasticsearch use 12% heap memory for?

"query\_cache" : {  
"memory\_size\_in\_bytes" : 0,  
"total\_count" : 0,  
"hit\_count" : 0,  
"miss\_count" : 0,  
"cache\_size" : 0,  
"cache\_count" : 0,  
"evictions" : 0  
},  
"fielddata" : {  
"memory\_size\_in\_bytes" : 0,  
"evictions" : 0  
},  
"completion" : {  
"size\_in\_bytes" : 0  
},  
"segments" : {  
"count" : 0,  
"memory\_in\_bytes" : 0,  
"terms\_memory\_in\_bytes" : 0,  
"stored\_fields\_memory\_in\_bytes" : 0,  
"term\_vectors\_memory\_in\_bytes" : 0,  
"norms\_memory\_in\_bytes" : 0,  
"points\_memory\_in\_bytes" : 0,  
"doc\_values\_memory\_in\_bytes" : 0,  
"index\_writer\_memory\_in\_bytes" : 0,  
"version\_map\_memory\_in\_bytes" : 0,  
"fixed\_bit\_set\_memory\_in\_bytes" : 0,  
"max\_unsafe\_auto\_id\_timestamp" : -9223372036854775808,  
"file\_sizes" : { }  
}  
"jvm" : {  
"timestamp" : 1572331615124,  
"uptime\_in\_millis" : 107789,  
"mem" : {  
"heap\_used\_in\_bytes" : 2121881128,  
"heap\_used\_percent" : 12,  
"heap\_committed\_in\_bytes" : 16848388096,  
"heap\_max\_in\_bytes" : 16848388096,  
"non\_heap\_used\_in\_bytes" : 72268584,  
"non\_heap\_committed\_in\_bytes" : 79777792,

---

<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: [October 29, 2019, 7:00am UTC](https://discuss.elastic.co/t/why-heap-used-of-a-new-elasticsearch-cluster-with-no-document-can-be-26-what-memory-is-used-for/205455/11 "2019-10-29T07:00:57Z")

</div>

That looks high for being a completely empty cluster. Even through you do not have any data in the cluster, have you uploaded anything else, e.g. index templates, synonyms etc? Do you have any plugins installed that might use a lot of heap? Do you have any non-default settings in your elasticsearch.yml file?

---

<div class="post-metadata">

### Author: ![panxuelin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/panxuelin/32/56743_2.png) [@panxuelin](https://discuss.elastic.co/u/panxuelin)
#### Post date: [October 29, 2019, 7:04am UTC](https://discuss.elastic.co/t/why-heap-used-of-a-new-elasticsearch-cluster-with-no-document-can-be-26-what-memory-is-used-for/205455/12 "2019-10-29T07:04:48Z")

</div>

Completly new Cluster with no plugin, document. Just modify the elasticsearch.yml

http.cors.enabled: true  
http.cors.allow-origin: "\*"

thread\_pool.write.size: 32  
thread\_pool.search.size: 64  
thread\_pool.get.size: 32  
thread\_pool.write.queue\_size: 100  
thread\_pool.search.queue\_size: 3000  
thread\_pool.get.queue\_size: 2000

http.max\_content\_length: 500mb  
network.publish\_host: 28.28.0.4

---

<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: [October 29, 2019, 7:53am UTC](https://discuss.elastic.co/t/why-heap-used-of-a-new-elasticsearch-cluster-with-no-document-can-be-26-what-memory-is-used-for/205455/13 "2019-10-29T07:53:49Z")

</div>

Does the size change if you comment those out and go back to defaults?

---

<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: [October 29, 2019, 8:01am UTC](https://discuss.elastic.co/t/why-heap-used-of-a-new-elasticsearch-cluster-with-no-document-can-be-26-what-memory-is-used-for/205455/14 "2019-10-29T08:01:21Z")

</div>

How did you arrive at these custom settings? Why are they required? Elasticsearch is not designed to handle very large documents, so. The large http request size is a bit concerning.

---

<div class="post-metadata">

### Author: ![panxuelin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/panxuelin/32/56743_2.png) [@panxuelin](https://discuss.elastic.co/u/panxuelin)
#### Post date: [October 29, 2019, 8:11am UTC](https://discuss.elastic.co/t/why-heap-used-of-a-new-elasticsearch-cluster-with-no-document-can-be-26-what-memory-is-used-for/205455/15 "2019-10-29T08:11:42Z")

</div>

http.max\_content\_length is used to limite bulk size and our document is small. Just avoid extreme case.  
I think these custom settings have nothing to do with heap used of cluster now. I just send \_nodes/stats request

---

<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: [October 29, 2019, 8:57am UTC](https://discuss.elastic.co/t/why-heap-used-of-a-new-elasticsearch-cluster-with-no-document-can-be-26-what-memory-is-used-for/205455/16 "2019-10-29T08:57:56Z")

</div>

Did going with defaults make any difference?

---

<div class="post-metadata">

### Author: ![panxuelin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/panxuelin/32/56743_2.png) [@panxuelin](https://discuss.elastic.co/u/panxuelin)
#### Post date: [October 29, 2019, 9:09am UTC](https://discuss.elastic.co/t/why-heap-used-of-a-new-elasticsearch-cluster-with-no-document-can-be-26-what-memory-is-used-for/205455/17 "2019-10-29T09:09:31Z")

</div>

No ,same with last time

---

<div class="post-metadata">

### Author: ![Mike\_Place](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mike_place/32/39555_2.png) [@Mike\_Place](https://discuss.elastic.co/u/Mike_Place)
#### Post date: [October 29, 2019, 11:13am UTC](https://discuss.elastic.co/t/why-heap-used-of-a-new-elasticsearch-cluster-with-no-document-can-be-26-what-memory-is-used-for/205455/18 "2019-10-29T11:13:57Z")

</div>

> [@panxuelin](#):
>
> http.cors.enabled: true  
> http.cors.allow-origin: "\*"
> 
> thread\_pool.write.size: 32  
> thread\_pool.search.size: 64  
> thread\_pool.get.size: 32  
> thread\_pool.write.queue\_size: 100  
> thread\_pool.search.queue\_size: 3000  
> thread\_pool.get.queue\_size: 2000
> 
> http.max\_content\_length: 500mb  
> network.publish\_host: 28.28.0.4

Another way to poke around for answers here might be to take some heap dumps and see if anything obvious stands out. Below I've recorded a brief screencast of doing this using [VisualVM](https://visualvm.github.io).

**Warning: mucking about with heap dumps and profilers in a production cluster is at your own risk!**

![heap](https://us1.discourse-cdn.com/elastic/original/3X/e/8/e80c7dccbd7b2e7ba668ce22ec95ec64b5caa822.gif)

**Edit:** That upload resized the gif so it's too small to read. Try this: [https://giphy.com/gifs/U7PeHMxToTLIRMtw2D](https://giphy.com/gifs/U7PeHMxToTLIRMtw2D)

---

<div class="post-metadata">

### Author: ![panxuelin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/panxuelin/32/56743_2.png) [@panxuelin](https://discuss.elastic.co/u/panxuelin)
#### Post date: [October 29, 2019, 11:35am UTC](https://discuss.elastic.co/t/why-heap-used-of-a-new-elasticsearch-cluster-with-no-document-can-be-26-what-memory-is-used-for/205455/19 "2019-10-29T11:35:47Z")

</div>

Thank you so much. I make a try. But video is Blurry, can you repeat a clear one

---

<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: [November 26, 2019, 11:36am UTC](https://discuss.elastic.co/t/why-heap-used-of-a-new-elasticsearch-cluster-with-no-document-can-be-26-what-memory-is-used-for/205455/20 "2019-11-26T11:36:20Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
