zhuzhurk commented on a change in pull request #7: URL: https://github.com/apache/flink-benchmarks/pull/7#discussion_r570795057
########## File path: src/main/java/org/apache/flink/scheduler/benchmark/deploying/DeployingTasksBenchmarkBase.java ########## @@ -0,0 +1,83 @@ +/* + * 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.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.scheduler.benchmark.ColdStartSchedulerBenchmarkBase; +import org.apache.flink.scheduler.benchmark.JobConfiguration; + +import java.util.List; +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.BlockingQueue; + +import static org.apache.flink.scheduler.benchmark.SchedulerBenchmarkUtils.createAndInitExecutionGraph; +import static org.apache.flink.scheduler.benchmark.SchedulerBenchmarkUtils.createDefaultJobVertices; + +public class DeployingTasksBenchmarkBase extends ColdStartSchedulerBenchmarkBase { + + List<JobVertex> jobVertices; + ExecutionGraph executionGraph; + BlockingQueue<TaskDeploymentDescriptor> taskDeploymentDescriptors; + + public void createAndSetupExecutionGraph(JobConfiguration jobConfiguration) throws Exception { + + jobVertices = createDefaultJobVertices( Review comment: Maybe simplify this method to be `createDefaultJobVertices(JobConfiguration)`? ########## File path: src/main/java/org/apache/flink/scheduler/benchmark/JobConfiguration.java ########## @@ -0,0 +1,57 @@ +/* + * 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.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.ScheduleMode; + +public enum JobConfiguration { + + STREAMING(DistributionPattern.ALL_TO_ALL, + ResultPartitionType.PIPELINED, + ScheduleMode.EAGER, + ExecutionMode.PIPELINED), + + BATCH(DistributionPattern.ALL_TO_ALL, + ResultPartitionType.BLOCKING, + ScheduleMode.LAZY_FROM_SOURCES, + ExecutionMode.BATCH); + + JobConfiguration( + DistributionPattern distributionPattern, + ResultPartitionType resultPartitionType, + ScheduleMode scheduleMode, + ExecutionMode executionMode) { + this.distributionPattern = distributionPattern; + this.resultPartitionType = resultPartitionType; + this.scheduleMode = scheduleMode; + this.executionMode = executionMode; + } + + public final DistributionPattern distributionPattern; Review comment: Can we have getters for these fields instead of publicly exposing them? ########## File path: src/main/java/org/apache/flink/scheduler/benchmark/deploying/DeployingTasksInStreamingJobBenchmark.java ########## @@ -0,0 +1,77 @@ +/* + * 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.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.scheduler.benchmark.JobConfiguration; +import org.apache.flink.scheduler.benchmark.SchedulerBenchmarkUtils; + +import org.openjdk.jmh.annotations.Benchmark; +import org.openjdk.jmh.annotations.BenchmarkMode; +import org.openjdk.jmh.annotations.Level; +import org.openjdk.jmh.annotations.Mode; +import org.openjdk.jmh.annotations.Param; +import org.openjdk.jmh.annotations.Setup; +import org.openjdk.jmh.annotations.TearDown; +import org.openjdk.jmh.runner.Runner; +import org.openjdk.jmh.runner.RunnerException; +import org.openjdk.jmh.runner.options.Options; +import org.openjdk.jmh.runner.options.OptionsBuilder; +import org.openjdk.jmh.runner.options.VerboseMode; + + +public class DeployingTasksInStreamingJobBenchmark extends DeployingTasksBenchmarkBase { + + @Param("STREAMING") + private JobConfiguration jobConfiguration; + + public static void main(String[] args) throws RunnerException { + Options options = new OptionsBuilder() + .verbosity(VerboseMode.NORMAL) + .include(".*" + DeployingTasksInStreamingJobBenchmark.class.getCanonicalName() + ".*") + .build(); + + new Runner(options).run(); Review comment: Maybe adding a util method `runBenchmark(Class<?> clazz)` to avoid having this code piece in every benchmark? ########## File path: src/main/java/org/apache/flink/scheduler/benchmark/deploying/DeployingTasksBenchmarkBase.java ########## @@ -0,0 +1,83 @@ +/* + * 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.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.scheduler.benchmark.ColdStartSchedulerBenchmarkBase; +import org.apache.flink.scheduler.benchmark.JobConfiguration; + +import java.util.List; +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.BlockingQueue; + +import static org.apache.flink.scheduler.benchmark.SchedulerBenchmarkUtils.createAndInitExecutionGraph; +import static org.apache.flink.scheduler.benchmark.SchedulerBenchmarkUtils.createDefaultJobVertices; + +public class DeployingTasksBenchmarkBase extends ColdStartSchedulerBenchmarkBase { + + List<JobVertex> jobVertices; + ExecutionGraph executionGraph; + BlockingQueue<TaskDeploymentDescriptor> taskDeploymentDescriptors; + + public void createAndSetupExecutionGraph(JobConfiguration jobConfiguration) throws Exception { + + jobVertices = createDefaultJobVertices( + PARALLELISM, + jobConfiguration.distributionPattern, + jobConfiguration.resultPartitionType); + + executionGraph = createAndInitExecutionGraph( Review comment: Maybe simplify this method to `createAndInitExecutionGraph(jobVertices, JobConfiguration)`? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
