Updated on 2024-06-11 GMT+08:00

Resource Flavors

Overview

The bursting add-on can select appropriate pod flavors based on the CPU and memory of the workloads to improve resource utilization. This section describes how appropriate pod flavors are selected.

Constraints

At least one container in each pod to be scheduled to CCI must have the CPU limit or request.

How Pod Flavors Are Calculated

The pod flavors are calculated based on the following rules:

Requests and limits of resource X are set to the same value for all app containers and init containers. If a limit is configured, the limit will be applied. If no limit is configured, the request will be applied. Example:

If Pod P = {init_container_A, init_container_B, C, D, E}, the limit of pod P for resource X is pod_P_resource_X_Limit, and the limit of container C for resource X is C_X,

then pod_P_resource_X_Limit = max(sum(C_x, D_x, E_x), max(init_container_A, init_container_B)).

How Resource Quotas Are Rounded Up

You need to enter a set of valid CPU values based on the following formula:

C = {{c | c ∈ [0.25, 32]}, 48, 64}

Enter the number of CPU cores and the memory size (GiB).

  • CPU = ceil(CPU / 0.25) * 0.25 , MEM = ceil(MEM)
  • IF MEM / CPU > 8
    • CPU = MEM/8
    • CPU = ceil(CPU/0.25) x 0.25
    • If CPU ∉ C, an error will be reported.
  • IF MEM/CPU < 2
    • MEM = 2 x CPU
    • MEM = ceil(MEM)
  • The CPU and memory increments caused by the adjustment are added to the first non-BestEffort app container.
  • You can view the flavors rounded up using the annotation of the pod in CCE.
  • virtual-kubelet.cci.io/burst-pod-cpu: 500mvirtual-kubelet.cci.io/burst-pod-memory: 1Gi
  • A pod to be scheduled to CCI must meet the following conditions:
    • CPU∈{{c | c ∈ [0.25, 32]}, 48, 64}; an integer multiple of 0.25
    • MEM/CPU ∈ [2, 8]
    • MEM∈{{m | m ∈ [1, 256]}, 384, 512}; an integer

Cases of Rounding Up Resource Flavors

Resource Flavors (CPU and Memory)

Flavors Rounded Up (CPU and Memory)

Description

37 cores, 37 GiB

The workloads cannot be scheduled to CCI.

Invalid CPU quota.

30 cores, 257 GiB

The workloads cannot be scheduled to CCI.

If the ratio of memory to CPU is greater than 8, the CPU is increased. However, the CPU quota cannot be met.

0.35 cores, 0.5 GiB

0.5 cores, 1 GiB

The number of CPU cores is rounded up to an integer multiple of 0.25 and the memory size to an integer multiple of 1. The ratio of memory to CPU meets the requirements and does not need to be adjusted.

0.35 cores, 1.5 GiB

0.5 cores, 2 GiB

The number of CPU cores is rounded up to an integer multiple of 0.25 and the memory size to an integer multiple of 1. The ratio of memory to CPU meets the requirements and does not need to be adjusted.

0.45 cores, 18 GiB

2.25 cores, 18 GiB

The number of CPU cores is rounded up to an integer multiple of 0.25 and the memory size to an integer multiple of 1. If the ratio of memory to CPU is greater than 8, the CPU is increased.

2 cores, 2 GiB

2 cores, 4 GiB

If the ratio of memory to CPU is less than 2, the memory is increased.