Overcommit Ratio
TIP
The cluster needs to have overcommit ratio enabled in order to set the namespace overcommit ratio.
What is the overcommit ratio?
You can set the overcommit ratio separately for the namespace based on the resource requirements for CPU and memory in the current namespace. This ensures that the limit and request values for containers set by users in this namespace are within a reasonable range, thereby improving the utilization of computing resources.
- Limits: The maximum amount of resources that a container can use during runtime. The resource usage during container runtime cannot exceed this value.
- Requests: The amount of resources that a container requests when it is created. When Kubernetes schedules containers, it judges based on this value and schedules the container to run on a node where the available resources meet the container’s request value. If there is no node that meets the requirement (for example, when the request value is greater than the available resources on the schedulable nodes), the container cannot start normally.
- Overcommit Ratio: The ratio of limits to requests(limits/requests).
Example
Assuming the namespace overcommit ratio is set to 2, when creating an application and specifies a CPU limit of 4c, the corresponding CPU request value is calculated as:
CPU Request = CPU Limit / Overcommit Ratio
Thus, the CPU request becomes 4c / 2 = 2c.
Update Overcommit Ratio
Update the overcommit ratio for the created namespace. You can refer to the resource demands for CPU and memory within the current namespace to individually set the overcommit ratio for the namespace, thus limiting the container CPU and memory limit (limits) and request (requests) values set by users within the namespace to a reasonable range to enhance the utilization of computing resources.
Precautions
In clusters with node virtualization enabled, if you need to configure the virtual machine overcommit ratio, you must first disable the overcommit ratio of the cluster or namespace.
Procedure
-
Enter the Project Management view.
-
In the left navigation bar, click Namespaces > Namespaces.
-
Click on the namespace name to be updated.
-
Click on Actions in the upper right corner > Update Overcommit Ratio.
-
Select the appropriate overcommit ratio configuration method to set the CPU or memory overcommit ratio for the namespace.
Parameter | Description |
---|
Inherit from Cluster | - The overcommit ratio of the namespace defaults to inherit from the cluster, the value displays the overcommit ratio settings of the originating cluster. For example, if the CPU and memory overcommit ratios of the cluster are both set to 4, then the CPU and memory overcommit ratios of the current namespace default to 4.
- When creating an application, the container's request value is fixed at specified limit value/cluster overcommit ratio. If no limit value is specified, the limit value is set to the default value in the container quota of the namespace.
- Example: Assume the CPU resource overcommit ratio of the cluster is set to 4, and the namespace overcommit ratio inherits from the cluster. When a user creates an application and specifies a CPU limit value of 4c, the CPU request value will be 4c/4 = 1c.
|
Custom | - The namespace overcommit ratio value is determined by the administrator's custom settings, only supporting positive integers greater than 1; if left blank, it indicates that the current namespace has no overcommit ratio.
For example, if the CPU and memory overcommit ratios of the cluster are both set to 4, and custom values here are both set to 2, then the CPU and memory overcommit ratios of the current namespace are both 2; if no custom values are provided here, it indicates that the CPU and memory of the current namespace have no overcommit ratio set.
- When creating an application, the container's request value is fixed at specified limit value/namespace overcommit ratio. If no limit value is specified, the limit value is set to the default value in the container quota of the namespace.
- Example: Assume the CPU resource overcommit ratio of the cluster is set to 4, and the namespace overcommit ratio is customized to 2. When a user creates an application specifying a CPU limit value of 4c, the CPU request value will be 4c/2 = 2c.
|
- Click Update.
Note: Updating the overcommit ratio does not affect the request values of currently running containers. However, upon Pod recreation, the container's request values will be recalculated based on the updated overcommit ratio.