Azure / draft-classic

A tool for developers to create cloud-native applications on Kubernetes.
https://draft.sh
MIT License
3.93k stars 397 forks source link

Java below 10 needs special command line options to make it Docker aware #724

Open mrumpf opened 6 years ago

mrumpf commented 6 years ago

Java VMs 9 and 8 (131 and above) need the following options:

-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap

If those options are not passed, the Java VM will take the memory limit from the node on which the pod is running and completely ignore the pod memory limits when no "-Xmx" parameter is passed.

See https://blogs.oracle.com/java-platform-group/java-se-support-for-docker-cpu-and-memory-limits for details.

Another issue is the number of threads allocated for Java VM background tasks is far too high as the VM does not recognise the CPU limits (it gets the #CPU from the node): https://engineering.squarespace.com/blog/2017/understanding-linux-container-scheduling

In Java 10 Docker support has further improved: https://www.opsian.com/blog/java-on-docker/ And full support will hopefully be reached in Java 11, the first Long Term Support version following the new numbering scheme.