Skip to main content
Version: 2.15.0

Predictive Event Scaling

Smart Scaler provides a solution to curb the escalating effort and expense associated with provisioning scalable applications on Kubernetes clusters. It achieves this by leveraging AI and Reinforcement Learning models trained on system and application metrics data from the cluster. This eliminates the necessity for manual performance tuning of production clusters to meet SLA requirements, as Smart Scaler conducts continuous tuning using production data.

Smart Scaler provides the Event Agent that enables dynamic scaling of applications based on pre-defined events. The Event Agent works with your Continuous Deployment (CD) process and updates the application's deployment configuration to ensure your applications are scaled up before planned events and gracefully scaled back down afterward. It will also adapt to changes in application steady-state deployment after winding down an event.

There may be an event with predicted traffic spikes for which you want to schedule scaling. The Event Agent helps with scheduled scaling for such events. Let us consider an example: the traffic for your web application is expected to spike at 7 AM from an overnight steady-state low level to a level likely to sustain until 6 PM. From 6 PM, load is expected to steadily drain down until reaching the overnight steady-state again. You can automate pod scaling for this event. The example with the forecasted traffic is illustrated in the following figure.

alt

Of course, one can provision enough resources to meet the peak demand and deal with the costs, or one can use conventional on-demand scaling tools. But in this case, the 7 AM spike is likely to be accompanied by errors as the infrastructure struggles to keep up with the spike in demand. Instead, this is an ideal use case for the Event Agent. It will automate the pod scaling in advance of an event with predicted traffic spikes so that the resources are ready just before they are needed.

When the event ends, the Event Agent will allow the resources to gracefully drain down so there is no impact if the event should go on a bit longer than expected.

What's more, as part of the Smart Scaler application, event-based scaling can be augmented by Smart Scaler's reinforcement learning models that can predict the scaling requirements for fluctuating traffic. For example, if the demand exceeds the level supported by the resources defined for the event, Smart Scaler can anticipate the need for additional resources. It can scale them into place before they are needed to ensure the capacity to meet traffic demands.

Create the Event Scaling Configuration

Configure the event scaling using the event scheduler by setting the start and end times for predicted spikes in the workloads.

warning

For event scaling with Smart Scaler agent versions 2.9.28 or earlier, each application deployment in a namespace must have its own configured HPA. Without an individual HPA, event scaling fails.

However, starting with Smart Scaler agent versions 2.9.29 and later, event scaling no longer requires an individual HPA for each application deployment.

To use the Event Agent, Install the Smart Scaler Agent. Installing the Smart Scaler Agent installs the Inference Agent and the Event Agent, and generates ConfigMap that includes the agent and application configuration.

You can configure the events from the Smart Scaler Management Console. To configure the non-recurring event or recurring event, see Event Operations.

The Event Agent supports automation of scaling for both one-time event and recurring event. For details regarding the sequential configuration of event scheduling, see autoscaling of planned events.

info

To gain more flexibility over the application definition, see:

Verify the Scaling Automation of the Event

You can verify the Event Agent and the scheduled events.

Use the following command to verify the Event Agent:

kubectl get eventconfigs.agent.smart-scaler.io -n smart-scaler

Expected Output

NAME                  AGE
spike-load-test-455 4h10m

From the above command output, use the event name to see the details.

Use the following command to verify the scheduled event details:

kubectl get eventconfigs.agent.smart-scaler.io spike-load-test-455 -n smart-scaler -oyaml

Expected Output

apiVersion: agent.smart-scaler.io/v1alpha1
kind: EventConfig
metadata:
creationTimestamp: "2023-11-23T09:25:59Z"
generation: 1
labels:
agent.smart-scaler.io/ApplicationConfig: boutique
name: spike-load-test-455
namespace: smart-scaler
resourceVersion: "153392"
spec:
applicationConfigName: boutique
cooldownDuration: 4m
destinationContexts:
- in-cluster
displayName: spike-load-test-4555
eventEndTimestamp: "2023-11-23T09:40:00Z"
eventStartTimestamp: "2023-11-23T09:36:00Z"
scalingConfiguration:
maxScalingFactor: "20"
minScalingFactor: "20"
scalingRatioConfigName: boutique
status:
conditions:
- lastTransitionTime: "2023-11-23T09:25:59Z"
status: "True"
type: Ready
- lastTransitionTime: "2023-11-23T09:31:53Z"
status: "True"
type: Progressing