[8u-dev] Request for enhancement backport approval for CR JDK-8146115: Improve docker container detection and resource configuration usage

Poonam Parhar poonam.bajaj at oracle.com
Fri Jul 6 13:33:06 UTC 2018


Hello,

Please approve the following enhancement backport request:

Enhancement: JDK-8146115 
<https://bugs.openjdk.java.net/browse/JDK-8146115>: Improve docker 
container detection and resource configuration usage
Webrev: http://cr.openjdk.java.net/~poonam/8146115/webrev.02/
Review Thread: 
http://mail.openjdk.java.net/pipermail/hotspot-dev/2018-May/032261.html

The changes also include the fixes for the following two bugs:
Bug JDK-8186248 <https://bugs.openjdk.java.net/browse/JDK-8186248>: 
Allow more flexibility in selecting Heap % of available RAM
Bug JDK-8190283 <https://bugs.openjdk.java.net/browse/JDK-8190283>: 
Default heap sizing options select a MaxHeapSize larger than available 
physical memory in some cases

This enhancement needs to be backported to enable 8u JVM to correctly 
detect the CPU and memory resources configured for a Docker 
environment.The backported changes will also add 8 a new publicly 
visible command-line JVM option. There is no risk involved with this 
backport.

Extensive manual testing was done with the backported changes. Please 
find the testing results below (done with -XX:+UnlockDiagnosticVMOptions 
-XX:+PrintContainerInfo -XX:+PrintActiveCpus JVM options).

Thanks,
Poonam

/--------------
poonam at poonam-VirtualBox:~/docker-image$ java TestCPUsMemory
Number of Processors: 3
Max Memory: 921174016
poonam at poonam-VirtualBox:~/docker-image$ sudo docker run --cpus 1 
-m1024m  --rm myimage
[sudo] password for poonam:
WARNING: Your kernel does not support swap limit capabilities or the 
cgroup is not mounted. Memory limited without swap.
OSContainer::init: Initializing Container Support
Path to /memory.limit_in_bytes is 
/sys/fs/cgroup/memory/memory.limit_in_bytes
Memory Limit is: 1073741824
active_processor_count: sched_getaffinity processor count: 3
Path to /cpu.cfs_quota_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_quota_us
CPU Quota is: 100000
Path to /cpu.cfs_period_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_period_us
CPU Period is: 100000
Path to /cpu.shares is /sys/fs/cgroup/cpu,cpuacct/cpu.shares
CPU Shares is: 1024
CPU Quota count based on quota/period: 1
OSContainer::active_processor_count: 1
active_processor_count: determined by OSContainer: 1
active_processor_count: sched_getaffinity processor count: 3
Path to /cpu.cfs_quota_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_quota_us
CPU Quota is: 100000
Path to /cpu.cfs_period_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_period_us
CPU Period is: 100000
Path to /cpu.shares is /sys/fs/cgroup/cpu,cpuacct/cpu.shares
CPU Shares is: 1024
CPU Quota count based on quota/period: 1
OSContainer::active_processor_count: 1
active_processor_count: determined by OSContainer: 1
Path to /memory.limit_in_bytes is 
/sys/fs/cgroup/memory/memory.limit_in_bytes
Memory Limit is: 1073741824
total container memory: 1073741824
active_processor_count: sched_getaffinity processor count: 3
Path to /cpu.cfs_quota_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_quota_us
CPU Quota is: 100000
Path to /cpu.cfs_period_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_period_us
CPU Period is: 100000
Path to /cpu.shares is /sys/fs/cgroup/cpu,cpuacct/cpu.shares
CPU Shares is: 1024
CPU Quota count based on quota/period: 1
OSContainer::active_processor_count: 1
active_processor_count: determined by OSContainer: 1
active_processor_count: sched_getaffinity processor count: 3
Path to /cpu.cfs_quota_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_quota_us
CPU Quota is: 100000
Path to /cpu.cfs_period_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_period_us
CPU Period is: 100000
Path to /cpu.shares is /sys/fs/cgroup/cpu,cpuacct/cpu.shares
CPU Shares is: 1024
CPU Quota count based on quota/period: 1
OSContainer::active_processor_count: 1
active_processor_count: determined by OSContainer: 1

active_processor_count: sched_getaffinity processor count: 3
Path to /cpu.cfs_quota_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_quota_us
CPU Quota is: 100000
Path to /cpu.cfs_period_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_period_us
CPU Period is: 100000
Path to /cpu.shares is /sys/fs/cgroup/cpu,cpuacct/cpu.shares
CPU Shares is: 1024
CPU Quota count based on quota/period: 1
OSContainer::active_processor_count: 1
active_processor_count: determined by OSContainer: 1
Number of Processors: 1
Max Memory: 259522560

