WIP on benchmark.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d23bdd9d Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d23bdd9d Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d23bdd9d Branch: refs/heads/ignite-6022-proto Commit: d23bdd9d8672273214ba407cdc5e67378984182f Parents: 5f888e3 Author: devozerov <[email protected]> Authored: Mon Dec 18 14:37:36 2017 +0300 Committer: devozerov <[email protected]> Committed: Mon Dec 18 14:37:36 2017 +0300 ---------------------------------------------------------------------- .../query/h2/opt/JdbcBenchmarkRunner.java | 104 ++++++++++--------- 1 file changed, 55 insertions(+), 49 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/d23bdd9d/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/JdbcBenchmarkRunner.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/JdbcBenchmarkRunner.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/JdbcBenchmarkRunner.java index a09cee4..18dc575 100644 --- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/JdbcBenchmarkRunner.java +++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/JdbcBenchmarkRunner.java @@ -20,7 +20,7 @@ public class JdbcBenchmarkRunner { private static final int THREAD_CNT = 1; - private static final int BATCH_SIZE = 10000; + private static final int BATCH_SIZE = 1000; private static final LongAdder OPS = new LongAdder(); @@ -31,6 +31,8 @@ public class JdbcBenchmarkRunner { IgniteConfiguration cfg = new IgniteConfiguration().setLocalHost("127.0.0.1"); + cfg.setClientConnectorConfiguration(null); + // DataStorageConfiguration dsCfg = new DataStorageConfiguration().setWalMode(WALMode.LOG_ONLY); // // dsCfg.getDefaultDataRegionConfiguration().setPersistenceEnabled(true); @@ -43,73 +45,77 @@ public class JdbcBenchmarkRunner { try (Ignite node = Ignition.start(cfg)) { node.active(true); - try (Connection conn = connect()) { - execute(conn, "CREATE TABLE tbl (id BIGINT PRIMARY KEY, v1 BIGINT, v2 BIGINT, v3 BIGINT, v4 BIGINT)"); - } + IgniteConfiguration cliCfg = new IgniteConfiguration().setLocalHost("127.0.0.1").setIgniteInstanceName("cli").setClientMode(true); - new Thread(new Runnable() { - @Override public void run() { - while (!done) { - long startTime = System.currentTimeMillis(); - long startOps = OPS.longValue(); + try (Ignite cli = Ignition.start(cliCfg)) { + try (Connection conn = connect()) { + execute(conn, "CREATE TABLE tbl (id BIGINT PRIMARY KEY, v1 BIGINT, v2 BIGINT, v3 BIGINT, v4 BIGINT)"); + } - try { - Thread.sleep(3000L); - } - catch (InterruptedException e) { - break; - } + new Thread(new Runnable() { + @Override public void run() { + while (!done) { + long startTime = System.currentTimeMillis(); + long startOps = OPS.longValue(); + + try { + Thread.sleep(3000L); + } + catch (InterruptedException e) { + break; + } - long endTime = System.currentTimeMillis(); - long endOps = OPS.longValue(); + long endTime = System.currentTimeMillis(); + long endOps = OPS.longValue(); - double t = 1000 * (double)(endOps - startOps) / (double)(endTime - startTime); + double t = 1000 * (double)(endOps - startOps) / (double)(endTime - startTime); - if (!done) - System.out.println("Throughput: " + String.format("%1$,.2f", t) + " ops/sec"); + if (!done) + System.out.println("Throughput: " + String.format("%1$,.2f", t) + " ops/sec"); + } } - } - }).start(); + }).start(); - JdbcRequestHandler.STREAMER = true; + JdbcRequestHandler.STREAMER = true; - long start = System.currentTimeMillis(); + long start = System.currentTimeMillis(); - CyclicBarrier startBarrier = new CyclicBarrier(THREAD_CNT); - CountDownLatch stopLatch = new CountDownLatch(THREAD_CNT); + CyclicBarrier startBarrier = new CyclicBarrier(THREAD_CNT); + CountDownLatch stopLatch = new CountDownLatch(THREAD_CNT); - for (int i = 0; i < THREAD_CNT; i++) { - final int i0 = i; + for (int i = 0; i < THREAD_CNT; i++) { + final int i0 = i; - new Thread(new Runnable() { - @SuppressWarnings("InfiniteLoopStatement") - @Override public void run() { - try (Connection conn = connect()) { - startBarrier.await(); + new Thread(new Runnable() { + @SuppressWarnings("InfiniteLoopStatement") + @Override public void run() { + try (Connection conn = connect()) { + startBarrier.await(); - doUpdate(conn, i0); + doUpdate(conn, i0); - execute(conn, "FLUSH"); - } - catch (Exception e) { - System.out.println("ERROR: " + e); - } - finally { - stopLatch.countDown(); + execute(conn, "FLUSH"); + } + catch (Exception e) { + System.out.println("ERROR: " + e); + } + finally { + stopLatch.countDown(); + } } - } - }).start(); - } + }).start(); + } - stopLatch.await(); + stopLatch.await(); - done = true; + done = true; - long end = System.currentTimeMillis(); + long end = System.currentTimeMillis(); - float dur = (float)((double)(end - start) / 1000); + float dur = (float)((double)(end - start) / 1000); - System.out.println("TOTAL DURATION: " + dur); + System.out.println("TOTAL DURATION: " + dur); + } } }
