Optimize the cluster utilization of Delta Live Tables pipelines with enhanced autoscaling

This article discusses how to use enhanced autoscaling to optimize your Delta Live Tables pipelines on Databricks.

Enhanced autoscaling is enabled by default for all new pipelines.

What is enhanced autoscaling?

Databricks enhanced autoscaling optimizes cluster utilization by automatically allocating cluster resources based on workload volume, with minimal impact on the data processing latency of your pipelines.

Enhanced autoscaling improves on the Databricks cluster autoscaling functionality with the following features:

  • Enhanced autoscaling implements optimization of streaming workloads and adds enhancements to improve the performance of batch workloads. Enhanced autoscaling optimizes costs by adding or removing machines as the workload changes.

  • Enhanced autoscaling proactively shuts down under-utilized nodes while guaranteeing there are no failed tasks during shutdown. The existing cluster autoscaling feature scales down nodes only if the node is idle.

Enhanced autoscaling is the default autoscaling mode when you create a new pipeline in the Delta Live Tables UI. You can enable enhanced autoscaling for existing pipelines by editing the pipeline settings in the UI. You can also enable enhanced autoscaling when you create or edit pipelines with the Delta Live Tables API.

Which metrics does enhanced autoscaling use to make a scale-up or scale-down decision?

Enhanced autoscaling uses two metrics to decide on scaling up or scaling down:

  • Task slot utilization: This is the average ratio of the number of busy task slots to the total task slots available in the cluster.

  • Task queue size: This is the number of tasks waiting to be executed in task slots.

Enable enhanced autoscaling for a Delta Live Tables pipeline

Enhanced autoscaling is the default autoscaling mode when you create a new pipeline in the Delta Live Tables UI. You can enable enhanced autoscaling for existing pipelines by editing the pipeline settings in the UI. You can also enable enhanced autoscaling when you create or edit a pipeline with the Delta Live Tables API.

To use enhanced autoscaling, do one of the following:

  • Set Cluster mode to Enhanced autoscaling when creating or editing a pipeline in the Delta Live Tables UI.

  • Add the autoscale setting to the pipeline cluster configuration and set the mode field to ENHANCED. See Configure compute for a Delta Live Tables pipeline.

Use the following guidelines when configuring enhanced autoscaling for production pipelines:

  • Leave the Min workers setting at the default.

  • Set the Max workers setting to a value based on budget and pipeline priority.

The following example configures an enhanced autoscaling cluster with a minimum of 5 workers and a maximum of 10 workers. max_workers must be greater than or equal to min_workers.

Note

  • Enhanced autoscaling is available for updates clusters only. Legacy autoscaling is used for maintenance clusters.

  • The autoscale configuration has two modes:

{
  "clusters": [
    {
      "autoscale": {
        "min_workers": 5,
        "max_workers": 10,
        "mode": "ENHANCED"
      }
    }
  ]
}

If the pipeline is configured for continuous execution, it is automatically restarted after the autoscaling configuration changes. After restart, expect a short period of increased latency. Following this brief period of increased latency, the cluster size should be updated based on your autoscale configuration, and the pipeline latency should return to its previous latency characteristics.

Limit costs for pipelines that use enhanced autoscaling

Setting the Max workers parameter in the pipelines Compute pane sets an upper bound for autoscaling. Reducing the number of available workers might increase latency for some workloads but prevents compute resource costs from bursting during compute-intensive operations.

Databricks recommends tuning the Max workers settings to balance the cost-latency trade-off for your particular needs.

The Compute pane in the Pipelines UI, where you can set the Max workers for autoscaling

Monitor enhanced autoscaling enabled classic pipelines

You can use the event log in the Delta Live Tables user interface to monitor enhanced autoscaling metrics for classic pipelines. Enhanced autoscaling events have the autoscale event type. The following are example events:

Event

Message

Cluster resize request started

Scaling [up or down] to <y> executors from current cluster size of <x>

Cluster resize request succeeded

Achieved cluster size <x> for cluster <cluster-id> with status SUCCEEDED

Cluster resize request partially succeeded

Achieved cluster size <x> for cluster <cluster-id> with status PARTIALLY_SUCCEEDED

Cluster resize request failed

Achieved cluster size <x> for cluster <cluster-id> with status FAILED

You can also view enhanced autoscaling events by directly querying the event log: