ascherbakoff commented on code in PR #4227:
URL: https://github.com/apache/ignite-3/pull/4227#discussion_r1721481626


##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/benchmark/UpsertKvBenchmark.java:
##########
@@ -0,0 +1,109 @@
+/*
+ * 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 java.util.concurrent.TimeUnit;
+import org.apache.ignite.internal.lang.IgniteSystemProperties;
+import org.apache.ignite.table.KeyValueView;
+import org.apache.ignite.table.Tuple;
+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.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.Setup;
+import org.openjdk.jmh.annotations.State;
+import org.openjdk.jmh.annotations.TearDown;
+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;
+
+/**
+ * Benchmark for a single upsert operation via KV API with a possibility to 
disable updates via RAFT and to storage.
+ */
+@State(Scope.Benchmark)
+@Fork(1)
+@Threads(1)
+@Warmup(iterations = 10, time = 2)
+@Measurement(iterations = 20, time = 2)
+@BenchmarkMode(Mode.AverageTime)
+@OutputTimeUnit(TimeUnit.MICROSECONDS)
+public class UpsertKvBenchmark extends AbstractMultiNodeBenchmark {
+    private final Tuple tuple = Tuple.create();
+
+    private int id = 0;
+
+    private static KeyValueView<Tuple, Tuple> kvView;
+
+    @Override
+    public void nodeSetUp() throws Exception {
+        
System.setProperty(IgniteSystemProperties.SKIP_REPLICATION_IN_BENCHMARK, 
"true");
+        
System.setProperty(IgniteSystemProperties.SKIP_STORAGE_UPDATE_IN_BENCHMARK, 
"true");
+        super.nodeSetUp();
+    }
+
+    /**
+     * Initializes the tuple.
+     */
+    @Setup
+    public void setUp() {
+        kvView = clusterNode.tables().table(TABLE_NAME).keyValueView();
+        for (int i = 1; i < 11; i++) {
+            tuple.set("field" + i, FIELD_VAL);
+        }
+    }
+
+    @TearDown
+    public void tearDown() {
+        System.out.println("Inserted " + id + " tuples");

Review Comment:
   Currenty all benchmarks don't use logger. This can be changed separately.



-- 
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]

Reply via email to