Docker: what are negative impacts of running container with memory limit enabled and memory overcommit disabled?
In my environment, I am going to disable the memory overcommit (vm.overcommit=2). This disables Linux OOMKiller also.
The reason is that I run Java apps in docker containers with properly memory size limitation and I want to see them failing with OOMError (and writing heap dump) instead of just killed silently by linux OOMKiller.
Iam not sure about possible negative impacts of that. I am not a Linux kernel, docker memory management or Java VM expert, so decided to ask here.
If anyone has such experience, can you please tell me?
One Solution collect form web for “Docker: what are negative impacts of running container with memory limit enabled and memory overcommit disabled?”
If you disable memory overcommit, then if the JVM requests memory from the OS and all memory is committed, then the syscall will fail. When that happens, the JVM to fail with an OOME and the message that includes “Out of swap space?”.
My reading of the Oracle OOME troubleshooting documentation is that this will cause an fatal error logfile to be written. It is not clear if a heap dump can be created.
If you are trying to track down a suspected memory leak, I would suggest setting the initial heap and max heap sizes to be the same value, and make them small enough that you don’t get an “Out of swap space?” OOME. If you get a “normal” OOME, you should be able to get a heap dump.