Execution Plans

Depending on various parameters such as data size or number of machines in the cluster, Flink’soptimizer automatically chooses an execution strategy for your program. In many cases, it can beuseful to know how exactly Flink will execute your program.

Plan Visualization Tool

Flink comes packaged with a visualization tool for execution plans. The HTML document containingthe visualizer is located under tools/planVisualizer.html. It takes a JSON representation ofthe job execution plan and visualizes it as a graph with complete annotations of executionstrategies.

The following code shows how to print the execution plan JSON from your program:

  1. final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
  2. ...
  3. System.out.println(env.getExecutionPlan());
  1. val env = ExecutionEnvironment.getExecutionEnvironment
  2. ...
  3. println(env.getExecutionPlan())

To visualize the execution plan, do the following:

  • Open planVisualizer.html 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.

A flink job execution graph.

Web Interface

Flink offers a web interface for submitting and executing jobs. The interface is part of the JobManager’sweb interface for monitoring, per default running on port 8081. Job submission via this interfaces requiresthat you have set web.submit.enable: true in flink-conf.yaml.

You may specify program arguments before the job is executed. The plan visualization enables you to showthe execution plan before executing the Flink job.