Phước Hồ
06/24/2026, 12:07 PMRocky
06/24/2026, 12:07 PMcpu_weight or mem_limit) are applied at the individual node level. Every CN pod in your K8s cluster follows the same resource group rules.
* Pod-Level Scaling: The StarRocks Operator uses a standard Kubernetes Horizontal Pod Autoscaler (HPA). This HPA typically monitors the average CPU or Memory utilization of the entire CN pod, not specific resource groups.
2. The Scaling Effect
When the CN cluster scales out (e.g., from 2 pods to 4 pods), the capacity of every resource group increases linearly across the cluster:
* Total Capacity = (Resource Group Quota per Node) × (Number of CN Pods)
* If your "Marketing" RG is allocated 50% of the CPU weight, scaling from 2 to 4 pods doubles the absolute amount of CPU available to the Marketing team.
3. Key Configurations in K8s
When deploying in Kubernetes with the StarRocks Operator, you configure autoscaling in your StarRocksCluster (SRC) spec:
yaml
starRocksCnSpec:
autoScalingPolicy:
maxReplicas: 10
minReplicas: 2
hpaPolicy:
metrics:
- type: Resource
resource:
name: cpu
target:
averageUtilization: 60 # Scales out when pod CPU > 60%
4. Interactions and Best Practices
cpu_weight vs. exclusive_cpu_cores
* cpu_weight (Recommended for Autoscaling): This is a relative weight. It is highly flexible for autoscaling because it allows RGs to "borrow" unused CPU from each other. If one group is busy and others are idle, the busy group can use the full pod capacity, which correctly triggers the HPA scale-out.
* `exclusive_cpu_cores`: This is a hard reservation. If you set exclusive_cpu_cores = 4 on a pod with 8 cores, that group can never use more than 4 cores on that pod, even if the other 4 are idle. This might prevent the pod from reaching the HPA threshold even if that specific group is struggling.
Memory Limits
Resource Group mem_limit is defined as a percentage (e.g., 20%). When the CN pod scales, the percentage remains the same, but the total bytes available to that group increases as more pods are added.
The "Noisy Neighbor" and HPA
Because the HPA scales based on the aggregate pod usage:
* If a "Large Query" RG consumes 100% of its share and pushes the pod's total CPU utilization above your HPA threshold (e.g., 60%), the cluster will scale out.
* The new CN pods will instantly have the same RG definitions, providing more "slices" of CPU for those large queries to execute.
Summary
In K8s, Resource Groups ensure that one tenant doesn't starve another on the same pod, while CN Autoscaling ensures the entire cluster grows when those tenants collectively require more power beyond the current pod limits.
References
• deployment/sr_operator.md
• administration/management/monitoring/metrics.md
• administration/management/resource_management/resource_group.md