# Sizing JVM Heap - Container scenario

**URL:** <https://discuss.elastic.co/t/sizing-jvm-heap-container-scenario/309115>\
**Category:** Elastic Cloud on Kubernetes (ECK)\
**Tags:** docker\
**Created:** [July 7, 2022, 12:37pm UTC](https://discuss.elastic.co/t/sizing-jvm-heap-container-scenario/309115 "2022-07-07T12:37:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![yago82](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yago82/32/97755_2.png) [@yago82](https://discuss.elastic.co/u/yago82)\
**Post date:** [July 7, 2022, 12:37pm UTC](https://discuss.elastic.co/t/sizing-jvm-heap-container-scenario/309115/1 "2022-07-07T12:37:47Z")

</div>

Hi to all,

I have a doubt on how sizing JVM Heap.

According varius documentation:

> When running in a container, such as [Docker](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/docker.html), total memory is defined as the amount of memory visible to the container, not the total system memory on the host.

and

> Set `Xmx` and `Xms` to no more than 50% of your total system memory.

and

> For Elasticsearch objects, make sure to consider the heap size when you set resource requirements. The heap size should be half the size of RAM allocated to the Pod.  
> [Managing compute resources | Elastic Cloud on Kubernetes [1.0] | Elastic](https://www.elastic.co/guide/en/cloud-on-k8s/1.0/k8s-managing-compute-resources.html)

So if i want to set 30 GB of Heap, I have to sizing a Container with 64 GB or just 32 GB is enough?

Thank you

---

<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:** [August 4, 2022, 12:38pm UTC](https://discuss.elastic.co/t/sizing-jvm-heap-container-scenario/309115/2 "2022-08-04T12:38:35Z")

</div>

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