Container-aware heap sizing for OpenJDK

Severin Gehwolf sgehwolf at redhat.com
Fri Sep 16 15:35:29 UTC 2022


On Fri, 2022-09-16 at 16:12 +0200, Thomas Schatzl wrote:
>   * How is the container memory limit being determined? Does that 
> process take into account non-Java processes running in the container as 
> well? (Ashutosh Mehra)

As this seems to be a re-curring question, I now wonder what the
original proposal was...

To me the proposal sounded like solving spurious Linux kernel OOM
kills, while also reducing wasted (unused) memory within a container.

So given a container limit of A, the heap gets "right-sized" based on
A. Let X be maximum heap, let Y be non-heap memory. Y may be non-heap
memory from a separate process or the JVM. What we want is to
dynamically adjust X based on A-Y, no?

My understanding was that A was pre-determined by the application
deployment team, X and Y are the variables. The JVM detects the limit
(A) in that container e.g. by code from JDK-8146115. Y is determined by
the same code (OSContainer::memory_usage_in_bytes). X needs to tuned
for reduced waste.

So in that context the container limit would be detected from the
cgroups filesystem.

Did I get that part wrong?

Thanks,
Severin




More information about the hotspot-gc-dev mailing list