Search code examples
amazon-web-servicesamazon-ecsaws-fargate

AWS Fargate Cluster - How much task memory can be consumed by java process running inside the container?


I am running a java application on AWS Fargate cluster with desired task count of 1. I have created a task definition with 30GB of memory and 4 vCPUs and there is only one container defined in this task. I want to run a java process inside container with 30GB(-Xmx30G) of heap, my question is can all the task memory be consumed inside container by my java process or are there any limitations ?


Solution

  • Like @jordanm said, not all memory consumed by JVM is used for heap memory. There's also (depending on JVM version) PermGen or Metaspace memory, colloquially referred to as non-heap.

    Essentially what you might want to do is to test how your app behaves with different proportions of 30Gb allocated to heap and non-heap.

    Here's a tutorial which describes memory tuning in general terms: https://www.baeldung.com/jvm-parameters