pnowojski commented on code in PR #77: URL: https://github.com/apache/flink-benchmarks/pull/77#discussion_r1250910775
########## src/main/java/org/apache/flink/benchmark/WatermarkAggregationBenchmark.java: ########## @@ -0,0 +1,75 @@ +/* + * 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.benchmark; + +import org.apache.flink.runtime.source.coordinator.SourceCoordinatorAlignmentBenchmark; + +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; + +/** The watermark aggregation benchmark for source coordinator when enabling the watermark alignment. */ +@BenchmarkMode(Mode.AverageTime) +public class WatermarkAggregationBenchmark extends BenchmarkBase { + + @Param({"5000", "10000", "20000"}) Review Comment: I would run this benchmark only with a single parameter, to not prolong the benchmarking time. `5000` seems to be large enough to show problems, while also being somehow small enough to be reasonable value that could be expected in real world use cases. ########## src/main/java/org/apache/flink/benchmark/WatermarkAggregationBenchmark.java: ########## @@ -0,0 +1,75 @@ +/* + * 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.benchmark; + +import org.apache.flink.runtime.source.coordinator.SourceCoordinatorAlignmentBenchmark; + +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; + +/** The watermark aggregation benchmark for source coordinator when enabling the watermark alignment. */ +@BenchmarkMode(Mode.AverageTime) +public class WatermarkAggregationBenchmark extends BenchmarkBase { + + @Param({"5000", "10000", "20000"}) + public int numSubtasks; + + @Param({"MONOTONE_INCREASING", "RANDOMIZE_MILLISECONDS"}) + public SourceCoordinatorAlignmentBenchmark.TimestampType timestampType; + + private SourceCoordinatorAlignmentBenchmark benchmark; + + public static void main(String[] args) throws RunnerException { + Options options = + new OptionsBuilder() + .verbosity(VerboseMode.NORMAL) + .include(".*" + WatermarkAggregationBenchmark.class.getCanonicalName() + ".*") + .build(); + + new Runner(options).run(); + } + + @Setup(Level.Trial) + public void setup() throws Exception { + benchmark = new SourceCoordinatorAlignmentBenchmark(); + benchmark.setup(numSubtasks, timestampType); + } + + @Benchmark + public void aggregateWatermark() { + benchmark.sendReportedWatermarkToAllSubtasks(); + } Review Comment: 3ms per invocation here might be on the border of being too small. It might make sense to have a loop of sending and reporting watermark 10 times per each `aggregateWatermark` invocation. ########## src/main/java/org/apache/flink/benchmark/WatermarkAggregationBenchmark.java: ########## @@ -0,0 +1,75 @@ +/* + * 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.benchmark; + +import org.apache.flink.runtime.source.coordinator.SourceCoordinatorAlignmentBenchmark; + +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; + +/** The watermark aggregation benchmark for source coordinator when enabling the watermark alignment. */ +@BenchmarkMode(Mode.AverageTime) +public class WatermarkAggregationBenchmark extends BenchmarkBase { + + @Param({"5000", "10000", "20000"}) + public int numSubtasks; + + @Param({"MONOTONE_INCREASING", "RANDOMIZE_MILLISECONDS"}) Review Comment: Does it matter? Can we drop this and have only a single hardcoded `RANDOMIZE_MILLISECONDS` parameter? Isn't `MONOTONE_INCREASING` unrealistic? ########## src/main/java/org/apache/flink/benchmark/WatermarkAggregationBenchmark.java: ########## @@ -0,0 +1,75 @@ +/* + * 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.benchmark; + +import org.apache.flink.runtime.source.coordinator.SourceCoordinatorAlignmentBenchmark; + +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; + +/** The watermark aggregation benchmark for source coordinator when enabling the watermark alignment. */ +@BenchmarkMode(Mode.AverageTime) Review Comment: It would be great to keep the results consistent with other benchmarks, so as `ops/time`. `time/op` is "less is better", which causes later problems when trying to visualize/compare/analyse the results. If you hardcode/inline `numSubtasks=5000` parameter, you could have `@BenchmarkMode(Throughput)` with `@OperationsPerInvocation(5000 * X)`. Where `X` is number of `sendReportedWatermarkToAllSubtasks` calls in a single `aggregateWatermark` invocation. -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
