# Elasticsearch memory is not completely utilized

**URL:** <https://discuss.elastic.co/t/elasticsearch-memory-is-not-completely-utilized/253380>\
**Category:** Elasticsearch\
**Created:** [October 27, 2020, 2:32am UTC](https://discuss.elastic.co/t/elasticsearch-memory-is-not-completely-utilized/253380 "2020-10-27T02:32:16Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Varun\_S](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/varun_s/32/48294_2.png) [@Varun\_S](https://discuss.elastic.co/u/Varun_S)\
**Post date:** [October 27, 2020, 2:32am UTC](https://discuss.elastic.co/t/elasticsearch-memory-is-not-completely-utilized/253380/1 "2020-10-27T02:32:17Z")

</div>

Hi Team,

I have deployed elasticsearch in k8s environment with below configuration.

> Es-client:-  
> replicas: 1  
> resources:  
> limits:  
> cpu: 2  
> memory: "4Gi"  
> requests:  
> cpu: "500m"  
> memory: "2Gi"  
> es\_java\_opts: "-Xms2g -Xmx2g"

> Es-Master:-  
> replicas: 1  
> resources:  
> limits:  
> cpu: 1  
> memory: "2Gi"  
> requests:  
> cpu: "500m"  
> memory: "1Gi"  
> es\_java\_opts: "-Xms1g -Xmx1g"

> Es-data:-  
> replicas: 2  
> resources:  
> limits:  
> cpu: "2"  
> memory: "4Gi"  
> requests:  
> cpu: "500m"  
> memory: "2Gi"  
> es\_java\_opts: "-Xms2g -Xmx2g"

We are using multiple fluentd to push the data, Now the concern is we are not able to completely utilize elasticsearch client and data pod memory. Irrespective of configuring multiple threads to push data to elasticsearch, memory utilization of client and data pod is not increasing. Max memory utilization of elasticsearch client and data pods is up to 2.5gb but the configured memory limit is 4gb. Please refer below screenshot for reference.

> ![image](https://us1.discourse-cdn.com/elastic/original/3X/1/2/12d4e7c00012add82d1e4f49194458235ae0d18d.png)

Can you guys please help here.

Regards,  
Varun S

---

<div class="post-metadata">

**Author:** ![PIER-GREGOIRE](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pier-gregoire/32/78648_2.png) [@PIER-GREGOIRE](https://discuss.elastic.co/u/PIER-GREGOIRE)\
**Post date:** [November 8, 2020, 10:10pm UTC](https://discuss.elastic.co/t/elasticsearch-memory-is-not-completely-utilized/253380/2 "2020-11-08T22:10:23Z")

</div>

Hello,

```auto
es_java_opts: "-Xms2g -Xmx2g"

```

Limite ressources to 2 GB

---

<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:** [November 9, 2020, 4:53am UTC](https://discuss.elastic.co/t/elasticsearch-memory-is-not-completely-utilized/253380/3 "2020-11-09T04:53:40Z")

</div>

Elasticsearch uses both heap and off-heap storage as well as the operating system page cache for performance. This is why heap is recommended to be set to 50% of available RAM. The amount of page cache used, which will often result in how much memory the page cache uses depends on the amount of data stored in the cluster. If you have little data, the page cache may not be filled yet.

---

<div class="post-metadata">

**Author:** ![PIER-GREGOIRE](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pier-gregoire/32/78648_2.png) [@PIER-GREGOIRE](https://discuss.elastic.co/u/PIER-GREGOIRE)\
**Post date:** [November 9, 2020, 8:19am UTC](https://discuss.elastic.co/t/elasticsearch-memory-is-not-completely-utilized/253380/4 "2020-11-09T08:19:34Z")

</div>

If I understand, Varun\_S issue is that :

he fixed `memory: "4Gi"`  
and does not understand why  
"Max memory utilization of elasticsearch client and data pods is up to 2.5gb"

If I understand es\_java\_opts :  
He fixed  
`es_java_opts: "-Xms2g -Xmx2g"`

then Elastic stack will never go above 2.5gb

---

<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:** [November 9, 2020, 8:25am UTC](https://discuss.elastic.co/t/elasticsearch-memory-is-not-completely-utilized/253380/5 "2020-11-09T08:25:11Z")

</div>

Elasticsearch will use 2GB for heap, but in addition to that it requires off-heap memory for some data structures as well as the page cache. It will therefore use all 4GB of RAM available once it fills up with data. Please see [the documentation](https://www.elastic.co/guide/en/elasticsearch/reference/7.9/heap-size.html) for further details.

---

<div class="post-metadata">

**Author:** ![PIER-GREGOIRE](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pier-gregoire/32/78648_2.png) [@PIER-GREGOIRE](https://discuss.elastic.co/u/PIER-GREGOIRE)\
**Post date:** [November 9, 2020, 8:42am UTC](https://discuss.elastic.co/t/elasticsearch-memory-is-not-completely-utilized/253380/6 "2020-11-09T08:42:24Z")

</div>

thanks for the explaination it was not clear for me on what this limit : `es_java_opts: "-Xms2g -Xmx2g"` was applied on.

---

<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:** [December 7, 2020, 8:42am UTC](https://discuss.elastic.co/t/elasticsearch-memory-is-not-completely-utilized/253380/7 "2020-12-07T08:42:29Z")

</div>

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