Overcommit Ratio

TOC

UnderStanding Namespace Resource Overcommit Ratio

allows you to set a resource overcommit ratio (CPU and memory) per namespace. This manages the relationship between container limits (maximum usage) and requests (guaranteed minimum) within that namespace, optimizing resource utilization.

By configuring this ratio, you ensure user-defined container limits and requests remain within reasonable bounds, improving overall cluster resource efficiency.

Key Concepts

  • Limits: The maximum resource a container can use. Exceeding limits can lead to throttling (CPU) or termination (memory).
  • Requests: The guaranteed minimum resource a container needs. Kubernetes schedules containers based on these requests.
  • Overcommit Ratio: Limits / Requests. This setting defines the acceptable range for this ratio within the namespace, balancing resource guarantees and preventing over-consumption.

Core Capabilities

  • Enhance resource density and application stability within the namespace by setting an appropriate overcommit ratio to manage the balance between resource limits and 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.

CRD Define

# example-namespace-overcommit.yaml
apiVersion: resource.alauda.io/v1
kind: NamespaceResourceRatio
metadata:
  namespace: example
  name: example-namespace-overcommit
spec:
  cpu: 3 # Absence of this field indicates inheritance of the cluster overcommit ratio; 0 means no limitation.
  memory: 4 # Absence of this field indicates inheritance of the cluster overcommit ratio; 0 means no limitation.
status:
  clusterCPU: 2 # Cluster Overcommit Ratio
  clusterMemory: 3

Creating overcommit ratio by using CLI

kubectl apply -f example-namespace-overcommit.yaml

Creating/Updating Overcommit Ratio by using web console

Allows adjusting the overcommit ratio for a namespace to manage the ratio between resource limits and requests. This ensures container's resource allocations remain within defined bounds, improving cluster resource utilization.

Precautions

If the cluster uses node virtualization (e.g., virtual nodes), disable oversubscription at the cluster/namespace level before configuring it for virtual machines.

Procedure

  1. Enter the Project Management and navigation to Namespaces > Namespace List.

  2. Click the target Namespace name.

  3. Click Actions > Update Overcommit.

  4. Select the appropriate overcommit ratio configuration method to set the CPU or memory overcommit ratio for the namespace.

ParameterDescription
Inherit from Cluster
  • Namespace inherits the cluster’s oversubscription ratio.
  • Example: If cluster CPU/memory ratio is 4, namespace defaults to 4.
  • Container requests = limit / cluster ratio.
  • If no limit is set, use the namespace’s default container quota.
Custom
  • Set a namespace-specific ratio (integer > 1).
  • Example: Cluster ratio = 4, namespace ratio = 2 → requests = limit / 2.
  • Leave empty to disable oversubscription for the namespace.
  1. Click Update.

Note: Changes apply only to newly created Pods. Existing Pods retain their original requests until rebuilt.