You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by zh...@apache.org on 2021/03/08 11:30:30 UTC

[flink] branch master updated: [FLINK-21525] Move scheduler benchmarks to Flink

This is an automated email from the ASF dual-hosted git repository.

zhuzh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/master by this push:
     new c70000c  [FLINK-21525] Move scheduler benchmarks to Flink
c70000c is described below

commit c70000c054d312f9c05e9a651eac209740629665
Author: Thesharing <cy...@outlook.com>
AuthorDate: Wed Mar 3 11:12:12 2021 +0800

    [FLINK-21525] Move scheduler benchmarks to Flink
    
    Fix the compilation errors due to FLINK-21401
---
 .../scheduler/benchmark/JobConfiguration.java      |  97 ++++++++++++
 .../benchmark/SchedulerBenchmarkUtils.java         | 165 +++++++++++++++++++++
 ...eployingDownstreamTasksInBatchJobBenchmark.java |  55 +++++++
 ...yingDownstreamTasksInBatchJobBenchmarkTest.java |  40 +++++
 .../deploying/DeployingTasksBenchmarkBase.java     |  72 +++++++++
 .../DeployingTasksInStreamingJobBenchmark.java     |  44 ++++++
 .../DeployingTasksInStreamingJobBenchmarkTest.java |  40 +++++
 .../benchmark/failover/FailoverBenchmarkBase.java  |  50 +++++++
 .../RegionToRestartInBatchJobBenchmark.java        |  59 ++++++++
 .../RegionToRestartInBatchJobBenchmarkTest.java    |  39 +++++
 .../RegionToRestartInStreamingJobBenchmark.java    |  52 +++++++
 ...RegionToRestartInStreamingJobBenchmarkTest.java |  40 +++++
 .../PartitionReleaseInBatchJobBenchmark.java       |  64 ++++++++
 .../PartitionReleaseInBatchJobBenchmarkTest.java   |  39 +++++
 .../InitSchedulingStrategyBenchmark.java           |  38 +++++
 .../InitSchedulingStrategyBenchmarkTest.java       |  45 ++++++
 .../scheduling/SchedulingBenchmarkBase.java        |  46 ++++++
 ...hedulingDownstreamTasksInBatchJobBenchmark.java |  69 +++++++++
 ...lingDownstreamTasksInBatchJobBenchmarkTest.java |  39 +++++
 .../topology/BuildExecutionGraphBenchmark.java     |  53 +++++++
 .../topology/BuildExecutionGraphBenchmarkTest.java |  46 ++++++
 21 files changed, 1192 insertions(+)

diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/JobConfiguration.java b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/JobConfiguration.java
new file mode 100644
index 0000000..725ddc1
--- /dev/null
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/JobConfiguration.java
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package org.apache.flink.runtime.scheduler.benchmark;
+
+import org.apache.flink.api.common.ExecutionMode;
+import org.apache.flink.runtime.io.network.partition.ResultPartitionType;
+import org.apache.flink.runtime.jobgraph.DistributionPattern;
+import org.apache.flink.runtime.jobgraph.JobType;
+
+/**
+ * {@link JobConfiguration} contains the configuration of a STREAMING/BATCH job. It concludes {@link
+ * DistributionPattern}, {@link ResultPartitionType}, {@link JobType}, {@link ExecutionMode}.
+ */
+public enum JobConfiguration {
+    STREAMING(
+            DistributionPattern.ALL_TO_ALL,
+            ResultPartitionType.PIPELINED,
+            JobType.STREAMING,
+            ExecutionMode.PIPELINED,
+            4000),
+
+    BATCH(
+            DistributionPattern.ALL_TO_ALL,
+            ResultPartitionType.BLOCKING,
+            JobType.BATCH,
+            ExecutionMode.BATCH,
+            4000),
+
+    STREAMING_TEST(
+            DistributionPattern.ALL_TO_ALL,
+            ResultPartitionType.PIPELINED,
+            JobType.STREAMING,
+            ExecutionMode.PIPELINED,
+            10),
+
+    BATCH_TEST(
+            DistributionPattern.ALL_TO_ALL,
+            ResultPartitionType.BLOCKING,
+            JobType.BATCH,
+            ExecutionMode.BATCH,
+            10);
+
+    private final int parallelism;
+    private final DistributionPattern distributionPattern;
+    private final ResultPartitionType resultPartitionType;
+    private final JobType jobType;
+    private final ExecutionMode executionMode;
+
+    JobConfiguration(
+            DistributionPattern distributionPattern,
+            ResultPartitionType resultPartitionType,
+            JobType jobType,
+            ExecutionMode executionMode,
+            int parallelism) {
+        this.distributionPattern = distributionPattern;
+        this.resultPartitionType = resultPartitionType;
+        this.jobType = jobType;
+        this.executionMode = executionMode;
+        this.parallelism = parallelism;
+    }
+
+    public int getParallelism() {
+        return parallelism;
+    }
+
+    public DistributionPattern getDistributionPattern() {
+        return distributionPattern;
+    }
+
+    public ResultPartitionType getResultPartitionType() {
+        return resultPartitionType;
+    }
+
+    public JobType getJobType() {
+        return jobType;
+    }
+
+    public ExecutionMode getExecutionMode() {
+        return executionMode;
+    }
+}
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/SchedulerBenchmarkUtils.java b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/SchedulerBenchmarkUtils.java
new file mode 100644
index 0000000..93b9a99
--- /dev/null
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/SchedulerBenchmarkUtils.java
@@ -0,0 +1,165 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package org.apache.flink.runtime.scheduler.benchmark;
+
+import org.apache.flink.api.common.ExecutionConfig;
+import org.apache.flink.runtime.JobException;
+import org.apache.flink.runtime.concurrent.ComponentMainThreadExecutor;
+import org.apache.flink.runtime.concurrent.ComponentMainThreadExecutorServiceAdapter;
+import org.apache.flink.runtime.execution.ExecutionState;
+import org.apache.flink.runtime.executiongraph.AccessExecutionJobVertex;
+import org.apache.flink.runtime.executiongraph.Execution;
+import org.apache.flink.runtime.executiongraph.ExecutionAttemptID;
+import org.apache.flink.runtime.executiongraph.ExecutionGraph;
+import org.apache.flink.runtime.executiongraph.ExecutionVertex;
+import org.apache.flink.runtime.executiongraph.TaskExecutionStateTransition;
+import org.apache.flink.runtime.jobgraph.JobGraph;
+import org.apache.flink.runtime.jobgraph.JobGraphTestUtils;
+import org.apache.flink.runtime.jobgraph.JobVertex;
+import org.apache.flink.runtime.jobgraph.JobVertexID;
+import org.apache.flink.runtime.jobmaster.LogicalSlot;
+import org.apache.flink.runtime.jobmaster.TestingLogicalSlotBuilder;
+import org.apache.flink.runtime.scheduler.DefaultScheduler;
+import org.apache.flink.runtime.scheduler.SchedulerTestingUtils;
+import org.apache.flink.runtime.taskmanager.TaskExecutionState;
+import org.apache.flink.runtime.testtasks.NoOpInvokable;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+
+/** Utilities for scheduler benchmarks. */
+public class SchedulerBenchmarkUtils {
+
+    public static List<JobVertex> createDefaultJobVertices(JobConfiguration jobConfiguration) {
+
+        final List<JobVertex> jobVertices = new ArrayList<>();
+
+        final JobVertex source = new JobVertex("source");
+        source.setInvokableClass(NoOpInvokable.class);
+        source.setParallelism(jobConfiguration.getParallelism());
+        jobVertices.add(source);
+
+        final JobVertex sink = new JobVertex("sink");
+        sink.setInvokableClass(NoOpInvokable.class);
+        sink.setParallelism(jobConfiguration.getParallelism());
+        jobVertices.add(sink);
+
+        sink.connectNewDataSetAsInput(
+                source,
+                jobConfiguration.getDistributionPattern(),
+                jobConfiguration.getResultPartitionType());
+
+        return jobVertices;
+    }
+
+    public static JobGraph createJobGraph(JobConfiguration jobConfiguration) throws IOException {
+        return createJobGraph(Collections.emptyList(), jobConfiguration);
+    }
+
+    public static JobGraph createJobGraph(
+            List<JobVertex> jobVertices, JobConfiguration jobConfiguration) throws IOException {
+
+        final JobGraph jobGraph =
+                JobGraphTestUtils.streamingJobGraph(jobVertices.toArray(new JobVertex[0]));
+
+        jobGraph.setJobType(jobConfiguration.getJobType());
+
+        final ExecutionConfig executionConfig = new ExecutionConfig();
+        executionConfig.setExecutionMode(jobConfiguration.getExecutionMode());
+        jobGraph.setExecutionConfig(executionConfig);
+
+        return jobGraph;
+    }
+
+    public static ExecutionGraph createAndInitExecutionGraph(
+            List<JobVertex> jobVertices, JobConfiguration jobConfiguration) throws Exception {
+
+        final JobGraph jobGraph = createJobGraph(jobVertices, jobConfiguration);
+
+        final ComponentMainThreadExecutor mainThreadExecutor =
+                ComponentMainThreadExecutorServiceAdapter.forMainThread();
+
+        final DefaultScheduler scheduler =
+                SchedulerTestingUtils.createScheduler(jobGraph, mainThreadExecutor);
+
+        return scheduler.getExecutionGraph();
+    }
+
+    public static void deployTasks(
+            ExecutionGraph executionGraph,
+            JobVertexID jobVertexID,
+            TestingLogicalSlotBuilder slotBuilder,
+            boolean sendScheduleOrUpdateConsumersMessage)
+            throws JobException, ExecutionException, InterruptedException {
+
+        for (ExecutionVertex vertex : executionGraph.getJobVertex(jobVertexID).getTaskVertices()) {
+            LogicalSlot slot = slotBuilder.createTestingLogicalSlot();
+            Execution execution = vertex.getCurrentExecutionAttempt();
+            execution
+                    .registerProducedPartitions(
+                            slot.getTaskManagerLocation(), sendScheduleOrUpdateConsumersMessage)
+                    .get();
+            assignResourceAndDeploy(vertex, slot);
+        }
+    }
+
+    public static void deployAllTasks(
+            ExecutionGraph executionGraph, TestingLogicalSlotBuilder slotBuilder)
+            throws JobException, ExecutionException, InterruptedException {
+
+        for (ExecutionVertex vertex : executionGraph.getAllExecutionVertices()) {
+            LogicalSlot slot = slotBuilder.createTestingLogicalSlot();
+            vertex.getCurrentExecutionAttempt()
+                    .registerProducedPartitions(slot.getTaskManagerLocation(), true)
+                    .get();
+            assignResourceAndDeploy(vertex, slot);
+        }
+    }
+
+    private static void assignResourceAndDeploy(ExecutionVertex vertex, LogicalSlot slot)
+            throws JobException {
+        vertex.tryAssignResource(slot);
+        vertex.deploy();
+    }
+
+    public static void transitionTaskStatus(
+            ExecutionGraph executionGraph, JobVertexID jobVertexID, ExecutionState state) {
+
+        for (ExecutionVertex vertex : executionGraph.getJobVertex(jobVertexID).getTaskVertices()) {
+            executionGraph.updateState(
+                    new TaskExecutionStateTransition(
+                            new TaskExecutionState(
+                                    vertex.getCurrentExecutionAttempt().getAttemptId(), state)));
+        }
+    }
+
+    public static void transitionTaskStatus(
+            DefaultScheduler scheduler,
+            AccessExecutionJobVertex vertex,
+            int subtask,
+            ExecutionState executionState) {
+
+        final ExecutionAttemptID attemptId =
+                vertex.getTaskVertices()[subtask].getCurrentExecutionAttempt().getAttemptId();
+        scheduler.updateTaskExecutionState(new TaskExecutionState(attemptId, executionState));
+    }
+}
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/deploying/DeployingDownstreamTasksInBatchJobBenchmark.java b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/deploying/DeployingDownstreamTasksInBatchJobBenchmark.java
new file mode 100644
index 0000000..d078eab
--- /dev/null
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/deploying/DeployingDownstreamTasksInBatchJobBenchmark.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package org.apache.flink.runtime.scheduler.benchmark.deploying;
+
+import org.apache.flink.runtime.executiongraph.Execution;
+import org.apache.flink.runtime.executiongraph.ExecutionVertex;
+import org.apache.flink.runtime.jobgraph.JobVertex;
+import org.apache.flink.runtime.scheduler.benchmark.JobConfiguration;
+
+/**
+ * The benchmark of deploying downstream tasks in a BATCH job. The related method is {@link
+ * Execution#deploy}.
+ */
+public class DeployingDownstreamTasksInBatchJobBenchmark extends DeployingTasksBenchmarkBase {
+
+    private ExecutionVertex[] vertices;
+
+    public void setup(JobConfiguration jobConfiguration) throws Exception {
+        createAndSetupExecutionGraph(jobConfiguration);
+
+        final JobVertex source = jobVertices.get(0);
+
+        for (ExecutionVertex ev : executionGraph.getJobVertex(source.getID()).getTaskVertices()) {
+            Execution execution = ev.getCurrentExecutionAttempt();
+            execution.deploy();
+        }
+
+        final JobVertex sink = jobVertices.get(1);
+
+        vertices = executionGraph.getJobVertex(sink.getID()).getTaskVertices();
+    }
+
+    public void deployDownstreamTasks() throws Exception {
+        for (ExecutionVertex ev : vertices) {
+            Execution execution = ev.getCurrentExecutionAttempt();
+            execution.deploy();
+        }
+    }
+}
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/deploying/DeployingDownstreamTasksInBatchJobBenchmarkTest.java b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/deploying/DeployingDownstreamTasksInBatchJobBenchmarkTest.java
new file mode 100644
index 0000000..27b605a
--- /dev/null
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/deploying/DeployingDownstreamTasksInBatchJobBenchmarkTest.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package org.apache.flink.runtime.scheduler.benchmark.deploying;
+
+import org.apache.flink.runtime.executiongraph.Execution;
+import org.apache.flink.runtime.scheduler.benchmark.JobConfiguration;
+import org.apache.flink.util.TestLogger;
+
+import org.junit.Test;
+
+/**
+ * The benchmark of deploying downstream tasks in a BATCH job. The related method is {@link
+ * Execution#deploy}.
+ */
+public class DeployingDownstreamTasksInBatchJobBenchmarkTest extends TestLogger {
+
+    @Test
+    public void deployDownstreamTasks() throws Exception {
+        DeployingDownstreamTasksInBatchJobBenchmark benchmark =
+                new DeployingDownstreamTasksInBatchJobBenchmark();
+        benchmark.setup(JobConfiguration.BATCH_TEST);
+        benchmark.deployDownstreamTasks();
+    }
+}
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/deploying/DeployingTasksBenchmarkBase.java b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/deploying/DeployingTasksBenchmarkBase.java
new file mode 100644
index 0000000..7c4137e
--- /dev/null
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/deploying/DeployingTasksBenchmarkBase.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package org.apache.flink.runtime.scheduler.benchmark.deploying;
+
+import org.apache.flink.runtime.deployment.TaskDeploymentDescriptor;
+import org.apache.flink.runtime.executiongraph.Execution;
+import org.apache.flink.runtime.executiongraph.ExecutionGraph;
+import org.apache.flink.runtime.executiongraph.ExecutionJobVertex;
+import org.apache.flink.runtime.executiongraph.ExecutionVertex;
+import org.apache.flink.runtime.executiongraph.utils.SimpleAckingTaskManagerGateway;
+import org.apache.flink.runtime.jobgraph.JobVertex;
+import org.apache.flink.runtime.jobmaster.LogicalSlot;
+import org.apache.flink.runtime.jobmaster.TestingLogicalSlotBuilder;
+import org.apache.flink.runtime.scheduler.benchmark.JobConfiguration;
+
+import java.util.List;
+import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.BlockingQueue;
+
+import static org.apache.flink.runtime.scheduler.benchmark.SchedulerBenchmarkUtils.createAndInitExecutionGraph;
+import static org.apache.flink.runtime.scheduler.benchmark.SchedulerBenchmarkUtils.createDefaultJobVertices;
+
+/** The base class of benchmarks related to deploying tasks. */
+public class DeployingTasksBenchmarkBase {
+
+    List<JobVertex> jobVertices;
+    ExecutionGraph executionGraph;
+    BlockingQueue<TaskDeploymentDescriptor> taskDeploymentDescriptors;
+
+    public void createAndSetupExecutionGraph(JobConfiguration jobConfiguration) throws Exception {
+
+        jobVertices = createDefaultJobVertices(jobConfiguration);
+
+        executionGraph = createAndInitExecutionGraph(jobVertices, jobConfiguration);
+
+        taskDeploymentDescriptors = new ArrayBlockingQueue<>(jobConfiguration.getParallelism() * 2);
+
+        final SimpleAckingTaskManagerGateway taskManagerGateway =
+                new SimpleAckingTaskManagerGateway();
+        taskManagerGateway.setSubmitConsumer(taskDeploymentDescriptors::offer);
+
+        final TestingLogicalSlotBuilder slotBuilder =
+                new TestingLogicalSlotBuilder().setTaskManagerGateway(taskManagerGateway);
+
+        for (ExecutionJobVertex ejv : executionGraph.getVerticesTopologically()) {
+            for (ExecutionVertex ev : ejv.getTaskVertices()) {
+                final LogicalSlot slot = slotBuilder.createTestingLogicalSlot();
+                final Execution execution = ev.getCurrentExecutionAttempt();
+                execution.registerProducedPartitions(slot.getTaskManagerLocation(), true).get();
+                if (!execution.tryAssignResource(slot)) {
+                    throw new RuntimeException("Error when assigning slot to execution.");
+                }
+            }
+        }
+    }
+}
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/deploying/DeployingTasksInStreamingJobBenchmark.java b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/deploying/DeployingTasksInStreamingJobBenchmark.java
new file mode 100644
index 0000000..8c16158
--- /dev/null
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/deploying/DeployingTasksInStreamingJobBenchmark.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package org.apache.flink.runtime.scheduler.benchmark.deploying;
+
+import org.apache.flink.runtime.executiongraph.Execution;
+import org.apache.flink.runtime.executiongraph.ExecutionJobVertex;
+import org.apache.flink.runtime.executiongraph.ExecutionVertex;
+import org.apache.flink.runtime.scheduler.benchmark.JobConfiguration;
+
+/**
+ * The benchmark of deploying tasks in a STREAMING job. The related method is {@link
+ * Execution#deploy}.
+ */
+public class DeployingTasksInStreamingJobBenchmark extends DeployingTasksBenchmarkBase {
+
+    public void setup(JobConfiguration jobConfiguration) throws Exception {
+        createAndSetupExecutionGraph(jobConfiguration);
+    }
+
+    public void deployAllTasks() throws Exception {
+        for (ExecutionJobVertex ejv : executionGraph.getVerticesTopologically()) {
+            for (ExecutionVertex ev : ejv.getTaskVertices()) {
+                Execution execution = ev.getCurrentExecutionAttempt();
+                execution.deploy();
+            }
+        }
+    }
+}
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/deploying/DeployingTasksInStreamingJobBenchmarkTest.java b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/deploying/DeployingTasksInStreamingJobBenchmarkTest.java
new file mode 100644
index 0000000..88bc0c8
--- /dev/null
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/deploying/DeployingTasksInStreamingJobBenchmarkTest.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package org.apache.flink.runtime.scheduler.benchmark.deploying;
+
+import org.apache.flink.runtime.executiongraph.Execution;
+import org.apache.flink.runtime.scheduler.benchmark.JobConfiguration;
+import org.apache.flink.util.TestLogger;
+
+import org.junit.Test;
+
+/**
+ * The benchmark of deploying tasks in a STREAMING job. The related method is {@link
+ * Execution#deploy}.
+ */
+public class DeployingTasksInStreamingJobBenchmarkTest extends TestLogger {
+
+    @Test
+    public void deployAllTasks() throws Exception {
+        DeployingTasksInStreamingJobBenchmark benchmark =
+                new DeployingTasksInStreamingJobBenchmark();
+        benchmark.setup(JobConfiguration.STREAMING_TEST);
+        benchmark.deployAllTasks();
+    }
+}
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/failover/FailoverBenchmarkBase.java b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/failover/FailoverBenchmarkBase.java
new file mode 100644
index 0000000..2de6d72
--- /dev/null
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/failover/FailoverBenchmarkBase.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package org.apache.flink.runtime.scheduler.benchmark.failover;
+
+import org.apache.flink.runtime.executiongraph.ExecutionGraph;
+import org.apache.flink.runtime.executiongraph.failover.flip1.RestartPipelinedRegionFailoverStrategy;
+import org.apache.flink.runtime.jobgraph.JobVertex;
+import org.apache.flink.runtime.scheduler.benchmark.JobConfiguration;
+import org.apache.flink.runtime.scheduler.strategy.SchedulingTopology;
+
+import java.util.List;
+
+import static org.apache.flink.runtime.scheduler.benchmark.SchedulerBenchmarkUtils.createAndInitExecutionGraph;
+import static org.apache.flink.runtime.scheduler.benchmark.SchedulerBenchmarkUtils.createDefaultJobVertices;
+
+/** The base class of benchmarks related to failover. */
+public class FailoverBenchmarkBase {
+
+    JobVertex source;
+    List<JobVertex> jobVertices;
+
+    ExecutionGraph executionGraph;
+    SchedulingTopology schedulingTopology;
+    RestartPipelinedRegionFailoverStrategy strategy;
+
+    public void createRestartPipelinedRegionFailoverStrategy(JobConfiguration jobConfiguration)
+            throws Exception {
+        jobVertices = createDefaultJobVertices(jobConfiguration);
+        source = jobVertices.get(0);
+        executionGraph = createAndInitExecutionGraph(jobVertices, jobConfiguration);
+        schedulingTopology = executionGraph.getSchedulingTopology();
+        strategy = new RestartPipelinedRegionFailoverStrategy(schedulingTopology);
+    }
+}
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/failover/RegionToRestartInBatchJobBenchmark.java b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/failover/RegionToRestartInBatchJobBenchmark.java
new file mode 100644
index 0000000..0f98cf2
--- /dev/null
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/failover/RegionToRestartInBatchJobBenchmark.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package org.apache.flink.runtime.scheduler.benchmark.failover;
+
+import org.apache.flink.runtime.execution.ExecutionState;
+import org.apache.flink.runtime.executiongraph.failover.flip1.RestartPipelinedRegionFailoverStrategy;
+import org.apache.flink.runtime.jobgraph.JobVertex;
+import org.apache.flink.runtime.jobmaster.TestingLogicalSlotBuilder;
+import org.apache.flink.runtime.scheduler.benchmark.JobConfiguration;
+import org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID;
+
+import java.util.Set;
+
+import static org.apache.flink.runtime.scheduler.benchmark.SchedulerBenchmarkUtils.deployTasks;
+import static org.apache.flink.runtime.scheduler.benchmark.SchedulerBenchmarkUtils.transitionTaskStatus;
+
+/**
+ * The benchmark of calculating the regions to restart when failover occurs in a BATCH job. The
+ * related method is {@link RestartPipelinedRegionFailoverStrategy#getTasksNeedingRestart}.
+ */
+public class RegionToRestartInBatchJobBenchmark extends FailoverBenchmarkBase {
+
+    public void setup(JobConfiguration jobConfiguration) throws Exception {
+        createRestartPipelinedRegionFailoverStrategy(jobConfiguration);
+
+        final JobVertex source = jobVertices.get(0);
+        final JobVertex sink = jobVertices.get(1);
+
+        final TestingLogicalSlotBuilder slotBuilder = new TestingLogicalSlotBuilder();
+
+        deployTasks(executionGraph, source.getID(), slotBuilder, true);
+
+        transitionTaskStatus(executionGraph, source.getID(), ExecutionState.FINISHED);
+
+        deployTasks(executionGraph, sink.getID(), slotBuilder, true);
+    }
+
+    public Set<ExecutionVertexID> calculateRegionToRestart() {
+        return strategy.getTasksNeedingRestart(
+                executionGraph.getJobVertex(source.getID()).getTaskVertices()[0].getID(),
+                new Exception("For test."));
+    }
+}
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/failover/RegionToRestartInBatchJobBenchmarkTest.java b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/failover/RegionToRestartInBatchJobBenchmarkTest.java
new file mode 100644
index 0000000..a9c12da
--- /dev/null
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/failover/RegionToRestartInBatchJobBenchmarkTest.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package org.apache.flink.runtime.scheduler.benchmark.failover;
+
+import org.apache.flink.runtime.executiongraph.failover.flip1.RestartPipelinedRegionFailoverStrategy;
+import org.apache.flink.runtime.scheduler.benchmark.JobConfiguration;
+import org.apache.flink.util.TestLogger;
+
+import org.junit.Test;
+
+/**
+ * The benchmark of calculating the regions to restart when failover occurs in a BATCH job. The
+ * related method is {@link RestartPipelinedRegionFailoverStrategy#getTasksNeedingRestart}.
+ */
+public class RegionToRestartInBatchJobBenchmarkTest extends TestLogger {
+
+    @Test
+    public void calculateRegionToRestart() throws Exception {
+        RegionToRestartInBatchJobBenchmark benchmark = new RegionToRestartInBatchJobBenchmark();
+        benchmark.setup(JobConfiguration.BATCH_TEST);
+        benchmark.calculateRegionToRestart();
+    }
+}
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/failover/RegionToRestartInStreamingJobBenchmark.java b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/failover/RegionToRestartInStreamingJobBenchmark.java
new file mode 100644
index 0000000..08d3b9e
--- /dev/null
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/failover/RegionToRestartInStreamingJobBenchmark.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package org.apache.flink.runtime.scheduler.benchmark.failover;
+
+import org.apache.flink.runtime.executiongraph.failover.flip1.RestartPipelinedRegionFailoverStrategy;
+import org.apache.flink.runtime.jobmaster.TestingLogicalSlotBuilder;
+import org.apache.flink.runtime.scheduler.benchmark.JobConfiguration;
+import org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID;
+
+import java.util.Set;
+
+import static org.apache.flink.runtime.executiongraph.ExecutionGraphTestUtils.switchAllVerticesToRunning;
+import static org.apache.flink.runtime.scheduler.benchmark.SchedulerBenchmarkUtils.deployAllTasks;
+
+/**
+ * The benchmark of calculating region to restart when failover occurs in a STREAMING job. The
+ * related method is {@link RestartPipelinedRegionFailoverStrategy#getTasksNeedingRestart}.
+ */
+public class RegionToRestartInStreamingJobBenchmark extends FailoverBenchmarkBase {
+
+    public void setup(JobConfiguration jobConfiguration) throws Exception {
+        createRestartPipelinedRegionFailoverStrategy(jobConfiguration);
+
+        TestingLogicalSlotBuilder slotBuilder = new TestingLogicalSlotBuilder();
+
+        deployAllTasks(executionGraph, slotBuilder);
+
+        switchAllVerticesToRunning(executionGraph);
+    }
+
+    public Set<ExecutionVertexID> calculateRegionToRestart() {
+        return strategy.getTasksNeedingRestart(
+                executionGraph.getJobVertex(source.getID()).getTaskVertices()[0].getID(),
+                new Exception("For test."));
+    }
+}
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/failover/RegionToRestartInStreamingJobBenchmarkTest.java b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/failover/RegionToRestartInStreamingJobBenchmarkTest.java
new file mode 100644
index 0000000..a7b3e49
--- /dev/null
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/failover/RegionToRestartInStreamingJobBenchmarkTest.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package org.apache.flink.runtime.scheduler.benchmark.failover;
+
+import org.apache.flink.runtime.executiongraph.failover.flip1.RestartPipelinedRegionFailoverStrategy;
+import org.apache.flink.runtime.scheduler.benchmark.JobConfiguration;
+import org.apache.flink.util.TestLogger;
+
+import org.junit.Test;
+
+/**
+ * The benchmark of calculating region to restart when failover occurs in a STREAMING job. The
+ * related method is {@link RestartPipelinedRegionFailoverStrategy#getTasksNeedingRestart}.
+ */
+public class RegionToRestartInStreamingJobBenchmarkTest extends TestLogger {
+
+    @Test
+    public void calculateRegionToRestart() throws Exception {
+        RegionToRestartInStreamingJobBenchmark benchmark =
+                new RegionToRestartInStreamingJobBenchmark();
+        benchmark.setup(JobConfiguration.STREAMING_TEST);
+        benchmark.calculateRegionToRestart();
+    }
+}
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/partitionrelease/PartitionReleaseInBatchJobBenchmark.java b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/partitionrelease/PartitionReleaseInBatchJobBenchmark.java
new file mode 100644
index 0000000..0c9c70f
--- /dev/null
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/partitionrelease/PartitionReleaseInBatchJobBenchmark.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package org.apache.flink.runtime.scheduler.benchmark.partitionrelease;
+
+import org.apache.flink.runtime.execution.ExecutionState;
+import org.apache.flink.runtime.executiongraph.ExecutionGraph;
+import org.apache.flink.runtime.executiongraph.failover.flip1.partitionrelease.RegionPartitionReleaseStrategy;
+import org.apache.flink.runtime.jobgraph.JobVertex;
+import org.apache.flink.runtime.jobmaster.TestingLogicalSlotBuilder;
+import org.apache.flink.runtime.scheduler.benchmark.JobConfiguration;
+
+import java.util.List;
+
+import static org.apache.flink.runtime.scheduler.benchmark.SchedulerBenchmarkUtils.createAndInitExecutionGraph;
+import static org.apache.flink.runtime.scheduler.benchmark.SchedulerBenchmarkUtils.createDefaultJobVertices;
+import static org.apache.flink.runtime.scheduler.benchmark.SchedulerBenchmarkUtils.deployTasks;
+import static org.apache.flink.runtime.scheduler.benchmark.SchedulerBenchmarkUtils.transitionTaskStatus;
+
+/**
+ * The benchmark of releasing partitions in a BATCH job. The related method is {@link
+ * RegionPartitionReleaseStrategy#vertexFinished}.
+ */
+public class PartitionReleaseInBatchJobBenchmark {
+
+    private ExecutionGraph executionGraph;
+    private JobVertex sink;
+
+    public void setup(JobConfiguration jobConfiguration) throws Exception {
+        final List<JobVertex> jobVertices = createDefaultJobVertices(jobConfiguration);
+
+        executionGraph = createAndInitExecutionGraph(jobVertices, jobConfiguration);
+
+        final JobVertex source = jobVertices.get(0);
+        sink = jobVertices.get(1);
+
+        final TestingLogicalSlotBuilder slotBuilder = new TestingLogicalSlotBuilder();
+
+        deployTasks(executionGraph, source.getID(), slotBuilder, true);
+
+        transitionTaskStatus(executionGraph, source.getID(), ExecutionState.FINISHED);
+
+        deployTasks(executionGraph, sink.getID(), slotBuilder, true);
+    }
+
+    public void partitionRelease() {
+        transitionTaskStatus(executionGraph, sink.getID(), ExecutionState.FINISHED);
+    }
+}
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/partitionrelease/PartitionReleaseInBatchJobBenchmarkTest.java b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/partitionrelease/PartitionReleaseInBatchJobBenchmarkTest.java
new file mode 100644
index 0000000..cee29e2
--- /dev/null
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/partitionrelease/PartitionReleaseInBatchJobBenchmarkTest.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package org.apache.flink.runtime.scheduler.benchmark.partitionrelease;
+
+import org.apache.flink.runtime.executiongraph.failover.flip1.partitionrelease.RegionPartitionReleaseStrategy;
+import org.apache.flink.runtime.scheduler.benchmark.JobConfiguration;
+import org.apache.flink.util.TestLogger;
+
+import org.junit.Test;
+
+/**
+ * The benchmark of releasing partitions in a BATCH job. The related method is {@link
+ * RegionPartitionReleaseStrategy#vertexFinished}.
+ */
+public class PartitionReleaseInBatchJobBenchmarkTest extends TestLogger {
+
+    @Test
+    public void partitionRelease() throws Exception {
+        PartitionReleaseInBatchJobBenchmark benchmark = new PartitionReleaseInBatchJobBenchmark();
+        benchmark.setup(JobConfiguration.BATCH_TEST);
+        benchmark.partitionRelease();
+    }
+}
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/scheduling/InitSchedulingStrategyBenchmark.java b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/scheduling/InitSchedulingStrategyBenchmark.java
new file mode 100644
index 0000000..34158d0
--- /dev/null
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/scheduling/InitSchedulingStrategyBenchmark.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package org.apache.flink.runtime.scheduler.benchmark.scheduling;
+
+import org.apache.flink.runtime.scheduler.benchmark.JobConfiguration;
+import org.apache.flink.runtime.scheduler.strategy.PipelinedRegionSchedulingStrategy;
+
+/**
+ * The benchmark of initializing {@link PipelinedRegionSchedulingStrategy} in a STREAMING/BATCH job.
+ */
+public class InitSchedulingStrategyBenchmark extends SchedulingBenchmarkBase {
+
+    public InitSchedulingStrategyBenchmark() {}
+
+    public void setup(JobConfiguration jobConfiguration) throws Exception {
+        initSchedulingTopology(jobConfiguration);
+    }
+
+    public PipelinedRegionSchedulingStrategy initSchedulingStrategy() {
+        return new PipelinedRegionSchedulingStrategy(schedulerOperations, schedulingTopology);
+    }
+}
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/scheduling/InitSchedulingStrategyBenchmarkTest.java b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/scheduling/InitSchedulingStrategyBenchmarkTest.java
new file mode 100644
index 0000000..1b9aace
--- /dev/null
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/scheduling/InitSchedulingStrategyBenchmarkTest.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package org.apache.flink.runtime.scheduler.benchmark.scheduling;
+
+import org.apache.flink.runtime.scheduler.benchmark.JobConfiguration;
+import org.apache.flink.runtime.scheduler.strategy.PipelinedRegionSchedulingStrategy;
+import org.apache.flink.util.TestLogger;
+
+import org.junit.Test;
+
+/**
+ * The benchmark of initializing {@link PipelinedRegionSchedulingStrategy} in a STREAMING/BATCH job.
+ */
+public class InitSchedulingStrategyBenchmarkTest extends TestLogger {
+
+    @Test
+    public void initSchedulingStrategyBenchmarkInStreamingJob() throws Exception {
+        InitSchedulingStrategyBenchmark benchmark = new InitSchedulingStrategyBenchmark();
+        benchmark.setup(JobConfiguration.STREAMING_TEST);
+        benchmark.initSchedulingStrategy();
+    }
+
+    @Test
+    public void initSchedulingStrategyBenchmarkInBatchJob() throws Exception {
+        InitSchedulingStrategyBenchmark benchmark = new InitSchedulingStrategyBenchmark();
+        benchmark.setup(JobConfiguration.BATCH_TEST);
+        benchmark.initSchedulingStrategy();
+    }
+}
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/scheduling/SchedulingBenchmarkBase.java b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/scheduling/SchedulingBenchmarkBase.java
new file mode 100644
index 0000000..3a8cd08
--- /dev/null
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/scheduling/SchedulingBenchmarkBase.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package org.apache.flink.runtime.scheduler.benchmark.scheduling;
+
+import org.apache.flink.runtime.executiongraph.ExecutionGraph;
+import org.apache.flink.runtime.jobgraph.JobVertex;
+import org.apache.flink.runtime.scheduler.benchmark.JobConfiguration;
+import org.apache.flink.runtime.scheduler.strategy.SchedulingTopology;
+import org.apache.flink.runtime.scheduler.strategy.TestingSchedulerOperations;
+
+import java.util.List;
+
+import static org.apache.flink.runtime.scheduler.benchmark.SchedulerBenchmarkUtils.createAndInitExecutionGraph;
+import static org.apache.flink.runtime.scheduler.benchmark.SchedulerBenchmarkUtils.createDefaultJobVertices;
+
+/** The base class of benchmarks related to scheduling tasks. */
+public class SchedulingBenchmarkBase {
+
+    TestingSchedulerOperations schedulerOperations;
+    List<JobVertex> jobVertices;
+    ExecutionGraph executionGraph;
+    SchedulingTopology schedulingTopology;
+
+    public void initSchedulingTopology(JobConfiguration jobConfiguration) throws Exception {
+        schedulerOperations = new TestingSchedulerOperations();
+        jobVertices = createDefaultJobVertices(jobConfiguration);
+        executionGraph = createAndInitExecutionGraph(jobVertices, jobConfiguration);
+        schedulingTopology = executionGraph.getSchedulingTopology();
+    }
+}
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/scheduling/SchedulingDownstreamTasksInBatchJobBenchmark.java b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/scheduling/SchedulingDownstreamTasksInBatchJobBenchmark.java
new file mode 100644
index 0000000..04e0fe8
--- /dev/null
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/scheduling/SchedulingDownstreamTasksInBatchJobBenchmark.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package org.apache.flink.runtime.scheduler.benchmark.scheduling;
+
+import org.apache.flink.runtime.execution.ExecutionState;
+import org.apache.flink.runtime.executiongraph.IntermediateResult;
+import org.apache.flink.runtime.scheduler.benchmark.JobConfiguration;
+import org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID;
+import org.apache.flink.runtime.scheduler.strategy.PipelinedRegionSchedulingStrategy;
+
+import java.lang.reflect.Field;
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ * The benchmark of scheduling downstream task in a BATCH job. The related method is {@link
+ * PipelinedRegionSchedulingStrategy#onExecutionStateChange}.
+ */
+public class SchedulingDownstreamTasksInBatchJobBenchmark extends SchedulingBenchmarkBase {
+
+    private ExecutionVertexID executionVertexID;
+    private PipelinedRegionSchedulingStrategy schedulingStrategy;
+
+    public void setup(JobConfiguration jobConfiguration) throws Exception {
+        initSchedulingTopology(jobConfiguration);
+
+        schedulingStrategy =
+                new PipelinedRegionSchedulingStrategy(schedulerOperations, schedulingTopology);
+
+        // When we trying to scheduling downstream tasks via
+        // onExecutionStateChange(ExecutionState.FINISHED),
+        // the result partitions of upstream tasks need to be CONSUMABLE.
+        // The CONSUMABLE status is determined by the variable "numberOfRunningProducers" of the
+        // IntermediateResult.
+        // Its value cannot be changed by any public methods.
+        // So here we use reflections to modify this value and then schedule the downstream tasks.
+        for (IntermediateResult result : executionGraph.getAllIntermediateResults().values()) {
+            Field f = result.getClass().getDeclaredField("numberOfRunningProducers");
+            f.setAccessible(true);
+            AtomicInteger numberOfRunningProducers = (AtomicInteger) f.get(result);
+            numberOfRunningProducers.set(0);
+        }
+
+        executionVertexID =
+                executionGraph
+                        .getJobVertex(jobVertices.get(0).getID())
+                        .getTaskVertices()[0]
+                        .getID();
+    }
+
+    public void schedulingDownstreamTasks() {
+        schedulingStrategy.onExecutionStateChange(executionVertexID, ExecutionState.FINISHED);
+    }
+}
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/scheduling/SchedulingDownstreamTasksInBatchJobBenchmarkTest.java b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/scheduling/SchedulingDownstreamTasksInBatchJobBenchmarkTest.java
new file mode 100644
index 0000000..bc7ef88
--- /dev/null
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/scheduling/SchedulingDownstreamTasksInBatchJobBenchmarkTest.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package org.apache.flink.runtime.scheduler.benchmark.scheduling;
+
+import org.apache.flink.runtime.scheduler.benchmark.JobConfiguration;
+import org.apache.flink.runtime.scheduler.strategy.PipelinedRegionSchedulingStrategy;
+
+import org.junit.Test;
+
+/**
+ * The benchmark of scheduling downstream task in a BATCH job. The related method is {@link
+ * PipelinedRegionSchedulingStrategy#onExecutionStateChange}.
+ */
+public class SchedulingDownstreamTasksInBatchJobBenchmarkTest {
+
+    @Test
+    public void schedulingDownstreamTasksInBatchJobBenchmark() throws Exception {
+        SchedulingDownstreamTasksInBatchJobBenchmark benchmark =
+                new SchedulingDownstreamTasksInBatchJobBenchmark();
+        benchmark.setup(JobConfiguration.BATCH_TEST);
+        benchmark.schedulingDownstreamTasks();
+    }
+}
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/topology/BuildExecutionGraphBenchmark.java b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/topology/BuildExecutionGraphBenchmark.java
new file mode 100644
index 0000000..27f77cc
--- /dev/null
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/topology/BuildExecutionGraphBenchmark.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package org.apache.flink.runtime.scheduler.benchmark.topology;
+
+import org.apache.flink.runtime.executiongraph.ExecutionGraph;
+import org.apache.flink.runtime.executiongraph.TestingDefaultExecutionGraphBuilder;
+import org.apache.flink.runtime.jobgraph.JobGraph;
+import org.apache.flink.runtime.jobgraph.JobVertex;
+import org.apache.flink.runtime.scheduler.benchmark.JobConfiguration;
+
+import java.util.List;
+
+import static org.apache.flink.runtime.scheduler.benchmark.SchedulerBenchmarkUtils.createDefaultJobVertices;
+import static org.apache.flink.runtime.scheduler.benchmark.SchedulerBenchmarkUtils.createJobGraph;
+
+/**
+ * The benchmark of building the topology of {@link ExecutionGraph} in a STREAMING/BATCH job. The
+ * related method is {@link ExecutionGraph#attachJobGraph},
+ */
+public class BuildExecutionGraphBenchmark {
+
+    private List<JobVertex> jobVertices;
+    private ExecutionGraph executionGraph;
+
+    public BuildExecutionGraphBenchmark() {}
+
+    public void setup(JobConfiguration jobConfiguration) throws Exception {
+        jobVertices = createDefaultJobVertices(jobConfiguration);
+        final JobGraph jobGraph = createJobGraph(jobConfiguration);
+        executionGraph =
+                TestingDefaultExecutionGraphBuilder.newBuilder().setJobGraph(jobGraph).build();
+    }
+
+    public void buildTopology() throws Exception {
+        executionGraph.attachJobGraph(jobVertices);
+    }
+}
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/topology/BuildExecutionGraphBenchmarkTest.java b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/topology/BuildExecutionGraphBenchmarkTest.java
new file mode 100644
index 0000000..91fa252
--- /dev/null
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/benchmark/topology/BuildExecutionGraphBenchmarkTest.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package org.apache.flink.runtime.scheduler.benchmark.topology;
+
+import org.apache.flink.runtime.executiongraph.ExecutionGraph;
+import org.apache.flink.runtime.scheduler.benchmark.JobConfiguration;
+import org.apache.flink.util.TestLogger;
+
+import org.junit.Test;
+
+/**
+ * The benchmark of building the topology of {@link ExecutionGraph} in a STREAMING/BATCH job. The
+ * related method is {@link ExecutionGraph#attachJobGraph},
+ */
+public class BuildExecutionGraphBenchmarkTest extends TestLogger {
+
+    @Test
+    public void buildTopologyInStreamingJob() throws Exception {
+        BuildExecutionGraphBenchmark benchmark = new BuildExecutionGraphBenchmark();
+        benchmark.setup(JobConfiguration.STREAMING_TEST);
+        benchmark.buildTopology();
+    }
+
+    @Test
+    public void buildTopologyInBatchJob() throws Exception {
+        BuildExecutionGraphBenchmark benchmark = new BuildExecutionGraphBenchmark();
+        benchmark.setup(JobConfiguration.BATCH_TEST);
+        benchmark.buildTopology();
+    }
+}