I deploy containers on AWS ECS and try to adjust the optimal structure. For testing, I launched a container with sorting into 45 million elements and got a Java heap space error. 40 million sorted normally. In this case, the load of the instance memory does not rise above 30 percent. On the same instance, I launched the second task: and 2 tasks can simultaneously sort by 40 million items. When creating Task defenition I tried to change the memory of the reservation - effect 0. I tried to specify -Xms<size> и -Xmx<size> effect zero.
But when I started tezhe, the most tasks on the instance are more powerful - they both already sort 60mln items at a time without any additional settings. As far as I understand: memoryReservation is a parameter in which server memory is reserved for a container, but this is not a limit limit and a container can take up all free RAM if the need arises. How to allocate resources for a container so that it alone can use all the free resources of nansa? Or is there some justification for which it makes sense to actually launch 2 identical containers instead of one? Thank.