You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by pp...@apache.org on 2025/11/07 13:55:12 UTC
(ignite-3) 01/01: IGNITE-26149 Benchmark added.
This is an automated email from the ASF dual-hosted git repository.
ppa pushed a commit to branch ignite-26149
in repository https://gitbox.apache.org/repos/asf/ignite-3.git
commit 0e01e2d37d12762897e10441beb9e008479de098
Author: Pavel Pereslegin <xx...@gmail.com>
AuthorDate: Fri Nov 7 16:54:55 2025 +0300
IGNITE-26149 Benchmark added.
---
.../internal/benchmark/BulkLoadBenchmark.java | 60 ++++++++++++++++++++++
1 file changed, 60 insertions(+)
diff --git a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/benchmark/BulkLoadBenchmark.java b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/benchmark/BulkLoadBenchmark.java
index a254a58c596..539d374c931 100644
--- a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/benchmark/BulkLoadBenchmark.java
+++ b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/benchmark/BulkLoadBenchmark.java
@@ -21,6 +21,10 @@ import static java.util.stream.Collectors.joining;
import static org.apache.ignite.internal.lang.IgniteStringFormatter.format;
import static org.apache.ignite.internal.util.IgniteUtils.closeAll;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.stream.IntStream;
@@ -72,6 +76,14 @@ public class BulkLoadBenchmark extends AbstractMultiNodeBenchmark {
@Param("5")
private int batchSize;
+ /**
+ * Benchmark for SQL insert via JDBC client.
+ */
+ @Benchmark
+ public void jdbcInsert(JdbcState state) throws SQLException {
+ state.upload(count, batchSize);
+ }
+
/**
* Benchmark for SQL insert via thin client.
*/
@@ -120,6 +132,54 @@ public class BulkLoadBenchmark extends AbstractMultiNodeBenchmark {
new Runner(opt).run();
}
+ /**
+ * Benchmark state for {@link #jdbcInsert(JdbcState)}.
+ *
+ * <p>Holds {@link Connection} and {@link PreparedStatement}.
+ */
+ @State(Scope.Benchmark)
+ public static class JdbcState {
+ private Connection connection;
+ private PreparedStatement statement;
+
+ /**
+ * Initializes session and statement.
+ */
+ @Setup
+ public void setUp() throws SQLException {
+ String queryStr = createInsertStatement();
+
+ String clientAddrs = String.join(",", getServerEndpoints(clusterSize));
+
+ String jdbcUrl = "jdbc:ignite:thin://" + clientAddrs;
+
+ connection = DriverManager.getConnection(jdbcUrl);
+
+ connection.setAutoCommit(false);
+
+ statement = connection.prepareStatement(queryStr);
+ }
+
+ /**
+ * Closes resources.
+ */
+ @TearDown
+ public void tearDown() throws Exception {
+ connection.close();
+ }
+
+ void upload(int count, int batch) throws SQLException {
+ for (int i = 0; i < count; i++) {
+ if (i % batch == 0) {
+ connection.commit();
+ }
+
+ statement.setInt(1, i);
+ statement.executeUpdate();
+ }
+ }
+ }
+
/**
* Benchmark state for {@link #sqlThinInsert(SqlThinState)}.
*