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.

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.

Optimize Live web application shows current and optimized request values

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 (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.

Note: Optimize Live does not provide recommendations for workloads that scale down to 0 replicas for more than 75% of the time within a 7-day period because it can’t collect sufficient metrics about that workload. (You’ll see a message in the Optimize Live UI if this occurs.) For any scale-down event shorter than this, Optimize Live provides a recommendation, and you’ll see a message in the UI about the scale-down event.

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:

Optimize Live web application shows current and optimized request values

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:

  • 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 from the Applier automatically applying recommendations that would make only small changes to a cluster, you can set deployment thresholds. The Applier will apply a recommendation only if the minimum change threshold is met.

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:

  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 Export Patch.
  3. Download the recommendation files and copy the kubectl command in the dialog box.
  4. Connect to the cluster that contains the workload.
  5. 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.

Last modified February 1, 2024