MaxRAMPercentage vs a hardcoded -Xmx, -XX:-UseContainerSupport, the ActiveProcessorCount lie, and which diagnostic flags are worth leaving on in prod, verified in real Docker containers on JDK 25 and JDK 27. Co-Authored-By: Claude Sonnet 5 <[email protected]>
14 lines
1.2 KiB
Plaintext
14 lines
1.2 KiB
Plaintext
$ docker run --rm --cpus=1 --memory=1g --entrypoint java flags-demo:jdk27 -XX:+PrintFlagsFinal -version | grep -E "ParallelGCThreads|ConcGCThreads|ActiveProcessorCount"
|
|
$ docker run --rm --cpus=1 --memory=1g --entrypoint java flags-demo:jdk27 -XX:ActiveProcessorCount=8 -XX:+PrintFlagsFinal -version | grep -E "ParallelGCThreads|ConcGCThreads|ActiveProcessorCount"
|
|
|
|
=== ActiveProcessorCount lying to the JVM: 1 real CPU, told there are 8 ===
|
|
--- JDK27, --cpus=1, no override (correct) ---
|
|
int ActiveProcessorCount = -1 {product} {default}
|
|
uint ConcGCThreads = 1 {product} {ergonomic}
|
|
uint ParallelGCThreads = 1 {product} {default}
|
|
|
|
--- JDK27, --cpus=1, -XX:ActiveProcessorCount=8 (lying) ---
|
|
int ActiveProcessorCount = 8 {product} {command line}
|
|
uint ConcGCThreads = 2 {product} {ergonomic}
|
|
uint ParallelGCThreads = 8 {product} {default}
|