View and apply recommendations

View recommendations on the Workload Details page or from the command line. Apply them using the method that suits your environment.

By default, recommendations are not applied automatically, giving you the opportunity to review their projected impact on your workloads.

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.

Viewing the overall projected impact of a recommendation

To understand how a recommendation will right-size a workload, review the workload details page header:

Optimize Live web application shows current and optimized request values

  • Current shows the current requests multiplied by the average number of replicas over the last 7 days.

  • With Optimization shows the recommended requests multiplied by the average number of replicas over the last 7 days.

  • Net Impact shows the difference between the current and recommended total CPU and memory requests.

  • Optimization Score measures how well your current request settings align with Optimize Live’s recommendations. 100 indicates perfect alignment.

Note: To change the CPU and memory cost/hr values used to calculate the estimated monthly costs, click Settings in the upper-right corner of the page.

A note about HPA recommendations

If a HorizontalPodAutoscaler (HPA) is enabled on the workload, Optimize Live detects the metric (or metrics) that the HPA is configured to scale on.

When an HPA scales on… Optimize Live provides…
One resource metric (CPU or memory) Optimal requests and limits values, HPA target utilization
One resource metric and other multiple metrics Optimal requests and limits values, HPA target utilization
Any metric(s), but no resource metric Optimal requests and limits values
Multiple resource metrics No recommendation. This workload type is not supported.

Scale-down events and recommendations

  • 0 replicas for more than 75% of the time within a 7-day period: No recommendation provided. Optimize Live cannot collect sufficient metrics about that workload. You’ll see a message in the UI.
  • Any event shorter scale-down events: Recommendation provided, and you’ll see a message in the UI.

Viewing recommendation details 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.

On the Recommendation Details tab, you’ll see something like this:

Optimize Live web application shows current and optimized request values

To view charts that show the projected impact of applying recommendations, click View in the row for that container. The charts show a historical averaged projection of CPU and memory adjustments, 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:

  • Replace WORKLOAD_NAME with your workload name
$ 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.

  1. In the left navigation of the Optimize Live web application, click Workloads and then click a workload name.
  2. 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:

  1. In the left navigation of the Optimize Live web application, click Workloads and then click a workload name.
  2. On the Workload Details page, click Config.
  3. Set Automatic Deployment to on.
  4. 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.

To reduce pod churn, you can set deployment thresholds. The Applier will apply a recommendation only if the minimum change threshold is met.

Apply 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. This method does not require the StormForge Applier.

  1. On the View Patches tab of the workload details page, download or copy the patches.
  2. Apply the patch using the kubectl command provided.

Next steps

Notice the workload’s updated optimization score on the Workloads list page.

The next recommendation will be available to apply at the interval specified in the Next scheduled field near the top of the page.

If you’re satisfied with the recommendation schedule (how often you’re receiving recommendations), no further action is needed on this workload.

On the Workloads page, you might investigate workloads that have a low Score (optimization score).

To roll back a recommendation, use Git or Kube-native tools.

Last modified April 19, 2024