poonam at poonam-VirtualBox:~/docker-image$ sudo docker run --cpu-shares 
2048 -m1024m  --rm myimage
WARNING: Your kernel does not support swap limit capabilities or the 
cgroup is not mounted. Memory limited without swap.
OSContainer::init: Initializing Container Support
Path to /memory.limit_in_bytes is 
/sys/fs/cgroup/memory/memory.limit_in_bytes
Memory Limit is: 1073741824
active_processor_count: sched_getaffinity processor count: 3
Path to /cpu.cfs_quota_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_quota_us
CPU Quota is: -1
Path to /cpu.cfs_period_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_period_us
CPU Period is: 100000
Path to /cpu.shares is /sys/fs/cgroup/cpu,cpuacct/cpu.shares
CPU Shares is: 2048
CPU Share count based on shares: 2
OSContainer::active_processor_count: 2
active_processor_count: determined by OSContainer: 2
active_processor_count: sched_getaffinity processor count: 3
Path to /cpu.cfs_quota_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_quota_us
CPU Quota is: -1
Path to /cpu.cfs_period_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_period_us
CPU Period is: 100000
Path to /cpu.shares is /sys/fs/cgroup/cpu,cpuacct/cpu.shares
CPU Shares is: 2048
CPU Share count based on shares: 2
OSContainer::active_processor_count: 2
active_processor_count: determined by OSContainer: 2
Path to /memory.limit_in_bytes is 
/sys/fs/cgroup/memory/memory.limit_in_bytes
Memory Limit is: 1073741824
total container memory: 1073741824
Path to /memory.limit_in_bytes is 
/sys/fs/cgroup/memory/memory.limit_in_bytes
Memory Limit is: 1073741824
total container memory: 1073741824
active_processor_count: sched_getaffinity processor count: 3
Path to /cpu.cfs_quota_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_quota_us
CPU Quota is: -1
Path to /cpu.cfs_period_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_period_us
CPU Period is: 100000
Path to /cpu.shares is /sys/fs/cgroup/cpu,cpuacct/cpu.shares
CPU Shares is: 2048
CPU Share count based on shares: 2
OSContainer::active_processor_count: 2
active_processor_count: determined by OSContainer: 2
active_processor_count: sched_getaffinity processor count: 3
Path to /cpu.cfs_quota_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_quota_us
CPU Quota is: -1
Path to /cpu.cfs_period_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_period_us
CPU Period is: 100000
Path to /cpu.shares is /sys/fs/cgroup/cpu,cpuacct/cpu.shares
CPU Shares is: 2048
CPU Share count based on shares: 2
OSContainer::active_processor_count: 2
active_processor_count: determined by OSContainer: 2

active_processor_count: sched_getaffinity processor count: 3
Path to /cpu.cfs_quota_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_quota_us
CPU Quota is: -1
Path to /cpu.cfs_period_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_period_us
CPU Period is: 100000
Path to /cpu.shares is /sys/fs/cgroup/cpu,cpuacct/cpu.shares
CPU Shares is: 2048
CPU Share count based on shares: 2
OSContainer::active_processor_count: 2
active_processor_count: determined by OSContainer: 2
Number of Processors: 2
Max Memory: 259522560

poonam at poonam-VirtualBox:~/docker-image$ sudo docker run --cpuset-cpus 
0-1 -m1024m  --rm myimage
WARNING: Your kernel does not support swap limit capabilities or the 
cgroup is not mounted. Memory limited without swap.
OSContainer::init: Initializing Container Support
Path to /memory.limit_in_bytes is 
/sys/fs/cgroup/memory/memory.limit_in_bytes
Memory Limit is: 1073741824
active_processor_count: sched_getaffinity processor count: 2
Path to /cpu.cfs_quota_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_quota_us
CPU Quota is: -1
Path to /cpu.cfs_period_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_period_us
CPU Period is: 100000
Path to /cpu.shares is /sys/fs/cgroup/cpu,cpuacct/cpu.shares
CPU Shares is: 1024
OSContainer::active_processor_count: 2
active_processor_count: determined by OSContainer: 2
active_processor_count: sched_getaffinity processor count: 2
Path to /cpu.cfs_quota_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_quota_us
CPU Quota is: -1
Path to /cpu.cfs_period_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_period_us
CPU Period is: 100000
Path to /cpu.shares is /sys/fs/cgroup/cpu,cpuacct/cpu.shares
CPU Shares is: 1024
OSContainer::active_processor_count: 2
active_processor_count: determined by OSContainer: 2
Path to /memory.limit_in_bytes is 
/sys/fs/cgroup/memory/memory.limit_in_bytes
Memory Limit is: 1073741824
total container memory: 1073741824
Path to /memory.limit_in_bytes is 
/sys/fs/cgroup/memory/memory.limit_in_bytes
Memory Limit is: 1073741824
total container memory: 1073741824
active_processor_count: sched_getaffinity processor count: 2
Path to /cpu.cfs_quota_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_quota_us
CPU Quota is: -1
Path to /cpu.cfs_period_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_period_us
CPU Period is: 100000
Path to /cpu.shares is /sys/fs/cgroup/cpu,cpuacct/cpu.shares
CPU Shares is: 1024
OSContainer::active_processor_count: 2
active_processor_count: determined by OSContainer: 2
active_processor_count: sched_getaffinity processor count: 2
Path to /cpu.cfs_quota_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_quota_us
CPU Quota is: -1
Path to /cpu.cfs_period_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_period_us
CPU Period is: 100000
Path to /cpu.shares is /sys/fs/cgroup/cpu,cpuacct/cpu.shares
CPU Shares is: 1024
OSContainer::active_processor_count: 2
active_processor_count: determined by OSContainer: 2

active_processor_count: sched_getaffinity processor count: 2
Path to /cpu.cfs_quota_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_quota_us
CPU Quota is: -1
Path to /cpu.cfs_period_us is /sys/fs/cgroup/cpu,cpuacct/cpu.cfs_period_us
CPU Period is: 100000
Path to /cpu.shares is /sys/fs/cgroup/cpu,cpuacct/cpu.shares
CPU Shares is: 1024
OSContainer::active_processor_count: 2
active_processor_count: determined by OSContainer: 2
Number of Processors: 2
Max Memory: 259522560
------------------ /


More information about the jdk8u-dev mailing list