sk0x50 commented on code in PR #5081: URL: https://github.com/apache/ignite-3/pull/5081#discussion_r1926566093
########## modules/runner/src/integrationTest/java/org/apache/ignite/internal/benchmark/CreatingTableBenchmark.java: ########## @@ -0,0 +1,116 @@ +/* + * 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.ignite.internal.benchmark; + +import static java.util.concurrent.TimeUnit.MILLISECONDS; +import static org.apache.ignite.internal.testframework.TestIgnitionManager.PRODUCTION_CLUSTER_CONFIG_STRING; +import static org.openjdk.jmh.annotations.Mode.AverageTime; + +import java.util.concurrent.atomic.AtomicInteger; +import org.openjdk.jmh.annotations.Benchmark; +import org.openjdk.jmh.annotations.BenchmarkMode; +import org.openjdk.jmh.annotations.Fork; +import org.openjdk.jmh.annotations.Measurement; +import org.openjdk.jmh.annotations.OutputTimeUnit; +import org.openjdk.jmh.annotations.Param; +import org.openjdk.jmh.annotations.Scope; +import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.annotations.Threads; +import org.openjdk.jmh.annotations.Warmup; +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; + +/** + * This benchmark measures creating a new table in the default distribution zone. + */ +@Fork(1) +@State(Scope.Benchmark) +public class CreatingTableBenchmark extends AbstractMultiNodeBenchmark { + @Param({"3"}) + private int clusterSize; + + @Param({"1", "8"}) + private int partitionCount; + + @Param({"1", "3"}) + private int replicaCount; + + @Param({"true", "false"}) + private boolean populateTable; + + /** Tables counter. */ + private final AtomicInteger cnt = new AtomicInteger(); + + @Override + protected String clusterConfiguration() { + // Return a magic string that explicitly requests production defaults. + return PRODUCTION_CLUSTER_CONFIG_STRING; + } + + @Override + protected int nodes() { + return clusterSize; + } + + @Override + protected int partitionCount() { + return partitionCount; + } + + @Override + protected int replicaCount() { + return replicaCount; + } + + @Override + protected void createDefaultTableOnStartup() { + // There is no need to create a table on start-up. + } + + /** + * Measures creating a new table in the default distribution zone. + */ + @Benchmark + @Threads(1) + @Warmup(iterations = 5, time = 5) + @Measurement(iterations = 5, time = 5) + @BenchmarkMode(AverageTime) + @OutputTimeUnit(MILLISECONDS) + public void createTableInDefaultZone() { + String tableName = "table_test_" + cnt.incrementAndGet(); + + createTable(tableName); Review Comment: I would assume that `replicaCount` should affect the result (and it does), and `partitionCount` may affect the benchmark. Perhaps, 8 partitions are not enough. ########## modules/runner/src/integrationTest/java/org/apache/ignite/internal/benchmark/AbstractMultiNodeBenchmark.java: ########## @@ -90,25 +89,31 @@ public void nodeSetUp() throws Exception { startCluster(); try { - var queryEngine = igniteImpl.queryEngine(); - - var createZoneStatement = "CREATE ZONE IF NOT EXISTS " + ZONE_NAME + " WITH partitions=" + partitionCount() - + ", replicas=" + replicaCount() + ", storage_profiles ='" + DEFAULT_STORAGE_PROFILE + "'"; + // Create a new zone on the cluster's start-up. + createDistributionZoneOnStartup(); - getAllFromCursor( - await(queryEngine.queryAsync( - SqlPropertiesHelper.emptyProperties(), igniteImpl.observableTimeTracker(), null, null, createZoneStatement - )) - ); - - createTable(TABLE_NAME); + // Create a default table on the cluster's start-up. Review Comment: Ok -- 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: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org