Resource Recommendation

Introduce for Resource Recommendation

Kubernetes’ users often config request and limit based on empirical values when creating application resources. Based on the resource recommendation algorithm, you can analyze the actual application usage and recommend more appropriate resource configurations. You can use the resource recommendation algorithm to improve the resource utilization of the cluster.

Implement

The algorithm model adopts VPA’s Moving Window algorithm for recommendation

  1. By monitoring system, you can obtain the Workload (configurable) CPU and Memory usage history in the past week.
  2. The algorithm considers the timeliness of data. The newer data sampling points will have higher weight.
  3. The recommended CPU value is calculated based on the target percentile value that set by the user, and the recommended Memory value is calculated based on the maximum historical value

Filter Phase

Workloads that have no Pods: If the workload does not have Pods, analysis cannot be performed

Recommend Phase

Adopt VPA Moving Window algorithm to calculate CPU and Memory for every container and give recommendation config.

Observe Phase

Record recommended resource to Metric:crane_analytics_replicas_recommendation

Accepted Resources

Support StatefulSet and Deployment by default,but all workloads that support Scale SubResource are supported.

Configuration

Configuration itemsDefaultDescription
cpu-sample-interval1mMetric sampling interval for requesting CPU monitoring data
cpu-request-percentile0.99Target CPU Percentile that used for VPA
cpu-request-margin-fraction0.15CPU recommend value margin factor,0.15 means recommended value = recommended value 1.15
cpu-target-utilization1CPU target utilization,0.8 means recommended value = recommended value / 0.8
cpu-model-history-length168hHistorical length for CPU monitoring data
mem-sample-interval1mMetric sampling interval for requesting Memory monitoring data
mem-request-percentile0.99Target Memory Percentile that used for VPA
mem-request-margin-fraction0.15Memory recommend value margin factor,0.15 means recommended value = recommended value 1.15
mem-target-utilization1Memory target utilization,0.8 means recommended value = recommended value / 0.8
mem-model-history-length168hHistorical length for Memory monitoring data