View and apply recommendations
5 minute read
You can view and apply recommendations from either the Workload Details page in the Optimize Live web application or from the command line.
A recommendation includes the CPU and memory requests and limits values (and recommended HPA configuration, if an HPA is running) that the machine learning has determined to be optimal for each container in a workload.
By default, recommendations are not applied automatically, giving you the opportunity to review their projected impact on your workloads.
Viewing the overall projected impact of a recommendation
For an at-a-glance view of how a recommendation will right-size a workload, check out the Current and With Optimization sections shown throughout the Optimize Live web application.
The Current section shows the current requests multiplied by the average number of replicas over the last 7 days.
The With Optimization section shows the recommended requests multiplied by the average number of replicas over the last 7 days.
The Net Impact shows the difference between the current and recommended total CPU and memory requests.
To show or hide the projected dollar impact of applying a recommendation, click Settings in the upper-right corner of any page that shows a workload list or workload details.
Viewing the recommendation details
To confirm that the machine learning in Optimize Live is generating recommendations that are safe to apply to individual containers, you can view the details of the recommendation using one of the two methods later in this section. When applied, these values will right-size each container in your workload.
A note about HPA recommendations
If a HorizontalPodAutoscaler (HPA) is enabled on the workload, Optimize Live detects the metric that the HPA is configured to scale on:
- If an HPA is enabled on the workload, Optimize Live provides the recommended HPA target utilization value in addition to the optimal requests and limits values for the containers in the workload.
- If the HPA is scaling on any other metric, Optimize Live provides a recommendation containing the set of optimal requests and limits values for the containers in the workload.
- If the HPA is scaling on multiple metrics, Optimize Live does not provide a recommendation.
Viewing recommendations in the Optimize Live web application
To view the recommended CPU and memory settings for each container in the workload, click a workload name in the Optimize Live web application, and on the Workload Details page, click Recommendation Details.
In the Recommendation Details section, you’ll see something like this:
For a visualization of the projected impact of applying a recommendation, click View in the row for that container. The resulting graphs show a historical averaged projection of CPU and memory savings, which can help you to better understand how recommendations right-size a workload’s containers over time based on resource usage.
Viewing recommendations from the command line
Run the following command:
$ stormforge get recommendations WORKLOAD_NAME -o json
Here’s an excerpt from the recommendation:
"goal": "savings",
"values": {
"containerResources": [
{
"containerName": "respod",
"requests": {
"cpu": "0",
"memory": "1099366"
}
}
],
"autoScaling": {
"metrics": [
{
"resource": {
"name": "cpu",
"target": {
"averageUtilization": 90
}
}
}
]
}
Applying workload recommendations
When you’re satisfied with how the generated recommendations can right-size your workloads, you can deploy them in any of the ways described below.
Deploy recommendations on demand
Requires the StormForge Applier.
You can apply a single recommendation in any environment as you experiment with recommendations or if you need to quickly deploy a recommendation outside of a schedule.
- In the left navigation of the Optimize Live web application, click Workloads and then click a workload name.
- On the Workload Details page, click Apply.
The Applier applies the patch to your workload. The next recommendation will be available to apply at the interval specified in the Recommendation Schedule on the Config tab.
Deploy recommendations automatically
Requires the StormForge Applier.
This option enables you to immediately realize the benefits of right-sizing your workloads. It also saves you time and toil by relieving you of the task of manually reviewing recommendations on a schedule.
To enable automatic deployment:
- In the left navigation of the Optimize Live web application, click Workloads and then click a workload name.
- On the Workload Details page, click Config.
- Set Automatic Deployment to on.
- Optional: Adjust the Recommendation Schedule field on the Config tab.
The Applier will now apply recommendations automatically at the interval specified in the Recommendation Schedule on the Config tab.
Export recommendations as a patch
This option enables you to apply the patch as part of a CI/CD workflow or by using the kubectl
command.
Exporting recommendations as a patch does not require the StormForge Applier.
To apply the recommendation as a patch:
- In the left navigation of the Optimize Live web application, click Workloads and then click a workload name.
- On the Workload Details page, click Export Patch.
- Download the recommendation files and copy the
kubectl
command in the dialog box. - Connect to the cluster that contains the workload.
- Paste the
kubectl
command into the command line and press Enter.
Optimize Live applies the patch to your workload. The next recommendation will be available to apply at the interval specified in the Recommendation Schedule on the Config tab.
Next steps
After Optimize Live applies the recommendation, notice the workload’s updated efficiency rating on the Workloads list page.
On the Workloads page, you might explore workloads whose Efficiency rating is outside of the optimal range.
If you’re satisfied with the recommendation schedule (how often you’re receiving recommendations), no further action is needed on this workload.
To roll back a recommendation, use Git or Kube-native tools.