I have my application running on an AL2023 node in EKS cluster.
Below is the snippet of the Container resources in the Pod definition
resources:
# memory ~ heap space +10%
# CPU ~ no more than 1/8 of memory
requests:
cpu: 2000m
memory: 22G
# CPU ~ 4x requested
limits:
cpu: 4000m
memory: 24G
As per my understanding the ActiveProcessorCount value should be equal to CPU Limits which should 4, but it is showing as -1
java -XX:+PrintFlagsFinal -version | grep -E 'ActiveProcessorCount'
intx ActiveProcessorCount = -1 {product}
Does this mean, it is not able to detect the Container Limits with cgroup v2 even with Container Support enabled? I am running openJDK version 1.8.0_392.
cat /proc/self/mounts | grep cgroup
cgroup /sys/fs/cgroup cgroup2 ro,seclabel,nosuid,nodev,noexec,relatime 0 0
java -XX:+PrintFlagsFinal -version | grep -i container
bool PreferContainerQuotaForCPUCount = true {product}
bool UseContainerSupport = true {product}
java -version
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
openjdk version "1.8.0_392"
OpenJDK Runtime Environment (IcedTea 3.29.0) (Alpine 8.392.08-r0)
OpenJDK 64-Bit Server VM (build 25.392-b08, mixed mode)
Also, I have explicitly set JAVA_HEAP as 12000m. Ideally InitialHeapSize and MaxHeapSize should show the values as "12582912000" and "12582912000" when both -Xms and -Xmx value is set to 12000m. But it is automatically defaulting to the 1/InitialRAMFraction of Mem Limits and 1/MaxRAMFraction of Mem Limits values.