Optimization Policy customization
Learn how to customize the optimization policy to tailor recommendations and automation to your services' specific needs
PerfectScale provides flexible customization options for configuring optimization policies to achieve greater control over optimization. With this feature, you can seamlessly align your optimization policy with your optimization goals to achieve the desired results efficiently.
You can seamlessly apply the optimization policy via UI or directly through Kubernetes manifests with CR.
When an Optimization Policy is managed with a Custom Resource (CR), the UI reflects the CR as the source of truth, and the relevant CRD badge will appear:

Cluster-level CR
If a cluster-level optimization policy CR is applied, the UI will not allow changes to the cluster optimization policy.
Workload-level CR
If a workload-level optimization policy CR is applied, the UI will not allow saving changes to that workload’s optimization policy.
Users can preview recommendations from other policies even when a CR is applied.
Different approaches for setting an optimization policy may take precedence over others. Review the priority order to ensure your configuration leads to the desired outcome:
Workload-level (Highest Priority)
Workload CR ->
Custom CPU/Custom Memory PolicyWorkload CR ->
GlobalWorkload UI ->
Custom CPU/Custom Memory PolicyWorkload UI ->
Global
Namespace-level4$
Namespace CR ->
Custom CPU/Custom Memory PolicyNamespace CR ->
Global
Cluster-level
Cluster CR ->
Custom CPU/Custom Memory PolicyCluster CR ->
GlobalCluster UI ->
Custom CPU/Custom Memory PolicyCluster UI->
Global
Independent optimization policies for CPU and Memory
PerfectScale enables independent optimization policies for CPU and Memory, ensuring recommendations and automation are precisely aligned with your optimization goals while meeting reliability requirements.
Memory request = memory limit policy
For memory-sensitive workloads, PerfectScale allows you to apply a Memory Request = Memory Limit policy on top of your optimization policy. This helps reduce the risk of OOM events and prevents noisy-neighbor effects by ensuring guaranteed memory allocation for your critical services.
Custom optimization policy time window
PerfectScale uses the default data maturity time window for the recommendations, depending on the selected Optimization Policy. This algorithm allows PerfectScale to collect sufficient data to ensure reliable recommendations and accurately adjust resources through automated actions.
However, there may be situations when the default setup is not efficient enough due to known and predictable resource spikes within a known timeframe. PerfectScale allows you to set a Custom time window for the optimization policy to tailor recommendations and automation to your services' specific needs.
You can adjust the time window for the optimization policy for both the entire cluster and a specific workload.
Setting optimization policy via UI
Setting independent policies for the cluster via UI
You can seamlessly set the independent CPU and Memory optimization policies for the already running cluster.
From the Overview screen, navigate to the Cluster Settings by clicking the gear icon next to the cluster. Open the Optimization Policy dropdown, and select Custom CPU & Mem Policies. Then select the desired policies for both CPU and Memory, and click the Save changes button.

Setting independent policies for the workload via UI
Click the specific workload to open the Zoom-in window. In the top-right corner, open the Optimization Policy dropdown, select Custom CPU & Mem Policies, elect the desired policies for both CPU and Memory, and click the Save button.

Setting memoryRequestEqualsLimit for the cluster via UI
You can seamlessly set the memoryRequestEqualsLimit policy for the already running cluster.
From the Overview screen, navigate to the Cluster Settings by clicking the gear icon next to the cluster. Open the Optimization Policy dropdown, and select Memory Request = Limit. Then click the Save changes button.

Setting memoryRequestEqualsLimit for the workload via UI
Click the specific workload to open the Zoom-in window. In the top-right corner, open the Optimization Policy dropdown, select Memory Request = Limit, and click the Save button.

Setting a custom time window for the cluster via UI
You can easily specify the custom time window for the optimization policy when onboarding the cluster, or modify it for an already running cluster.
When onboarding a new cluster, enable the toggle Custom time window in the Optimization Policy drop-down and select the policy and the desired time window.

If you want to modify the custom time window for the already onboarded cluster, navigate to the Cluster Settings by clicking the gear icon next to the cluster. Open the Optimization Policy dropdown, and select the desired policy and custom time window.

Once the custom time window is applied, it will be displayed next to the optimization policy in UI.
Setting a custom time window for the workload via UI
To set the custom time window for the optimization policy of the particular workload, navigate to the Zoom-in window by clicking the workload, select the desired optimization policy and custom time window, and click Save button.

Setting optimization policy with CR
Custom Resource (CR) provides a cloud-native way to define and manage optimization policies directly through Kubernetes manifests.
This advanced approach is specifically helpful if you want to manage policies as code (versioning, reviews, GitOps workflows) and apply consistent configurations across clusters and environments with full control.
Setting optimization policy for the cluster with CR
To apply a cluster-wide optimization policy, create a cluster-level custom resource. Here is an example:
When an optimization policy is set at the cluster level via a CR, a corresponding badge appears next to the policy name. Clicking the badge opens a pop-up with the configured CRD.

Setting optimization policy for the namespace with CR
To apply an optimization policy to the specific namespace, create a namespace-level custom resource. Here is an example:
Setting optimization policy for the workload with CR
To apply an optimization policy to the specific workload/workload type, create a workload-level custom resource. Here is an example:
When an optimization policy is set at the workload with a CR, a corresponding badge appears next to the policy name. Clicking the View CRD button opens a pop-up with the configured CR.

The drop-down menu includes a Default policy option to reset the optimization policy to the inherited configuration. This means that if a namespace-level CR is present, you can return to the namespace configuration, or if only a cluster-level policy exists (via CRD or UI), you can return to the cluster default.
Reverting to default optimization policy settings
To revert to the default optimization policy settings configured via UI, simply upgrade the exporter without specifying any value. This will also enable modifying the custom time window through the UI.
To revert to the default Optimization Policy settings configured with CR, delete the corresponding Custom Resource. If a workload-level CR is deleted, the namespace-level configuration will be applied (if available). If the namespace-level CR is deleted, the cluster-level configuration will be used. If the cluster-level CR is also removed, the system defaults will apply.
Last updated
Was this helpful?