[Solved] OutofMemory Exception on Java Application running on Docker Containers
We recently came across a issue where the java application was frequently facing the OutofMemory Exception. Usually the Java based applications use the parameters -XX:MaxRAMPercentage / -XX:MinRAMPercentage are used to restrict the heap utilization within certain % limits from 1 to 100 which holds good when you running these applications on the virtual instances like EC2. But when you running them on containers than VM allocates a larger fraction of memory to the Java Heap. To turn off this behaviour, set the -XX:-UseContainerSupport When -XX:MaxRAMPercentage / -XX:InitialRAMPercentage are used with -XX:+UseContainerSupport , the corresponding heap setting is determined based on the memory limit of the container.