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:
- Log in to the AI DataLake console.
- In the upper left corner of the page, select the target workspace.
- Choose Job Development > Job Run History, and then click the Flink tab.
- In the Flink job list, click the name of the target job.
- 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:
- Log in to the AI DataLake console.
- Choose Job Development > Job Run History, and then click the Flink tab.
- In the Flink job list, click the name of the target job.
- 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.
- Log in to the AI DataLake console.
- In the upper left corner of the page, select the target workspace.
- Choose Job Development > Job Run History, and then click the Flink tab.
- In the Flink job list, click the name of the target job.
- On the Auto Tuning tab page, view the tuning history.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot