Kubernetes allows you to deploy various types of containerized applications on the same node. This causes applications with different priorities to compete for CPU resources. As a result, the performance of the applications with high priorities cannot be guaranteed. The ack-slo-manager component allows you to use quality of service (QoS) classes to guarantee CPU resources for applications with high priorities. This topic describes how to configure the CPU QoS feature for pods.
Prerequisites
- An Container Service for Kubernetes (ACK) Pro cluster is created. The CPU QoS feature applies only to ACK Pro clusters. For more information, see Create an ACK Pro cluster.
- A kubectl client is connected to the ACK Pro cluster. For more information, see Connect to ACK clusters by using kubectl.
- The ack-slo-manager component is installed. For more information, see Usage notes.
Background information
To fully utilize computing resources, workloads of different priorities are usually deployed on the same node. For example, latency-sensitive (LS) workloads (with high priorities) and best-effort (BE) workloads (with low priorities) can be deployed on the same node. However, this may cause these workloads to compete for computing resources. In Kubernetes, CPU requests and CPU limits are used to control the amount of CPU resources that pods can use. However, pods may still compete for CPU resources. For example, BE pods and LS pods can share CPU cores or vCPU cores. When the loads of the BE pods increase, the performance of the LS pods is compromised. As a result, the response latency of the application that uses the LS pods increases.
To reduce the performance impact on the BE pods in this scenario, you can use the CPU QoS feature provided by the ack-slo-manager component to limit the CPU usage of the LS pods. The CPU QoS feature is based on Alibaba Cloud Linux 2. The ack-slo-manager component allows you to use the group identity feature available in Alibaba Cloud Linux 2 to configure Linux scheduling priorities for pods. In an environment where both LS pods and BE pods are deployed, you can set the priority of LS pods to high and the priority of BE pods to low to avoid resource contention. The LS pods are prioritized to use the limited CPU resources to ensure the service quality of the corresponding application. For more information about the group identity feature, see Group identity feature.
- The wake-up latency of tasks for LS workloads is minimized.
- Waking up tasks for BE workloads does not adversely impact the performance of LS pods.
- Tasks for BE workloads cannot use the simultaneous multithreading (SMT) scheduler to share CPU cores. This further reduces the impact on the performance of LS pods.
Limits
The following table describes the versions of the system components that are required for using the CPU QoS feature.
Component | Required version |
---|---|
Kubernetes | 1.18 and later |
ack-slo-manager | 0.5.2 and later |
Helm | 3.0 and later |
Operating system | Alibaba Cloud Linux 2 (For more information, see Group identity feature) |