JVM Memory Allocation In Docker (LXC) Container JVM Memory Allocation In Docker (LXC) Container docker docker

JVM Memory Allocation In Docker (LXC) Container


I have same scenario, and i use 90% of reserved memory to jvm, and work very well


For the purposes of your question, treat your container as you would a process running on the host machine.

It is a process running on the host machine, albeit with its own namespaces for network, process, etc.

You don't even "allocate" memory to a container; you can limit if if you like via cgroups, but since the JVM has its own limit this is unnecessary.

Lastly, in this situation you're controlling virtual memory usage, not RAM.


You cannot give -Xmx same value as container memory, because Java is going to need some more space for permanent generation (permgen), code cache, etcetera.There is one tool for other container environment, Warden. Tool is here: I think it can be used inside Docker as well. Need to test.