Detecting resource limits with cgroups v2

Radim Vansa rvansa at azul.com
Mon Nov 27 14:19:43 UTC 2023


Hello,

I'd like to ask if there are any plans on detecting effective resource 
limits with cgroups v2, in JVM. The limits placed on a higher level in 
cgroups cannot be exceeded in descendants; however, JVM currently reads 
only the limits imposed in the leaf node. The detection can be traced using

java -XshowSettings:system -Xlog:os+container=trace -version

others have observed this as well [1]. Therefore, if the limit is 
imposed higher (e.g. on the whole user.slice) JVM won't know about it. I 
believe that the container awareness introduced in JDK-8182070 [2] makes 
it quite explicit that the span of support is intended only for Docker 
(therefore, other container runtimes or baremetal with manual cgroup 
changes excluded), and Docker imposes the limits directly on the cgroup 
the container is run in. This means that the lack of awareness about the 
higher level is not a bug, rather a missing feature.

Are there any plans on supporting this? I guess that traversing the 
whole hierarchy would have some performance impact (though reading the 
cgroup limits is already throttled), are there any other concerns to 
traversing the ancestors?

Thanks!

Radim Vansa


[1] https://stackoverflow.com/a/77234728/789756

[2] https://bugs.openjdk.org/browse/JDK-8182070



More information about the container-discuss mailing list