This topic describes best practices for CPU Burst capabilities.
In containerized environments, setting CPU limits for containers is a common resource isolation method. When a service experiences sudden traffic spikes, containers may suffer from CPU throttling, leading to degraded service quality, such as increased request latency and reduced throughput.
CPU Burst is an elastic CPU resource capability provided by Katalyst. It dynamically detects the CPU Throttled status of containers and adaptively adjusts their CPU parameters. When sudden load spikes occur, CPU Burst temporarily provides containers with CPU resources beyond their CPU limits, mitigating performance bottlenecks caused by CPU throttling and ensuring the service quality of latency-sensitive applications. For more feature details, see Using pod CPU Burst capabilities. CPU Burst is mainly suitable for the following three typical scenarios.
Millisecond-level short burst traffic
- Typical manifestation: Pod CPU is throttled by CFS Quota, with P99 latency spikes lasting for milliseconds.
- Recommended policy: cpuBurstOnly (enable kernel Burst) or auto (adaptively enable both cpuBurstOnly and cfsQuotaBurstOnly capabilities).
- Expected outcome: Borrow unused CPU quota in kernel space, significantly reducing P99 latency.
- Applicable services: Web services, API Gateway, microservices, and other latency-sensitive online services.
Sustained high load lasting for seconds to minutes
- Typical manifestation: Kernel Burst credits are quickly exhausted, throttling is still triggered, TPS drops, lasting from seconds to minutes.
- Recommended policy: auto.
- Expected outcome: CFS Quota is dynamically increased in userspace, with both TPS and P99 improving simultaneously.
- Applicable services: Sustained high-load services such as Elasticsearch search engine, middleware services, and database proxies.
CPU-intensive during application startup
- Typical manifestation: CPU demand greatly exceeds the steady-state needs during app initialization (e.g., JVM warm-up or class loading), leading to excessively long startup times.
- Recommended policy: cpuBurstOnly or auto.
- Expected outcome: Allow containers to temporarily use more CPU resources during startup, accelerating application readiness.
- Applicable services: Java applications and AI inference services requiring warm-up.
Before using CPU Burst capabilities, ensure that the following conditions are met:
- The katalyst add-on of v0.5.13-vke.14 or later has been deployed in the cluster, and CPU Burst-related configurations have been enabled. For details, see Katalyst.
- The node or node pool where the target pod resides has been added with the Label: vke.node.katalyst.deploy=true. For details, see Adding labels to nodes.
Recommended best configurations for features
The katalyst provides four CPU Burst policies. You can select the appropriate policy based on your workload characteristics.
Recommended parameter configurations
Typical scenario configurations
The following provides complete configuration examples for two typical scenarios. The scenario descriptions, operation steps, and verification steps are included in these examples.
Scenario 1: Online web service
Scenario 2: Sustained high-load services
Suitable for most online services, such as Nginx, API gateways, and microservices. This scenario primarily involves short-duration traffic bursts. After enabling the auto policy, good results can be obtained with default settings for the remaining parameters.
- In the pod's metadata.annotations, add the katalysty.kubewharf.io/cpu_enhancement annotation and enable the auto policy for CPU Burst.
- On the node where the pod resides, confirm whether kernel CPU Burst is enabled. For detailed operations, see Verifying results.
- Currently, VMP provides the basic metrics container_cpu_cfs_throttled_periods_total and container_cpu_cfs_periods_total, which can be queried directly via Explore. You can also implement more pod resource monitoring on your own via the VMP monitoring dashboard.
Suitable for sustained high-load scenarios such as Elasticsearch and middleware. We recommend limiting the duration of CFS Quota burst to avoid prolonged high-load operation. At the same time, you can increase the CPU threshold of the node shared pool reasonably to reserve more elastic headroom for workloads.
- (Optional) Adjust the CPU threshold of the node shared pool at the cluster level.
warning
- If the node has a significant amount of idle resources, you can adjust the CPU threshold of the cluster-level node shared pool as described below. Otherwise, you can leave the cluster-level configuration unchanged.
- When performing cluster-level operations as an IAM user, ensure that you have administrator privileges. For details, see RBAC permissions.
- Adjust the CPU threshold of the node shared pool to 60%.
- Create the corresponding katalystCustomConfig object to make the cluster-level configuration take effect.
- Perform pod-level configuration by enabling the auto policy in the pod of your business application, and set a duration limit.
- On the node where the pod resides, confirm whether kernel CPU Burst and CFS quota are enabled. For detailed operations, see Verifying results.
- Use a monitoring platform (e.g., VMP) to observe the CPU Throttled metrics of the pod.
- Currently, VMP provides the basic metrics container_cpu_cfs_throttled_periods_total and container_cpu_cfs_periods_total, which can be queried directly via Explore. You can also implement more pod resource monitoring on your own via the VMP monitoring dashboard.
What should I do if enabling CPU Burst does not yield obvious results?
- Ensure that the pod has a CPU limit configured. You cannot enable CPU Burst capabilities for Pods without a CPU limit.
- Check whether the node kernel version meets the requirements.
- Kernel Burst is only supported on the following node OS image:
- Public veLinux images with kernel version 5.4, 5.10, or 5.15
- Public Ubuntu images with kernel version 5.15
- Custom images created based on the preceding public images built on two kernel versions
*How to choose among cpuBurstOnly, cfsQuotaBurstOnly, and auto?
*If traffic is mostly low but occasionally experiences millisecond-level bursts: select cpuBurstOnly.
*If the service has sustained high-load traffic lasting seconds or even minutes, or has an irregular traffic pattern: select auto.
*If the node kernel version does not support the CPU Burst feature: select cfsQuotaBurstOnly.
How to choose among cpuBurstOnly, cfsQuotaBurstOnly, and auto?
- If traffic is mostly low but occasionally experiences millisecond-level bursts: select cpuBurstOnly.
- If the service has sustained high-load traffic lasting seconds or even minutes, or has an irregular traffic pattern: select auto.
- If the node kernel version does not support the CPU Burst feature: select cfsQuotaBurstOnly.
*What is the appropriate value for sharePoolThresholdPercent?
*The default value of 50% is suitable for most scenarios. If the node has a significant amount of idle resources and the application is not latency-sensitive, you can reasonably increase it to 60%–70% to allow more room for bursting.
What is the appropriate value for sharePoolThresholdPercent?
The default value of 50% is suitable for most scenarios. If the node has a significant amount of idle resources and the application is not latency-sensitive, you can reasonably increase it to 60%–70% to allow more room for bursting.
How to configure cfs_quota_burst_period_seconds?
- The default value -1 indicates no duration limit, suitable for scenarios where the duration of high-load traffic is uncertain, or the service cannot tolerate any CPU throttling.
- Setting it to a positive integer imposes a duration limit, suitable for scenarios where the duration of high-load traffic is relatively predictable and short-term CPU throttling is tolerable.