Updated on 2026-11-06 GMT+08:00

Flink Job Auto Tuning

AI DataLake Flink provides an auto-tuning (autoscaling) capability. While a job is running, operator parallelism automatically adjusts based on real-time metrics, such as throughput, backpressure, and CPU utilization. The system scales out during peak hours and scales in during off-peak hours. The entire process occurs without job interruption or manual intervention. This feature is ideal for scenarios with significant traffic fluctuations where you want to lower resource costs or enhance service stability. It solves the issues of resource shortages during peak hours and resource waste during off-peak hours caused by fixed resource allocations.

This section describes how to enable, modify, and view auto-tuning for a job.

Precautions

  • During auto-tuning, data processing may experience short delays. This is normal behavior.
  • During Flink job scaling, built-in operators (such as GroupBy Window and Join) and Kafka connectors remain running without restarting. Other connectors will trigger a job restart.
  • Auto-tuning operates under the following assumptions: traffic changes smoothly, no data skew exists, and operator throughput scales linearly with parallelism. Scaling cannot resolve the following issues:
    • Operators configured with fixed parallelism in the code cannot be adjusted.
    • Performance bottlenecks in user-defined functions (UDF, UDAF, or UDTF).
    • External system failures (for example, insufficient Kafka partitions, sink performance issues, or sink database deadlocks). Scaling out may increase pressure on the external system and trigger a cascading failure.

Configuring Auto-Tuning Upon Job Startup

When creating a job, you can specify an auto-tuning policy. The policy takes effect immediately after the job starts running.

This configuration can only be performed through APIs. For details, see Creating a FlinkJob Job.

Enabling or Modifying Auto-Tuning During Runtime

While a job is running, you can dynamically enable or modify auto-tuning. The system automatically applies the new parameters without restarting the job.

  • Method 1: Use an API to enable auto-tuning or modify its configuration. For details, see .
  • Method 2: Enable auto-tuning or modify its configuration on the AI DataLake console. The procedure is as follows:
    1. Log in to the AI DataLake console.
    2. In the upper left corner of the page, select the target workspace.
    3. Choose Job Development > Job Run History, and then click the Flink tab.
    4. In the Flink job list, click the name of the target job.
    5. On the Auto Tuning tab page, configure the auto-tuning parameters.
      • Auto Tuning switch: Enable this option to automatically scale job resources up or down based on job metrics.
      • Tuning Configuration: Click Edit on the right, configure the required parameters, and click OK.

        Configuration Item

        Description

        Max CPU Limit (m)

        The maximum number of CPU resources that can be added to a job through auto-tuning.

        Max Memory Limit (MiB)

        The maximum memory that can be added to a job through auto-tuning.

        Maximum Operator Parallelism

        The maximum operator parallelism that can be set for a job through auto-tuning.

      • Parameter Configuration: Click Edit on the right, configure custom parameters, and click OK. For details about parameters, see Autoscaler Configuration.

Disabling Auto-Tuning

  • Method 1: Use an API to disable auto-tuning. For details, see .
  • Method 2: Disable auto-tuning on the AI DataLake console. The procedure is as follows:
    To disable auto-tuning at runtime:
    1. Log in to the AI DataLake console.
    2. Choose Job Development > Job Run History, and then click the Flink tab.
    3. In the Flink job list, click the name of the target job.
    4. On the Auto Tuning tab page, disable auto-tuning.

Viewing Job Auto-tuning History

Regardless of how you enabled auto-tuning, you can view the tuning history to check system tuning operations and their execution times.

  • Method 1: Use an API to view the auto-tuning history. For details, see Querying Flink Job Autoscaling Configuration.
  • Method 2: View the auto-tuning history on the AI DataLake console.
    1. Log in to the AI DataLake console.
    2. In the upper left corner of the page, select the target workspace.
    3. Choose Job Development > Job Run History, and then click the Flink tab.
    4. In the Flink job list, click the name of the target job.
    5. On the Auto Tuning tab page, view the tuning history.