• Container awareness is the ability of the JVM to detect that it’s running in a container environment and uses the bounds that are set for its operation.
  • The JVM utilises the cgroup filesystem to read the resource restrictions enforced on the container.(/sys/fs/cgroup/cpu and /sys/fs/cgroup/memory)
  • The latest versions of java are container aware. Older versions of java would read the overall resources available on the node.
  • The initial support was given for cgroup v1 but java 15 added support for cgroup v2 as well (later backported.)
  • JVM prefers cpu quota over cpu shares which translate to limits and requests respectively in kubernetes.
  • In container aware versions the Runtime api also reads the container limits.
  • References