-
Bug
-
Resolution: Fixed
-
P2
-
10
-
Docker container
-
b03
-
x86
-
linux
-
Verified
JDK 10 included an enhancement (JDK-8146115) which allowed the JVM to determine the number of processors it should use based on information extracted from the Linux cgroup file system. The algorithm used to select the number of processors was:
min(cpu shares, cpu quota/cpu period, physical cpus) *
*if cpu shares or quotas were not specified or configured, they are not included in the calculation.
This algorithm assumed that developers would select either cpu shares or quotas and not both. There are popular use cases (Kubernetes) which use both cpu shares and cpu quotas in order to provide a minimum to maximum range of cpu resource limits. Since our formula always selects the minimum, we were potentially underutilizing the host system cpu resources.
The solution is to alter the formula to provide two modes when both cpu shares and quotas are set. If the flag PreferContainerQuotaForCPUCount is set to true, take the cpu quota value, if provided, without exceeding the number of physical cpus on the system. If the flag PreferContainerQuotaForCPUCount is false, use the minimum of cpu shares or cpu quotas, if set, without exceeding the number of physical cpus in the system. If only one of cpu shares or cpu quotas is provided, then use the specified value limited by the number of physical processors in the system.
min(cpu shares, cpu quota/cpu period, physical cpus) *
*if cpu shares or quotas were not specified or configured, they are not included in the calculation.
This algorithm assumed that developers would select either cpu shares or quotas and not both. There are popular use cases (Kubernetes) which use both cpu shares and cpu quotas in order to provide a minimum to maximum range of cpu resource limits. Since our formula always selects the minimum, we were potentially underutilizing the host system cpu resources.
The solution is to alter the formula to provide two modes when both cpu shares and quotas are set. If the flag PreferContainerQuotaForCPUCount is set to true, take the cpu quota value, if provided, without exceeding the number of physical cpus on the system. If the flag PreferContainerQuotaForCPUCount is false, use the minimum of cpu shares or cpu quotas, if set, without exceeding the number of physical cpus in the system. If only one of cpu shares or cpu quotas is provided, then use the specified value limited by the number of physical processors in the system.
- csr for
-
JDK-8197867 Update CPU count algorithm when both cpu shares and quotas are used
- Closed
- relates to
-
JDK-8146115 Improve docker container detection and resource configuration usage
- Resolved
-
JDK-8281181 Do not use CPU Shares to compute active processor count
- Resolved