-
Bug
-
Resolution: Fixed
-
P4
-
11, 17, 21, 24
-
b23
-
x86_64
-
linux
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8345983 | 21.0.7 | Martin Doerr | P4 | Resolved | Fixed | master |
A DESCRIPTION OF THE PROBLEM :
possibly_add_compiler_threads always fetches the free memory, before considering if a compiler thread is required, which we've observed causing performance issues with both cgroupv1 and cgroupv2 due to the frequency of polling (even with the mitigations added inJDK-8232207), particularly with large running large numbers of relatively short lived tasks on container platforms.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Believe this is enough to demonstrate the correlation between compilations and calls:
java -Xlog:os+container=trace,jit+compilation=debug
[0.000s][trace][os,container] OSContainer::init: Initializing Container Support
[0.000s][debug][os,container] Detected optional pids controller entry in /proc/cgroups
[0.001s][debug][os,container] Detected cgroups v2 unified hierarchy
[0.001s][trace][os,container] Path to /cpu.max is /sys/fs/cgroup/cpu.max
[0.001s][trace][os,container] CPU Quota is: 400000
[0.001s][trace][os,container] Path to /cpu.max is /sys/fs/cgroup/cpu.max
[0.001s][trace][os,container] CPU Period is: 100000
[0.001s][trace][os,container] CPU Quota count based on quota/period: 4
[0.001s][trace][os,container] OSContainer::active_processor_count: 4
[0.004s][trace][os,container] CgroupSubsystem::active_processor_count (cached): 4
[0.004s][trace][os,container] total physical memory: 790776565760
[0.004s][trace][os,container] Path to /memory.max is /sys/fs/cgroup/memory.max
[0.004s][trace][os,container] Memory Limit is: 8589934592
[0.005s][trace][os,container] CgroupSubsystem::active_processor_count (cached): 4
[0.025s][trace][os,container] Path to /cpu.max is /sys/fs/cgroup/cpu.max
[0.025s][trace][os,container] CPU Quota is: 400000
[0.025s][trace][os,container] Path to /cpu.max is /sys/fs/cgroup/cpu.max
[0.025s][trace][os,container] CPU Period is: 100000
[0.025s][trace][os,container] CPU Quota count based on quota/period: 4
[0.025s][trace][os,container] OSContainer::active_processor_count: 4
[0.029s][debug][jit,compilation] 1 3 java.lang.String::hashCode (60 bytes)
[0.029s][trace][os,container ] total physical memory: 790776565760
[0.029s][trace][os,container ] Path to /memory.max is /sys/fs/cgroup/memory.max
[0.029s][trace][os,container ] Memory Limit is: 8589934592
[0.029s][trace][os,container ] Path to /memory.current is /sys/fs/cgroup/memory.current
[0.029s][trace][os,container ] Memory Usage is: 8166121472
[0.030s][debug][jit,compilation] 2 3 java.lang.Object::<init> (1 bytes)
[0.030s][trace][os,container ] Path to /memory.current is /sys/fs/cgroup/memory.current
[0.030s][trace][os,container ] Memory Usage is: 8166121472
[0.030s][debug][jit,compilation] 3 n 0 jdk.internal.misc.Unsafe::getReferenceVolatile (native)
[0.030s][debug][jit,compilation] 4 n 0 jdk.internal.vm.Continuation::enterSpecial (native) (static)
[0.030s][debug][jit,compilation] 5 n 0 jdk.internal.vm.Continuation::doYield (native) (static)
[0.031s][debug][jit,compilation] 6 3 java.lang.Byte::toUnsignedInt (6 bytes)
[0.031s][trace][os,container ] Path to /memory.current is /sys/fs/cgroup/memory.current
[0.031s][trace][os,container ] Memory Usage is: 8166383616
[0.032s][debug][jit,compilation] 7 3 java.lang.String::coder (15 bytes)
[0.032s][trace][os,container ] Path to /memory.current is /sys/fs/cgroup/memory.current
[0.032s][trace][os,container ] Memory Usage is: 8166383616
[0.032s][debug][jit,compilation] 10 3 java.lang.String::isLatin1 (19 bytes)
[0.032s][trace][os,container ] Path to /memory.current is /sys/fs/cgroup/memory.current
[0.032s][trace][os,container ] Memory Usage is: 8166383616
[0.032s][debug][jit,compilation] 8 3 jdk.internal.util.Preconditions::checkIndex (18 bytes)
[0.032s][trace][os,container ] Path to /memory.current is /sys/fs/cgroup/memory.current
[0.032s][trace][os,container ] Memory Usage is: 8166383616
[0.032s][debug][jit,compilation] 9 3 java.lang.String::charAt (25 bytes)
[0.032s][trace][os,container ] Path to /memory.current is /sys/fs/cgroup/memory.current
[0.032s][trace][os,container ] Memory Usage is: 8166383616
[0.032s][debug][jit,compilation] 11 n 0 java.lang.Object::hashCode (native)
[0.032s][debug][jit,compilation] 12 n 0 java.lang.invoke.MethodHandle::linkToStatic(LLLLLLL)L (native) (static)
[0.033s][debug][jit,compilation] 13 1 java.lang.Enum::ordinal (5 bytes)
[0.033s][trace][os,container ] Path to /memory.current is /sys/fs/cgroup/memory.current
[0.033s][trace][os,container ] Memory Usage is: 8166383616
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Free memory is only considered if a thread would otherwise be added.
ACTUAL -
Free memory is considered for each compiler loop iteration.
CUSTOMER SUBMITTED WORKAROUND :
Configure -XX:-UseDynamicNumberOfCompilerThreads
FREQUENCY : often
possibly_add_compiler_threads always fetches the free memory, before considering if a compiler thread is required, which we've observed causing performance issues with both cgroupv1 and cgroupv2 due to the frequency of polling (even with the mitigations added in
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Believe this is enough to demonstrate the correlation between compilations and calls:
java -Xlog:os+container=trace,jit+compilation=debug
[0.000s][trace][os,container] OSContainer::init: Initializing Container Support
[0.000s][debug][os,container] Detected optional pids controller entry in /proc/cgroups
[0.001s][debug][os,container] Detected cgroups v2 unified hierarchy
[0.001s][trace][os,container] Path to /cpu.max is /sys/fs/cgroup/cpu.max
[0.001s][trace][os,container] CPU Quota is: 400000
[0.001s][trace][os,container] Path to /cpu.max is /sys/fs/cgroup/cpu.max
[0.001s][trace][os,container] CPU Period is: 100000
[0.001s][trace][os,container] CPU Quota count based on quota/period: 4
[0.001s][trace][os,container] OSContainer::active_processor_count: 4
[0.004s][trace][os,container] CgroupSubsystem::active_processor_count (cached): 4
[0.004s][trace][os,container] total physical memory: 790776565760
[0.004s][trace][os,container] Path to /memory.max is /sys/fs/cgroup/memory.max
[0.004s][trace][os,container] Memory Limit is: 8589934592
[0.005s][trace][os,container] CgroupSubsystem::active_processor_count (cached): 4
[0.025s][trace][os,container] Path to /cpu.max is /sys/fs/cgroup/cpu.max
[0.025s][trace][os,container] CPU Quota is: 400000
[0.025s][trace][os,container] Path to /cpu.max is /sys/fs/cgroup/cpu.max
[0.025s][trace][os,container] CPU Period is: 100000
[0.025s][trace][os,container] CPU Quota count based on quota/period: 4
[0.025s][trace][os,container] OSContainer::active_processor_count: 4
[0.029s][debug][jit,compilation] 1 3 java.lang.String::hashCode (60 bytes)
[0.029s][trace][os,container ] total physical memory: 790776565760
[0.029s][trace][os,container ] Path to /memory.max is /sys/fs/cgroup/memory.max
[0.029s][trace][os,container ] Memory Limit is: 8589934592
[0.029s][trace][os,container ] Path to /memory.current is /sys/fs/cgroup/memory.current
[0.029s][trace][os,container ] Memory Usage is: 8166121472
[0.030s][debug][jit,compilation] 2 3 java.lang.Object::<init> (1 bytes)
[0.030s][trace][os,container ] Path to /memory.current is /sys/fs/cgroup/memory.current
[0.030s][trace][os,container ] Memory Usage is: 8166121472
[0.030s][debug][jit,compilation] 3 n 0 jdk.internal.misc.Unsafe::getReferenceVolatile (native)
[0.030s][debug][jit,compilation] 4 n 0 jdk.internal.vm.Continuation::enterSpecial (native) (static)
[0.030s][debug][jit,compilation] 5 n 0 jdk.internal.vm.Continuation::doYield (native) (static)
[0.031s][debug][jit,compilation] 6 3 java.lang.Byte::toUnsignedInt (6 bytes)
[0.031s][trace][os,container ] Path to /memory.current is /sys/fs/cgroup/memory.current
[0.031s][trace][os,container ] Memory Usage is: 8166383616
[0.032s][debug][jit,compilation] 7 3 java.lang.String::coder (15 bytes)
[0.032s][trace][os,container ] Path to /memory.current is /sys/fs/cgroup/memory.current
[0.032s][trace][os,container ] Memory Usage is: 8166383616
[0.032s][debug][jit,compilation] 10 3 java.lang.String::isLatin1 (19 bytes)
[0.032s][trace][os,container ] Path to /memory.current is /sys/fs/cgroup/memory.current
[0.032s][trace][os,container ] Memory Usage is: 8166383616
[0.032s][debug][jit,compilation] 8 3 jdk.internal.util.Preconditions::checkIndex (18 bytes)
[0.032s][trace][os,container ] Path to /memory.current is /sys/fs/cgroup/memory.current
[0.032s][trace][os,container ] Memory Usage is: 8166383616
[0.032s][debug][jit,compilation] 9 3 java.lang.String::charAt (25 bytes)
[0.032s][trace][os,container ] Path to /memory.current is /sys/fs/cgroup/memory.current
[0.032s][trace][os,container ] Memory Usage is: 8166383616
[0.032s][debug][jit,compilation] 11 n 0 java.lang.Object::hashCode (native)
[0.032s][debug][jit,compilation] 12 n 0 java.lang.invoke.MethodHandle::linkToStatic(LLLLLLL)L (native) (static)
[0.033s][debug][jit,compilation] 13 1 java.lang.Enum::ordinal (5 bytes)
[0.033s][trace][os,container ] Path to /memory.current is /sys/fs/cgroup/memory.current
[0.033s][trace][os,container ] Memory Usage is: 8166383616
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Free memory is only considered if a thread would otherwise be added.
ACTUAL -
Free memory is considered for each compiler loop iteration.
CUSTOMER SUBMITTED WORKAROUND :
Configure -XX:-UseDynamicNumberOfCompilerThreads
FREQUENCY : often
- backported by
-
JDK-8345983 CompileBroker::possibly_add_compiler_threads excessively polls available memory
- Resolved
- relates to
-
JDK-8198756 Lazy allocation of compiler threads
- Resolved
- links to
-
Commit(master) openjdk/jdk21u-dev/3087c6c7
-
Commit(master) openjdk/jdk/75801992
-
Review(master) openjdk/jdk17u-dev/3106
-
Review(master) openjdk/jdk21u-dev/1123
-
Review(master) openjdk/jdk23u/214
-
Review(master) openjdk/jdk/21812
(3 links to)