Execution Plans #
Depending on various parameters such as data size or number of machines in the cluster, Flink’s optimizer automatically chooses an execution strategy for your program. In many cases, it can be useful to know how exactly Flink will execute your program.
Plan Visualization Tool
Flink provides a visualization tool for execution plans, which takes a JSON representation of the job execution plan and visualizes it as a graph with complete annotations of execution strategies.
The following code shows how to print the execution plan JSON from your program:
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); ... System.out.println(env.getExecutionPlan());
val env = ExecutionEnvironment.getExecutionEnvironment ... println(env.getExecutionPlan())
To visualize the execution plan, do the following:
- Open the visualizer with your web browser,
- Paste the JSON string into the text field, and
- Press the draw button.
After these steps, a detailed execution plan will be visualized.
Flink offers a web interface for submitting and executing jobs. The interface is part of the JobManager’s web interface for monitoring, per default running on port 8081.
You may specify program arguments before the job is executed. The plan visualization enables you to show the execution plan before executing the Flink job.