You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "xtern (via GitHub)" <gi...@apache.org> on 2023/12/14 12:29:10 UTC
[PR] IGNITE-20662 Sql. Added a microbenchmark to measure script execution performance [ignite-3]
xtern opened a new pull request, #2955:
URL: https://github.com/apache/ignite-3/pull/2955
Thank you for submitting the pull request.
To streamline the review process of the patch and ensure better code quality
we ask both an author and a reviewer to verify the following:
### The Review Checklist
- [ ] **Formal criteria:** TC status, codestyle, mandatory documentation. Also make sure to complete the following:
\- There is a single JIRA ticket related to the pull request.
\- The web-link to the pull request is attached to the JIRA ticket.
\- The JIRA ticket has the Patch Available state.
\- The description of the JIRA ticket explains WHAT was made, WHY and HOW.
\- The pull request title is treated as the final commit message. The following pattern must be used: IGNITE-XXXX Change summary where XXXX - number of JIRA issue.
- [ ] **Design:** new code conforms with the design principles of the components it is added to.
- [ ] **Patch quality:** patch cannot be split into smaller pieces, its size must be reasonable.
- [ ] **Code quality:** code is clean and readable, necessary developer documentation is added if needed.
- [ ] **Tests code quality:** test set covers positive/negative scenarios, happy/edge cases. Tests are effective in terms of execution time and resources.
### Notes
- [Apache Ignite Coding Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Java+Code+Style+Guide)
--
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-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-20662 Sql. Added a microbenchmark to measure script execution performance [ignite-3]
Posted by "zstan (via GitHub)" <gi...@apache.org>.
zstan commented on code in PR #2955:
URL: https://github.com/apache/ignite-3/pull/2955#discussion_r1427652287
##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/benchmark/SqlMultiStatementBenchmark.java:
##########
@@ -0,0 +1,484 @@
+/*
+ * 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.stream.Collectors.joining;
+import static org.apache.ignite.internal.lang.IgniteStringFormatter.format;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.concurrent.TimeUnit;
+import java.util.function.Function;
+import java.util.stream.IntStream;
+import org.apache.ignite.internal.lang.IgniteStringBuilder;
+import org.apache.ignite.internal.sql.engine.AsyncSqlCursor;
+import org.apache.ignite.internal.sql.engine.InternalSqlRow;
+import org.apache.ignite.internal.sql.engine.QueryProcessor;
+import org.apache.ignite.internal.sql.engine.property.SqlProperties;
+import org.apache.ignite.internal.sql.engine.property.SqlPropertiesHelper;
+import org.apache.ignite.internal.util.AsyncCursor.BatchedResult;
+import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.sql.ResultSet;
+import org.apache.ignite.sql.Session;
+import org.apache.ignite.table.Tuple;
+import org.apache.ignite.tx.IgniteTransactions;
+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.Param;
+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.infra.Blackhole;
+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 measures the time for sequential execution of different sets of statements and the time
+ * for executing the same set of statements, but running them as a script.
+ *
+ * <p>Include the following cases:
+ * <ol>
+ * <li>{@code INSERT} the same key into different tables.</li>
+ * <li>{@code SELECT COUNT(*)} from different tables.</li>
+ * <li>{@code SELECT} using single key from multiple tables.</li>
+ * <li>Multiple {@code SELECT} by key from one table.</li>
+ * </ol>
+ */
+@State(Scope.Benchmark)
+@Fork(1)
+@Threads(1)
+@Warmup(iterations = 10, time = 2)
+@Measurement(iterations = 20, time = 2)
+@BenchmarkMode(Mode.AverageTime)
+@OutputTimeUnit(TimeUnit.MILLISECONDS)
+public class SqlMultiStatementBenchmark extends AbstractMultiNodeBenchmark {
+ private static final int TABLE_SIZE = 10_000;
+
+ @Param({"1"})
+ private int clusterSize;
+
+ @Param({"1", "2", "4"})
+ private static int statementsCount;
+
+ /** Creates tables. */
+ @Setup
+ public void createTables() {
+ for (int i = 0; i < statementsCount; i++) {
+ createTable("T" + i);
+ }
+ }
+
+ /** Benchmark for sequential {@code INSERT}. */
+ @Benchmark
+ public void insert(InsertState state, Blackhole bh) {
+ state.executeQuery(bh);
+ }
+
+ /** Benchmark for script {@code INSERT}. */
+ @Benchmark
+ public void insertScript(InsertState state, Blackhole bh) {
+ state.executeScript(bh);
+ }
+
+ /** Benchmark for sequential {@code COUNT}. */
+ @Benchmark
+ public void count(CountState state, Blackhole bh) {
+ state.executeQuery(bh);
+ }
+
+ /** Benchmark for script {@code COUNT}. */
+ @Benchmark
+ public void countScript(CountState state, Blackhole bh) {
+ state.executeScript(bh);
+ }
+
+ /** Benchmark for sequential single key {@code SELECT}. */
+ @Benchmark
+ public void selectMultipleTables(SelectSingleKeyMultipleTablesState state, Blackhole bh) {
+ state.executeQuery(bh);
+ }
+
+ /** Benchmark for script single key {@code SELECT}. */
+ @Benchmark
+ public void selectMultipleTablesScript(SelectSingleKeyMultipleTablesState state, Blackhole bh) {
+ state.executeScript(bh);
+ }
+
+ /** Benchmark for sequential single table {@code SELECT}. */
+ @Benchmark
+ public void selectMultipleKeys(SelectMultipleKeysSingleTableState state, Blackhole bh) {
+ state.executeQuery(bh);
+ }
+
+ /** Benchmark for script single table {@code SELECT}. */
+ @Benchmark
+ public void selectMultipleKeysScript(SelectMultipleKeysSingleTableState state, Blackhole bh) {
+ state.executeScript(bh);
+ }
+
+ /**
+ * Benchmark state for {@link #insert(InsertState, Blackhole)} and
+ * {@link #insertScript(InsertState, Blackhole)} benchmarks.
+ */
+ @State(Scope.Benchmark)
+ public static class InsertState {
+ private ScriptRunner scriptExec;
+ private Parameters parameters;
+ private Session session;
+
+ /** Generates required statements.*/
+ @Setup
+ public void setUp() {
+ session = clusterNode.sql().createSession();
+ parameters = new Parameters(statementsCount, n -> createInsertStatement("T" + n));
+ scriptExec = new ScriptRunner(
+ clusterNode.queryEngine(),
+ clusterNode.transactions(),
+ session.defaultPageSize()
+ );
+ }
+
+ @TearDown
+ public void closeSession() throws Exception {
+ IgniteUtils.closeAll(session);
+ }
+
+ private int id = 0;
+
+ void executeQuery(Blackhole bh) {
+ int id0 = id++;
+
+ for (int i = 0; i < statementsCount; i++) {
+ try (ResultSet<?> rs = session.execute(null, parameters.statements.get(i), id0)) {
+ // NO-OP
Review Comment:
bh.consume(rs);
--
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-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-20662 Sql. Added a microbenchmark to measure script execution performance [ignite-3]
Posted by "xtern (via GitHub)" <gi...@apache.org>.
xtern commented on code in PR #2955:
URL: https://github.com/apache/ignite-3/pull/2955#discussion_r1427913480
##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/benchmark/SqlMultiStatementBenchmark.java:
##########
@@ -0,0 +1,484 @@
+/*
+ * 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.stream.Collectors.joining;
+import static org.apache.ignite.internal.lang.IgniteStringFormatter.format;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.concurrent.TimeUnit;
+import java.util.function.Function;
+import java.util.stream.IntStream;
+import org.apache.ignite.internal.lang.IgniteStringBuilder;
+import org.apache.ignite.internal.sql.engine.AsyncSqlCursor;
+import org.apache.ignite.internal.sql.engine.InternalSqlRow;
+import org.apache.ignite.internal.sql.engine.QueryProcessor;
+import org.apache.ignite.internal.sql.engine.property.SqlProperties;
+import org.apache.ignite.internal.sql.engine.property.SqlPropertiesHelper;
+import org.apache.ignite.internal.util.AsyncCursor.BatchedResult;
+import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.sql.ResultSet;
+import org.apache.ignite.sql.Session;
+import org.apache.ignite.table.Tuple;
+import org.apache.ignite.tx.IgniteTransactions;
+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.Param;
+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.infra.Blackhole;
+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 measures the time for sequential execution of different sets of statements and the time
+ * for executing the same set of statements, but running them as a script.
+ *
+ * <p>Include the following cases:
+ * <ol>
+ * <li>{@code INSERT} the same key into different tables.</li>
+ * <li>{@code SELECT COUNT(*)} from different tables.</li>
+ * <li>{@code SELECT} using single key from multiple tables.</li>
+ * <li>Multiple {@code SELECT} by key from one table.</li>
+ * </ol>
+ */
+@State(Scope.Benchmark)
+@Fork(1)
+@Threads(1)
+@Warmup(iterations = 10, time = 2)
+@Measurement(iterations = 20, time = 2)
+@BenchmarkMode(Mode.AverageTime)
+@OutputTimeUnit(TimeUnit.MILLISECONDS)
+public class SqlMultiStatementBenchmark extends AbstractMultiNodeBenchmark {
+ private static final int TABLE_SIZE = 10_000;
+
+ @Param({"1"})
+ private int clusterSize;
+
+ @Param({"1", "2", "4"})
+ private static int statementsCount;
+
+ /** Creates tables. */
+ @Setup
+ public void createTables() {
+ for (int i = 0; i < statementsCount; i++) {
+ createTable("T" + i);
+ }
+ }
+
+ /** Benchmark for sequential {@code INSERT}. */
+ @Benchmark
+ public void insert(InsertState state, Blackhole bh) {
+ state.executeQuery(bh);
+ }
+
+ /** Benchmark for script {@code INSERT}. */
+ @Benchmark
+ public void insertScript(InsertState state, Blackhole bh) {
+ state.executeScript(bh);
+ }
+
+ /** Benchmark for sequential {@code COUNT}. */
+ @Benchmark
+ public void count(CountState state, Blackhole bh) {
+ state.executeQuery(bh);
+ }
+
+ /** Benchmark for script {@code COUNT}. */
+ @Benchmark
+ public void countScript(CountState state, Blackhole bh) {
+ state.executeScript(bh);
+ }
+
+ /** Benchmark for sequential single key {@code SELECT}. */
+ @Benchmark
+ public void selectMultipleTables(SelectSingleKeyMultipleTablesState state, Blackhole bh) {
+ state.executeQuery(bh);
+ }
+
+ /** Benchmark for script single key {@code SELECT}. */
+ @Benchmark
+ public void selectMultipleTablesScript(SelectSingleKeyMultipleTablesState state, Blackhole bh) {
+ state.executeScript(bh);
+ }
+
+ /** Benchmark for sequential single table {@code SELECT}. */
+ @Benchmark
+ public void selectMultipleKeys(SelectMultipleKeysSingleTableState state, Blackhole bh) {
+ state.executeQuery(bh);
+ }
+
+ /** Benchmark for script single table {@code SELECT}. */
+ @Benchmark
+ public void selectMultipleKeysScript(SelectMultipleKeysSingleTableState state, Blackhole bh) {
+ state.executeScript(bh);
+ }
+
+ /**
+ * Benchmark state for {@link #insert(InsertState, Blackhole)} and
+ * {@link #insertScript(InsertState, Blackhole)} benchmarks.
+ */
+ @State(Scope.Benchmark)
+ public static class InsertState {
+ private ScriptRunner scriptExec;
+ private Parameters parameters;
+ private Session session;
+
+ /** Generates required statements.*/
+ @Setup
+ public void setUp() {
+ session = clusterNode.sql().createSession();
+ parameters = new Parameters(statementsCount, n -> createInsertStatement("T" + n));
+ scriptExec = new ScriptRunner(
+ clusterNode.queryEngine(),
+ clusterNode.transactions(),
+ session.defaultPageSize()
+ );
+ }
+
+ @TearDown
+ public void closeSession() throws Exception {
+ IgniteUtils.closeAll(session);
+ }
+
+ private int id = 0;
+
+ void executeQuery(Blackhole bh) {
+ int id0 = id++;
+
+ for (int i = 0; i < statementsCount; i++) {
+ try (ResultSet<?> rs = session.execute(null, parameters.statements.get(i), id0)) {
+ // NO-OP
Review Comment:
Done, thanks
##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/benchmark/SelectBenchmark.java:
##########
@@ -122,6 +138,19 @@ public void jdbcGet(JdbcState state) throws SQLException {
}
}
+ /**
+ * Benchmark for JDBC script get.
+ */
+ @Benchmark
+ public void jdbcGetScript(JdbcState state) throws SQLException {
+ state.stmt.setInt(1, random.nextInt(TABLE_SIZE));
+ state.stmt.execute();
+
+ try (ResultSet r = state.stmt.getResultSet()) {
+ r.next();
Review Comment:
Done, thanks
--
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-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-20662 Sql. Added a microbenchmark to measure script execution performance [ignite-3]
Posted by "xtern (via GitHub)" <gi...@apache.org>.
xtern commented on code in PR #2955:
URL: https://github.com/apache/ignite-3/pull/2955#discussion_r1432583585
##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/benchmark/SqlMultiStatementBenchmark.java:
##########
@@ -0,0 +1,484 @@
+/*
+ * 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.stream.Collectors.joining;
+import static org.apache.ignite.internal.lang.IgniteStringFormatter.format;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.concurrent.TimeUnit;
+import java.util.function.Function;
+import java.util.stream.IntStream;
+import org.apache.ignite.internal.lang.IgniteStringBuilder;
+import org.apache.ignite.internal.sql.engine.AsyncSqlCursor;
+import org.apache.ignite.internal.sql.engine.InternalSqlRow;
+import org.apache.ignite.internal.sql.engine.QueryProcessor;
+import org.apache.ignite.internal.sql.engine.property.SqlProperties;
+import org.apache.ignite.internal.sql.engine.property.SqlPropertiesHelper;
+import org.apache.ignite.internal.util.AsyncCursor.BatchedResult;
+import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.sql.ResultSet;
+import org.apache.ignite.sql.Session;
+import org.apache.ignite.table.Tuple;
+import org.apache.ignite.tx.IgniteTransactions;
+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.Param;
+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.infra.Blackhole;
+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 measures the time for sequential execution of different sets of statements and the time
Review Comment:
Agree, fixed. These benchmarks only use the internal API for now.
--
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-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-20662 Sql. Added a microbenchmark to measure script execution performance [ignite-3]
Posted by "korlov42 (via GitHub)" <gi...@apache.org>.
korlov42 commented on code in PR #2955:
URL: https://github.com/apache/ignite-3/pull/2955#discussion_r1432402358
##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/benchmark/SelectBenchmark.java:
##########
@@ -172,7 +204,40 @@ private org.apache.ignite.sql.ResultSet<SqlRow> sql(String sql, Object... args)
}
/**
- * Benchmark state for {@link #sqlThinGet(SqlThinState)}.
+ * Benchmark state for {@link #sqlGet(SqlState, Blackhole)}.
+ *
+ * <p>Holds {@link Session}.
+ */
+ @State(Scope.Benchmark)
+ public static class SqlScriptState {
Review Comment:
to make fair comparison, we need one more state: the one that uses internal API as well, but instead executes statements with `querySingleAsync`
##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/benchmark/SqlMultiStatementBenchmark.java:
##########
@@ -0,0 +1,484 @@
+/*
+ * 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.stream.Collectors.joining;
+import static org.apache.ignite.internal.lang.IgniteStringFormatter.format;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.concurrent.TimeUnit;
+import java.util.function.Function;
+import java.util.stream.IntStream;
+import org.apache.ignite.internal.lang.IgniteStringBuilder;
+import org.apache.ignite.internal.sql.engine.AsyncSqlCursor;
+import org.apache.ignite.internal.sql.engine.InternalSqlRow;
+import org.apache.ignite.internal.sql.engine.QueryProcessor;
+import org.apache.ignite.internal.sql.engine.property.SqlProperties;
+import org.apache.ignite.internal.sql.engine.property.SqlPropertiesHelper;
+import org.apache.ignite.internal.util.AsyncCursor.BatchedResult;
+import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.sql.ResultSet;
+import org.apache.ignite.sql.Session;
+import org.apache.ignite.table.Tuple;
+import org.apache.ignite.tx.IgniteTransactions;
+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.Param;
+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.infra.Blackhole;
+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 measures the time for sequential execution of different sets of statements and the time
Review Comment:
we need to compare different modes of the same API. If at the moment we can't run scripts with any API but internal, then we need to run benchmarks only using internal API. Later we will add the similar set of benchmarks for JDBC and java API
--
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-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-20662 Sql. Added a microbenchmark to measure script execution performance [ignite-3]
Posted by "xtern (via GitHub)" <gi...@apache.org>.
xtern merged PR #2955:
URL: https://github.com/apache/ignite-3/pull/2955
--
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-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-20662 Sql. Added a microbenchmark to measure script execution performance [ignite-3]
Posted by "zstan (via GitHub)" <gi...@apache.org>.
zstan commented on code in PR #2955:
URL: https://github.com/apache/ignite-3/pull/2955#discussion_r1427654486
##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/benchmark/SelectBenchmark.java:
##########
@@ -122,6 +138,19 @@ public void jdbcGet(JdbcState state) throws SQLException {
}
}
+ /**
+ * Benchmark for JDBC script get.
+ */
+ @Benchmark
+ public void jdbcGetScript(JdbcState state) throws SQLException {
+ state.stmt.setInt(1, random.nextInt(TABLE_SIZE));
+ state.stmt.execute();
+
+ try (ResultSet r = state.stmt.getResultSet()) {
+ r.next();
Review Comment:
lets add Blackhole here too ?
--
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-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-20662 Sql. Added a microbenchmark to measure script execution performance [ignite-3]
Posted by "xtern (via GitHub)" <gi...@apache.org>.
xtern commented on code in PR #2955:
URL: https://github.com/apache/ignite-3/pull/2955#discussion_r1432583585
##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/benchmark/SqlMultiStatementBenchmark.java:
##########
@@ -0,0 +1,484 @@
+/*
+ * 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.stream.Collectors.joining;
+import static org.apache.ignite.internal.lang.IgniteStringFormatter.format;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.concurrent.TimeUnit;
+import java.util.function.Function;
+import java.util.stream.IntStream;
+import org.apache.ignite.internal.lang.IgniteStringBuilder;
+import org.apache.ignite.internal.sql.engine.AsyncSqlCursor;
+import org.apache.ignite.internal.sql.engine.InternalSqlRow;
+import org.apache.ignite.internal.sql.engine.QueryProcessor;
+import org.apache.ignite.internal.sql.engine.property.SqlProperties;
+import org.apache.ignite.internal.sql.engine.property.SqlPropertiesHelper;
+import org.apache.ignite.internal.util.AsyncCursor.BatchedResult;
+import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.sql.ResultSet;
+import org.apache.ignite.sql.Session;
+import org.apache.ignite.table.Tuple;
+import org.apache.ignite.tx.IgniteTransactions;
+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.Param;
+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.infra.Blackhole;
+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 measures the time for sequential execution of different sets of statements and the time
Review Comment:
Agree, fixed. Benchmarks only use the internal API for now.
--
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-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-20662 Sql. Added a microbenchmark to measure script execution performance [ignite-3]
Posted by "xtern (via GitHub)" <gi...@apache.org>.
xtern commented on code in PR #2955:
URL: https://github.com/apache/ignite-3/pull/2955#discussion_r1432582448
##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/benchmark/SelectBenchmark.java:
##########
@@ -172,7 +204,40 @@ private org.apache.ignite.sql.ResultSet<SqlRow> sql(String sql, Object... args)
}
/**
- * Benchmark state for {@link #sqlThinGet(SqlThinState)}.
+ * Benchmark state for {@link #sqlGet(SqlState, Blackhole)}.
+ *
+ * <p>Holds {@link Session}.
+ */
+ @State(Scope.Benchmark)
+ public static class SqlScriptState {
Review Comment:
Thanks. Added a separate `sqlGetInternal` benchmark that uses the internal API.
--
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-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org