You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ak...@apache.org on 2018/02/09 13:02:51 UTC
[36/50] [abbrv] ignite git commit: IGNITE-6217: Added benchmark to
compare JDBC vs native SQL
IGNITE-6217: Added benchmark to compare JDBC vs native SQL
This closes #2558
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/63f6b1f4
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/63f6b1f4
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/63f6b1f4
Branch: refs/heads/ignite-7485-2
Commit: 63f6b1f4a251919bec4a4528afef964720323089
Parents: 25d38cc
Author: Pavel Kuznetsov <pa...@gmail.com>
Authored: Wed Feb 7 15:37:52 2018 +0300
Committer: Igor Sapego <is...@gridgain.com>
Committed: Wed Feb 7 15:40:58 2018 +0300
----------------------------------------------------------------------
...benchmark-jdbc-thin-insert-delete.properties | 87 ++++++++++
.../benchmark-jdbc-thin-select.properties | 86 ++++++++++
.../benchmark-jdbc-thin-update.properties | 86 ++++++++++
.../benchmark-jdbcv2-insert-delete.properties | 87 ++++++++++
.../config/benchmark-jdbcv2-select.properties | 86 ++++++++++
.../config/benchmark-jdbcv2-update.properties | 88 +++++++++++
...enchmark-native-sql-insert-delete.properties | 87 ++++++++++
.../benchmark-native-sql-select.properties | 86 ++++++++++
.../benchmark-native-sql-update.properties | 86 ++++++++++
modules/yardstick/config/ignite-jdbc-config.xml | 4 +-
.../yardstick/IgniteBenchmarkArguments.java | 26 ++-
.../org/apache/ignite/yardstick/IgniteNode.java | 12 +-
.../yardstick/jdbc/AbstractJdbcBenchmark.java | 158 +++++++++++++++++++
.../yardstick/jdbc/AbstractNativeBenchmark.java | 37 +++++
.../yardstick/jdbc/DisjointRangeGenerator.java | 101 ++++++++++++
.../jdbc/JdbcSqlInsertDeleteBenchmark.java | 66 ++++++++
.../jdbc/JdbcSqlQueryRangeBenchmark.java | 78 +++++++++
.../yardstick/jdbc/JdbcSqlUpdateBenchmark.java | 81 ++++++++++
.../apache/ignite/yardstick/jdbc/JdbcUtils.java | 55 +++++++
.../jdbc/NativeSqlInsertDeleteBenchmark.java | 61 +++++++
.../jdbc/NativeSqlQueryRangeBenchmark.java | 77 +++++++++
.../jdbc/NativeSqlUpdateRangeBenchmark.java | 83 ++++++++++
22 files changed, 1612 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/63f6b1f4/modules/yardstick/config/benchmark-jdbc-thin-insert-delete.properties
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/benchmark-jdbc-thin-insert-delete.properties b/modules/yardstick/config/benchmark-jdbc-thin-insert-delete.properties
new file mode 100644
index 0000000..ed072ed
--- /dev/null
+++ b/modules/yardstick/config/benchmark-jdbc-thin-insert-delete.properties
@@ -0,0 +1,87 @@
+#
+# 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.
+#
+
+#
+# Thin JDBC driver benchmarks for insert+delete queries
+#
+
+now0=`date +'%H%M%S'`
+
+# JVM options.
+JVM_OPTS=${JVM_OPTS}" -DIGNITE_QUIET=false"
+
+# Uncomment to enable concurrent garbage collection (GC) if you encounter long GC pauses.
+JVM_OPTS=${JVM_OPTS}" \
+-Xms8g \
+-Xmx8g \
+-Xloggc:./gc${now0}.log \
+-XX:+PrintGCDetails \
+-verbose:gc \
+-XX:+UseParNewGC \
+-XX:+UseConcMarkSweepGC \
+-XX:+PrintGCDateStamps \
+"
+
+#Ignite version
+ver="RELEASE-"
+
+# List of default probes.
+# Add DStatProbe or VmStatProbe if your OS supports it (e.g. if running on Linux).
+BENCHMARK_DEFAULT_PROBES=ThroughputLatencyProbe,PercentileProbe,DStatProbe
+
+# Packages where the specified benchmark is searched by reflection mechanism.
+BENCHMARK_PACKAGES=org.yardstickframework,org.apache.ignite.yardstick
+
+# Flag which indicates to restart the servers before every benchmark execution.
+RESTART_SERVERS=true
+
+# Probe point writer class name.
+# BENCHMARK_WRITER=
+
+# The benchmark is applicable only for 2 servers (the second server is started in client mode) and 1 driver.
+SERVER_HOSTS=localhost,localhost
+DRIVER_HOSTS=localhost
+
+# Remote username.
+# REMOTE_USER=
+
+# Number of nodes, used to wait for the specified number of nodes to start.
+nodesNum=$((`echo ${SERVER_HOSTS} | tr ',' '\n' | wc -l` + `echo ${DRIVER_HOSTS} | tr ',' '\n' | wc -l`))
+
+# Backups count.
+b=1
+
+# Warmup.
+w=30
+
+# Duration.
+d=300
+
+# Threads count.
+t=4
+
+# Sync mode.
+sm=PRIMARY_SYNC
+
+# Jobs.
+j=10
+
+# Run configuration which contains all benchmarks.
+# Note that each benchmark is set to run for 300 seconds (5 min) with warm-up set to 60 seconds (1 minute).
+CONFIGS="\
+-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -jdbc jdbc:ignite:thin://auto.find/ -t ${t} -sm ${sm} -dn JdbcSqlInsertDeleteBenchmark -sn IgniteNode -ds ${ver}sql-insert-delete-jdbc-thin-r1-${b}-backup --sqlRange 1 -cl --clientNodesAfterId 0,\
+"
http://git-wip-us.apache.org/repos/asf/ignite/blob/63f6b1f4/modules/yardstick/config/benchmark-jdbc-thin-select.properties
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/benchmark-jdbc-thin-select.properties b/modules/yardstick/config/benchmark-jdbc-thin-select.properties
new file mode 100644
index 0000000..de84154
--- /dev/null
+++ b/modules/yardstick/config/benchmark-jdbc-thin-select.properties
@@ -0,0 +1,86 @@
+# 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.
+
+#
+# Thin JDBC driver benchmarks for select queries
+#
+
+now0=`date +'%H%M%S'`
+
+# JVM options.
+JVM_OPTS=${JVM_OPTS}" -DIGNITE_QUIET=false"
+
+# Uncomment to enable concurrent garbage collection (GC) if you encounter long GC pauses.
+JVM_OPTS=${JVM_OPTS}" \
+-Xms8g \
+-Xmx8g \
+-Xloggc:./gc${now0}.log \
+-XX:+PrintGCDetails \
+-verbose:gc \
+-XX:+UseParNewGC \
+-XX:+UseConcMarkSweepGC \
+-XX:+PrintGCDateStamps \
+"
+
+#Ignite version
+ver="RELEASE-"
+
+# List of default probes.
+# Add DStatProbe or VmStatProbe if your OS supports it (e.g. if running on Linux).
+BENCHMARK_DEFAULT_PROBES=ThroughputLatencyProbe,PercentileProbe,DStatProbe
+
+# Packages where the specified benchmark is searched by reflection mechanism.
+BENCHMARK_PACKAGES=org.yardstickframework,org.apache.ignite.yardstick
+
+# Flag which indicates to restart the servers before every benchmark execution.
+RESTART_SERVERS=true
+
+# Probe point writer class name.
+# BENCHMARK_WRITER=
+
+# The benchmark is applicable only for 2 servers (the second server is started in client mode) and 1 driver.
+SERVER_HOSTS=localhost,localhost
+DRIVER_HOSTS=localhost
+
+# Remote username.
+# REMOTE_USER=
+
+# Number of nodes, used to wait for the specified number of nodes to start.
+nodesNum=$((`echo ${SERVER_HOSTS} | tr ',' '\n' | wc -l` + `echo ${DRIVER_HOSTS} | tr ',' '\n' | wc -l`))
+
+# Backups count.
+b=1
+
+# Warmup.
+w=30
+
+# Duration.
+d=300
+
+# Threads count.
+t=4
+
+# Sync mode.
+sm=PRIMARY_SYNC
+
+# Jobs.
+j=10
+
+# Run configuration which contains all benchmarks.
+# Note that each benchmark is set to run for 300 seconds (5 min) with warm-up set to 60 seconds (1 minute).
+CONFIGS="\
+-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -jdbc jdbc:ignite:thin://auto.find/ -t ${t} -sm ${sm} -dn JdbcSqlQueryRangeBenchmark -sn IgniteNode -ds ${ver}sql-select-jdbc-thin-r1-${b}-backup --sqlRange 1 -cl --clientNodesAfterId 0,\
+-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -jdbc jdbc:ignite:thin://auto-find/ -t ${t} -sm ${sm} -dn JdbcSqlQueryRangeBenchmark -sn IgniteNode -ds ${ver}sql-select-jdbc-thin-r1000-${b}-backup --sqlRange 1000 -cl --clientNodesAfterId 0,\
+"
http://git-wip-us.apache.org/repos/asf/ignite/blob/63f6b1f4/modules/yardstick/config/benchmark-jdbc-thin-update.properties
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/benchmark-jdbc-thin-update.properties b/modules/yardstick/config/benchmark-jdbc-thin-update.properties
new file mode 100644
index 0000000..99c45d1
--- /dev/null
+++ b/modules/yardstick/config/benchmark-jdbc-thin-update.properties
@@ -0,0 +1,86 @@
+# 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.
+
+#
+# Thin JDBC driver benchmarks for update queries
+#
+
+now0=`date +'%H%M%S'`
+
+# JVM options.
+JVM_OPTS=${JVM_OPTS}" -DIGNITE_QUIET=false"
+
+# Uncomment to enable concurrent garbage collection (GC) if you encounter long GC pauses.
+JVM_OPTS=${JVM_OPTS}" \
+-Xms8g \
+-Xmx8g \
+-Xloggc:./gc${now0}.log \
+-XX:+PrintGCDetails \
+-verbose:gc \
+-XX:+UseParNewGC \
+-XX:+UseConcMarkSweepGC \
+-XX:+PrintGCDateStamps \
+"
+
+#Ignite version
+ver="RELEASE-"
+
+# List of default probes.
+# Add DStatProbe or VmStatProbe if your OS supports it (e.g. if running on Linux).
+BENCHMARK_DEFAULT_PROBES=ThroughputLatencyProbe,PercentileProbe,DStatProbe
+
+# Packages where the specified benchmark is searched by reflection mechanism.
+BENCHMARK_PACKAGES=org.yardstickframework,org.apache.ignite.yardstick
+
+# Flag which indicates to restart the servers before every benchmark execution.
+RESTART_SERVERS=true
+
+# Probe point writer class name.
+# BENCHMARK_WRITER=
+
+# The benchmark is applicable only for 2 servers (the second server is started in client mode) and 1 driver.
+SERVER_HOSTS=localhost,localhost
+DRIVER_HOSTS=localhost
+
+# Remote username.
+# REMOTE_USER=
+
+# Number of nodes, used to wait for the specified number of nodes to start.
+nodesNum=$((`echo ${SERVER_HOSTS} | tr ',' '\n' | wc -l` + `echo ${DRIVER_HOSTS} | tr ',' '\n' | wc -l`))
+
+# Backups count.
+b=1
+
+# Warmup.
+w=30
+
+# Duration.
+d=300
+
+# Threads count.
+t=4
+
+# Sync mode.
+sm=PRIMARY_SYNC
+
+# Jobs.
+j=10
+
+# Run configuration which contains all benchmarks.
+# Note that each benchmark is set to run for 300 seconds (5 min) with warm-up set to 60 seconds (1 minute).
+CONFIGS="\
+-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -jdbc jdbc:ignite:thin://auto.find/ -t ${t} -sm ${sm} -dn JdbcSqlUpdateBenchmark -sn IgniteNode -ds ${ver}sql-update-jdbc-thin-r1-${b}-backup --sqlRange 1 -cl --clientNodesAfterId 0,\
+-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -jdbc jdbc:ignite:thin://auto-find/ -t ${t} -sm ${sm} -dn JdbcSqlUpdateBenchmark -sn IgniteNode -ds ${ver}sql-update-jdbc-thin-r1000-${b}-backup --sqlRange 1000 -cl --clientNodesAfterId 0,\
+"
http://git-wip-us.apache.org/repos/asf/ignite/blob/63f6b1f4/modules/yardstick/config/benchmark-jdbcv2-insert-delete.properties
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/benchmark-jdbcv2-insert-delete.properties b/modules/yardstick/config/benchmark-jdbcv2-insert-delete.properties
new file mode 100644
index 0000000..25a6310
--- /dev/null
+++ b/modules/yardstick/config/benchmark-jdbcv2-insert-delete.properties
@@ -0,0 +1,87 @@
+#
+# 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.
+#
+
+#
+# JDBC v2 driver benchmarks for insert + delete queries
+#
+
+now0=`date +'%H%M%S'`
+
+# JVM options.
+JVM_OPTS=${JVM_OPTS}" -DIGNITE_QUIET=false"
+
+# Uncomment to enable concurrent garbage collection (GC) if you encounter long GC pauses.
+JVM_OPTS=${JVM_OPTS}" \
+-Xms8g \
+-Xmx8g \
+-Xloggc:./gc${now0}.log \
+-XX:+PrintGCDetails \
+-verbose:gc \
+-XX:+UseParNewGC \
+-XX:+UseConcMarkSweepGC \
+-XX:+PrintGCDateStamps \
+"
+
+#Ignite version
+ver="RELEASE-"
+
+# List of default probes.
+# Add DStatProbe or VmStatProbe if your OS supports it (e.g. if running on Linux).
+BENCHMARK_DEFAULT_PROBES=ThroughputLatencyProbe,PercentileProbe,DStatProbe
+
+# Packages where the specified benchmark is searched by reflection mechanism.
+BENCHMARK_PACKAGES=org.yardstickframework,org.apache.ignite.yardstick
+
+# Flag which indicates to restart the servers before every benchmark execution.
+RESTART_SERVERS=true
+
+# Probe point writer class name.
+# BENCHMARK_WRITER=
+
+# The benchmark is applicable only for 1 server and 1 driver
+SERVER_HOSTS=127.0.0.1
+DRIVER_HOSTS=127.0.0.1
+
+# Remote username.
+# REMOTE_USER=
+
+# Number of nodes, used to wait for the specified number of nodes to start.
+nodesNum=$((`echo ${SERVER_HOSTS} | tr ',' '\n' | wc -l` + `echo ${DRIVER_HOSTS} | tr ',' '\n' | wc -l`))
+
+# Backups count.
+b=1
+
+# Warmup.
+w=30
+
+# Duration.
+d=300
+
+# Threads count.
+t=4
+
+# Sync mode.
+sm=PRIMARY_SYNC
+
+# Jobs.
+j=10
+
+# Run configuration which contains all benchmarks.
+# Note that each benchmark is set to run for 300 seconds (5 min) with warm-up set to 60 seconds (1 minute).
+CONFIGS="\
+-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -jdbc jdbc:ignite:cfg://cache=query@config/ignite-jdbc-config.xml -t ${t} -sm ${sm} -dn JdbcSqlInsertDeleteBenchmark -sn IgniteNode -ds ${ver}sql-insert-delete-jdbc2-r1-${b}-backup --sqlRange 1 -cl,\
+"
http://git-wip-us.apache.org/repos/asf/ignite/blob/63f6b1f4/modules/yardstick/config/benchmark-jdbcv2-select.properties
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/benchmark-jdbcv2-select.properties b/modules/yardstick/config/benchmark-jdbcv2-select.properties
new file mode 100644
index 0000000..a34aa17
--- /dev/null
+++ b/modules/yardstick/config/benchmark-jdbcv2-select.properties
@@ -0,0 +1,86 @@
+# 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.
+
+#
+# JDBC v2 driver benchmarks for select queries
+#
+
+now0=`date +'%H%M%S'`
+
+# JVM options.
+JVM_OPTS=${JVM_OPTS}" -DIGNITE_QUIET=false"
+
+# Uncomment to enable concurrent garbage collection (GC) if you encounter long GC pauses.
+JVM_OPTS=${JVM_OPTS}" \
+-Xms8g \
+-Xmx8g \
+-Xloggc:./gc${now0}.log \
+-XX:+PrintGCDetails \
+-verbose:gc \
+-XX:+UseParNewGC \
+-XX:+UseConcMarkSweepGC \
+-XX:+PrintGCDateStamps \
+"
+
+#Ignite version
+ver="RELEASE-"
+
+# List of default probes.
+# Add DStatProbe or VmStatProbe if your OS supports it (e.g. if running on Linux).
+BENCHMARK_DEFAULT_PROBES=ThroughputLatencyProbe,PercentileProbe,DStatProbe
+
+# Packages where the specified benchmark is searched by reflection mechanism.
+BENCHMARK_PACKAGES=org.yardstickframework,org.apache.ignite.yardstick
+
+# Flag which indicates to restart the servers before every benchmark execution.
+RESTART_SERVERS=true
+
+# Probe point writer class name.
+# BENCHMARK_WRITER=
+
+# The benchmark is applicable only for 1 server and 1 driver
+SERVER_HOSTS=127.0.0.1
+DRIVER_HOSTS=127.0.0.1
+
+# Remote username.
+# REMOTE_USER=
+
+# Number of nodes, used to wait for the specified number of nodes to start.
+nodesNum=$((`echo ${SERVER_HOSTS} | tr ',' '\n' | wc -l` + `echo ${DRIVER_HOSTS} | tr ',' '\n' | wc -l`))
+
+# Backups count.
+b=1
+
+# Warmup.
+w=30
+
+# Duration.
+d=300
+
+# Threads count.
+t=4
+
+# Sync mode.
+sm=PRIMARY_SYNC
+
+# Jobs.
+j=10
+
+# Run configuration which contains all benchmarks.
+# Note that each benchmark is set to run for 300 seconds (5 min) with warm-up set to 60 seconds (1 minute).
+CONFIGS="\
+-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -jdbc jdbc:ignite:cfg://cache=query@config/ignite-jdbc-config.xml -t ${t} -sm ${sm} -dn JdbcSqlQueryRangeBenchmark -sn IgniteNode -ds ${ver}sql-select-jdbc2-r1-${b}-backup --sqlRange 1 -cl,\
+-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -jdbc jdbc:ignite:cfg://cache=query@config/ignite-jdbc-config.xml -t ${t} -sm ${sm} -dn JdbcSqlQueryRangeBenchmark -sn IgniteNode -ds ${ver}sql-select-jdbc2-r1000-${b}-backup --sqlRange 1000 -cl,\
+"
http://git-wip-us.apache.org/repos/asf/ignite/blob/63f6b1f4/modules/yardstick/config/benchmark-jdbcv2-update.properties
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/benchmark-jdbcv2-update.properties b/modules/yardstick/config/benchmark-jdbcv2-update.properties
new file mode 100644
index 0000000..82b681a
--- /dev/null
+++ b/modules/yardstick/config/benchmark-jdbcv2-update.properties
@@ -0,0 +1,88 @@
+#
+# 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.
+#
+
+#
+# JDBC v2 driver benchmarks for update queries
+#
+
+now0=`date +'%H%M%S'`
+
+# JVM options.
+JVM_OPTS=${JVM_OPTS}" -DIGNITE_QUIET=false"
+
+# Uncomment to enable concurrent garbage collection (GC) if you encounter long GC pauses.
+JVM_OPTS=${JVM_OPTS}" \
+-Xms8g \
+-Xmx8g \
+-Xloggc:./gc${now0}.log \
+-XX:+PrintGCDetails \
+-verbose:gc \
+-XX:+UseParNewGC \
+-XX:+UseConcMarkSweepGC \
+-XX:+PrintGCDateStamps \
+"
+
+#Ignite version
+ver="RELEASE-"
+
+# List of default probes.
+# Add DStatProbe or VmStatProbe if your OS supports it (e.g. if running on Linux).
+BENCHMARK_DEFAULT_PROBES=ThroughputLatencyProbe,PercentileProbe,DStatProbe
+
+# Packages where the specified benchmark is searched by reflection mechanism.
+BENCHMARK_PACKAGES=org.yardstickframework,org.apache.ignite.yardstick
+
+# Flag which indicates to restart the servers before every benchmark execution.
+RESTART_SERVERS=true
+
+# Probe point writer class name.
+# BENCHMARK_WRITER=
+
+# The benchmark is applicable only for 1 server and 1 driver
+SERVER_HOSTS=127.0.0.1
+DRIVER_HOSTS=127.0.0.1
+
+# Remote username.
+# REMOTE_USER=
+
+# Number of nodes, used to wait for the specified number of nodes to start.
+nodesNum=$((`echo ${SERVER_HOSTS} | tr ',' '\n' | wc -l` + `echo ${DRIVER_HOSTS} | tr ',' '\n' | wc -l`))
+
+# Backups count.
+b=1
+
+# Warmup.
+w=30
+
+# Duration.
+d=300
+
+# Threads count.
+t=4
+
+# Sync mode.
+sm=PRIMARY_SYNC
+
+# Jobs.
+j=10
+
+# Run configuration which contains all benchmarks.
+# Note that each benchmark is set to run for 300 seconds (5 min) with warm-up set to 60 seconds (1 minute).
+CONFIGS="\
+-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -jdbc jdbc:ignite:cfg://cache=query@config/ignite-jdbc-config.xml -t ${t} -sm ${sm} -dn JdbcSqlUpdateBenchmark -sn IgniteNode -ds ${ver}sql-update-jdbc2-r1-${b}-backup --sqlRange 1 -cl,\
+-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -jdbc jdbc:ignite:cfg://cache=query@config/ignite-jdbc-config.xml -t ${t} -sm ${sm} -dn JdbcSqlUpdateBenchmark -sn IgniteNode -ds ${ver}sql-update-jdbc2-r1000-${b}-backup --sqlRange 1000 -cl,\
+"
http://git-wip-us.apache.org/repos/asf/ignite/blob/63f6b1f4/modules/yardstick/config/benchmark-native-sql-insert-delete.properties
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/benchmark-native-sql-insert-delete.properties b/modules/yardstick/config/benchmark-native-sql-insert-delete.properties
new file mode 100644
index 0000000..abb9732
--- /dev/null
+++ b/modules/yardstick/config/benchmark-native-sql-insert-delete.properties
@@ -0,0 +1,87 @@
+#
+# 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.
+#
+
+#
+# Contains benchmarks for insert+delete queries
+#
+
+now0=`date +'%H%M%S'`
+
+# JVM options.
+JVM_OPTS=${JVM_OPTS}" -DIGNITE_QUIET=false"
+
+# Uncomment to enable concurrent garbage collection (GC) if you encounter long GC pauses.
+JVM_OPTS=${JVM_OPTS}" \
+-Xms8g \
+-Xmx8g \
+-Xloggc:./gc${now0}.log \
+-XX:+PrintGCDetails \
+-verbose:gc \
+-XX:+UseParNewGC \
+-XX:+UseConcMarkSweepGC \
+-XX:+PrintGCDateStamps \
+"
+
+#Ignite version
+ver="RELEASE-"
+
+# List of default probes.
+# Add DStatProbe or VmStatProbe if your OS supports it (e.g. if running on Linux).
+BENCHMARK_DEFAULT_PROBES=ThroughputLatencyProbe,PercentileProbe,DStatProbe
+
+# Packages where the specified benchmark is searched by reflection mechanism.
+BENCHMARK_PACKAGES=org.yardstickframework,org.apache.ignite.yardstick
+
+# Flag which indicates to restart the servers before every benchmark execution.
+RESTART_SERVERS=true
+
+# Probe point writer class name.
+# BENCHMARK_WRITER=
+
+# The benchmark is applicable only for 1 server and 1 driver
+SERVER_HOSTS=127.0.0.1
+DRIVER_HOSTS=127.0.0.1
+
+# Remote username.
+# REMOTE_USER=
+
+# Number of nodes, used to wait for the specified number of nodes to start.
+nodesNum=$((`echo ${SERVER_HOSTS} | tr ',' '\n' | wc -l` + `echo ${DRIVER_HOSTS} | tr ',' '\n' | wc -l`))
+
+# Backups count.
+b=1
+
+# Warmup.
+w=30
+
+# Duration.
+d=300
+
+# Threads count.
+t=4
+
+# Sync mode.
+sm=PRIMARY_SYNC
+
+# Jobs.
+j=10
+
+# Run configuration which contains all benchmarks.
+# Note that each benchmark is set to run for 300 seconds (5 min) with warm-up set to 60 seconds (1 minute).
+CONFIGS="\
+-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} --sqlRange 1 -dn NativeSqlInsertDeleteBenchmark -sn IgniteNode -ds ${ver}sql-insert-delete-native-r1-${b}-backup -cl,\
+"
http://git-wip-us.apache.org/repos/asf/ignite/blob/63f6b1f4/modules/yardstick/config/benchmark-native-sql-select.properties
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/benchmark-native-sql-select.properties b/modules/yardstick/config/benchmark-native-sql-select.properties
new file mode 100644
index 0000000..0f0b606
--- /dev/null
+++ b/modules/yardstick/config/benchmark-native-sql-select.properties
@@ -0,0 +1,86 @@
+# 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.
+
+#
+# Contains benchmarks for select queries
+#
+
+now0=`date +'%H%M%S'`
+
+# JVM options.
+JVM_OPTS=${JVM_OPTS}" -DIGNITE_QUIET=false"
+
+# Uncomment to enable concurrent garbage collection (GC) if you encounter long GC pauses.
+JVM_OPTS=${JVM_OPTS}" \
+-Xms8g \
+-Xmx8g \
+-Xloggc:./gc${now0}.log \
+-XX:+PrintGCDetails \
+-verbose:gc \
+-XX:+UseParNewGC \
+-XX:+UseConcMarkSweepGC \
+-XX:+PrintGCDateStamps \
+"
+
+#Ignite version
+ver="RELEASE-"
+
+# List of default probes.
+# Add DStatProbe or VmStatProbe if your OS supports it (e.g. if running on Linux).
+BENCHMARK_DEFAULT_PROBES=ThroughputLatencyProbe,PercentileProbe,DStatProbe
+
+# Packages where the specified benchmark is searched by reflection mechanism.
+BENCHMARK_PACKAGES=org.yardstickframework,org.apache.ignite.yardstick
+
+# Flag which indicates to restart the servers before every benchmark execution.
+RESTART_SERVERS=true
+
+# Probe point writer class name.
+# BENCHMARK_WRITER=
+
+# The benchmark is applicable only for 1 server and 1 driver
+SERVER_HOSTS=127.0.0.1
+DRIVER_HOSTS=127.0.0.1
+
+# Remote username.
+# REMOTE_USER=
+
+# Number of nodes, used to wait for the specified number of nodes to start.
+nodesNum=$((`echo ${SERVER_HOSTS} | tr ',' '\n' | wc -l` + `echo ${DRIVER_HOSTS} | tr ',' '\n' | wc -l`))
+
+# Backups count.
+b=1
+
+# Warmup.
+w=30
+
+# Duration.
+d=300
+
+# Threads count.
+t=4
+
+# Sync mode.
+sm=PRIMARY_SYNC
+
+# Jobs.
+j=10
+
+# Run configuration which contains all benchmarks.
+# Note that each benchmark is set to run for 300 seconds (5 min) with warm-up set to 60 seconds (1 minute).
+CONFIGS="\
+-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} --sqlRange 1 -dn NativeSqlQueryRangeBenchmark -sn IgniteNode -ds ${ver}sql-select-native-r1-${b}-backup -cl,\
+-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} --sqlRange 1000 -dn NativeSqlQueryRangeBenchmark -sn IgniteNode -ds ${ver}sql-select-native-r1000-${b}-backup -cl,\
+"
http://git-wip-us.apache.org/repos/asf/ignite/blob/63f6b1f4/modules/yardstick/config/benchmark-native-sql-update.properties
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/benchmark-native-sql-update.properties b/modules/yardstick/config/benchmark-native-sql-update.properties
new file mode 100644
index 0000000..9d04d40
--- /dev/null
+++ b/modules/yardstick/config/benchmark-native-sql-update.properties
@@ -0,0 +1,86 @@
+# 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.
+
+#
+# Contains benchmarks for update queries
+#
+
+now0=`date +'%H%M%S'`
+
+# JVM options.
+JVM_OPTS=${JVM_OPTS}" -DIGNITE_QUIET=false"
+
+# Uncomment to enable concurrent garbage collection (GC) if you encounter long GC pauses.
+JVM_OPTS=${JVM_OPTS}" \
+-Xms8g \
+-Xmx8g \
+-Xloggc:./gc${now0}.log \
+-XX:+PrintGCDetails \
+-verbose:gc \
+-XX:+UseParNewGC \
+-XX:+UseConcMarkSweepGC \
+-XX:+PrintGCDateStamps \
+"
+
+#Ignite version
+ver="RELEASE-"
+
+# List of default probes.
+# Add DStatProbe or VmStatProbe if your OS supports it (e.g. if running on Linux).
+BENCHMARK_DEFAULT_PROBES=ThroughputLatencyProbe,PercentileProbe,DStatProbe
+
+# Packages where the specified benchmark is searched by reflection mechanism.
+BENCHMARK_PACKAGES=org.yardstickframework,org.apache.ignite.yardstick
+
+# Flag which indicates to restart the servers before every benchmark execution.
+RESTART_SERVERS=true
+
+# Probe point writer class name.
+# BENCHMARK_WRITER=
+
+# The benchmark is applicable only for 1 server and 1 driver
+SERVER_HOSTS=127.0.0.1
+DRIVER_HOSTS=127.0.0.1
+
+# Remote username.
+# REMOTE_USER=
+
+# Number of nodes, used to wait for the specified number of nodes to start.
+nodesNum=$((`echo ${SERVER_HOSTS} | tr ',' '\n' | wc -l` + `echo ${DRIVER_HOSTS} | tr ',' '\n' | wc -l`))
+
+# Backups count.
+b=1
+
+# Warmup.
+w=30
+
+# Duration.
+d=300
+
+# Threads count.
+t=4
+
+# Sync mode.
+sm=PRIMARY_SYNC
+
+# Jobs.
+j=10
+
+# Run configuration which contains all benchmarks.
+# Note that each benchmark is set to run for 300 seconds (5 min) with warm-up set to 60 seconds (1 minute).
+CONFIGS="\
+-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} --sqlRange 1 -dn NativeSqlUpdateRangeBenchmark -sn IgniteNode -ds ${ver}sql-update-native-r1-${b}-backup -cl,\
+-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} --sqlRange 1000 -dn NativeSqlUpdateRangeBenchmark -sn IgniteNode -ds ${ver}sql-update-native-r1000-${b}-backup -cl,\
+"
http://git-wip-us.apache.org/repos/asf/ignite/blob/63f6b1f4/modules/yardstick/config/ignite-jdbc-config.xml
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/ignite-jdbc-config.xml b/modules/yardstick/config/ignite-jdbc-config.xml
index a279d46..82ce165 100644
--- a/modules/yardstick/config/ignite-jdbc-config.xml
+++ b/modules/yardstick/config/ignite-jdbc-config.xml
@@ -28,9 +28,7 @@
<bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
<property name="clientMode" value="true"/>
- <property name="peerClassLoadingEnabled" value="true"/>
-
- <property name="localHost" value="127.0.0.1"/>
+ <property name="peerClassLoadingEnabled" value="false"/>
<property name="marshaller">
<bean class="org.apache.ignite.internal.binary.BinaryMarshaller" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/63f6b1f4/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
index ba96b6c..8c453ad 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
@@ -21,7 +21,6 @@ import com.beust.jcommander.Parameter;
import org.apache.ignite.IgniteDataStreamer;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.configuration.DataStorageConfiguration;
-import org.apache.ignite.configuration.DataStorageConfiguration;
import org.apache.ignite.internal.util.tostring.GridToStringBuilder;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.transactions.TransactionConcurrency;
@@ -252,6 +251,17 @@ public class IgniteBenchmarkArguments {
@Parameter(names = {"-stbs", "--streamerBufSize"}, description = "Data streamer buffer size")
private int streamerBufSize = IgniteDataStreamer.DFLT_PER_NODE_BUFFER_SIZE;
+ /** */
+ @Parameter(names = {"-sqlr", "--sqlRange"}, description = "Result set size")
+ @GridToStringInclude
+ private int sqlRange = 1;
+
+ /** */
+ @Parameter(names = {"-clidx", "--clientNodesAfterId"},
+ description = "Start client nodes when server ID greater then the parameter value")
+ @GridToStringInclude
+ private int clientNodesAfterId = -1;
+
/**
* @return {@code True} if need set {@link DataStorageConfiguration}.
*/
@@ -631,6 +641,20 @@ public class IgniteBenchmarkArguments {
return streamerBufSize;
}
+ /**
+ * @return Result set size.
+ */
+ public int sqlRange() {
+ return sqlRange;
+ }
+
+ /**
+ * @return Result set size.
+ */
+ public int clientNodesAfterId() {
+ return clientNodesAfterId;
+ }
+
/** {@inheritDoc} */
@Override public String toString() {
return GridToStringBuilder.toString(IgniteBenchmarkArguments.class, this);
http://git-wip-us.apache.org/repos/asf/ignite/blob/63f6b1f4/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
index a6850bf..0c61435 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
@@ -63,12 +63,17 @@ public class IgniteNode implements BenchmarkServer {
// No-op.
}
- /** */
+ /**
+ * @param clientMode Run node in client mode.
+ */
public IgniteNode(boolean clientMode) {
this.clientMode = clientMode;
}
- /** */
+ /**
+ * @param clientMode Run node in client mode.
+ * @param ignite Use exist ignite instance.
+ */
public IgniteNode(boolean clientMode, Ignite ignite) {
this.clientMode = clientMode;
this.ignite = ignite;
@@ -80,6 +85,9 @@ public class IgniteNode implements BenchmarkServer {
BenchmarkUtils.jcommander(cfg.commandLineArguments(), args, "<ignite-node>");
+ if (args.clientNodesAfterId() >= 0 && cfg.memberId() > args.clientNodesAfterId())
+ clientMode = true;
+
IgniteBiTuple<IgniteConfiguration, ? extends ApplicationContext> tup = loadConfiguration(args.configuration());
IgniteConfiguration c = tup.get1();
http://git-wip-us.apache.org/repos/asf/ignite/blob/63f6b1f4/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/AbstractJdbcBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/AbstractJdbcBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/AbstractJdbcBenchmark.java
new file mode 100644
index 0000000..9ef8a77
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/AbstractJdbcBenchmark.java
@@ -0,0 +1,158 @@
+/*
+ * 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.yardstick.jdbc;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.jdbc.thin.JdbcThinUtils;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.yardstick.IgniteAbstractBenchmark;
+import org.yardstickframework.BenchmarkConfiguration;
+
+import static org.apache.ignite.yardstick.jdbc.JdbcUtils.fillData;
+import static org.yardstickframework.BenchmarkUtils.println;
+
+/**
+ * JDBC benchmark that performs query operations.
+ */
+abstract public class AbstractJdbcBenchmark extends IgniteAbstractBenchmark {
+ /** All {@link Connection}s associated with threads. */
+ private final List<Connection> threadConnections = new ArrayList<>();
+
+ /** JDBC URL. */
+ private String url;
+
+ /** Each connection is also a transaction, so we better pin them to threads. */
+ protected ThreadLocal<Connection> conn = new ThreadLocal<Connection>() {
+ @Override protected Connection initialValue() {
+ try {
+ Connection conn = connection();
+
+ synchronized (threadConnections) {
+ threadConnections.add(conn);
+ }
+
+ return conn;
+ }
+ catch (SQLException e) {
+ throw new IgniteException(e);
+ }
+ }
+ };
+
+ /** {@inheritDoc} */
+ @Override public void setUp(BenchmarkConfiguration cfg) throws Exception {
+ super.setUp(cfg);
+
+ if (url == null) {
+ if (args.jdbcUrl().startsWith(JdbcThinUtils.URL_PREFIX)) {
+ String addr = findThinAddress();
+ url = JdbcThinUtils.URL_PREFIX + addr + '/';
+ }
+ else
+ url = args.jdbcUrl();
+ }
+
+ println("Using jdbc url:" + url);
+
+ fillData(cfg, (IgniteEx)ignite(), args.range());
+
+ ignite().close();
+ }
+
+ /**
+ * Find address of client node, that thin driver should use.
+ *
+ * @return Address for thin driver.
+ */
+ private String findThinAddress(){
+ for (ClusterNode n : ignite().cluster().forClients().nodes()) {
+ if (n.isLocal())
+ continue;
+
+ // try to find non-localhost address of this node
+ for (String addr : n.addresses()) {
+ if (!addr.equals("127.0.0.1")
+ && !addr.equals("localhost")
+ && !addr.equals("172.17.0.1")) {
+
+ println("Found remote node: " + addr);
+ return addr;
+ }
+ }
+
+ // otherwise this node is running on localhost in a separate jvm
+ println("Found another client node on localhost");
+ return "127.0.0.1";
+ }
+
+ throw new RuntimeException("Setup exception: could not find non-local node, check your setup");
+ }
+
+ /** {@inheritDoc} */
+ @Override public void tearDown() throws Exception {
+ synchronized (threadConnections) {
+ for (Connection conn : threadConnections)
+ U.closeQuiet(conn);
+
+ threadConnections.clear();
+ }
+
+ super.tearDown();
+ }
+
+ /**
+ * Create new {@link Connection} from {@link #args}. Intended for use by {@link #setUp} and {@link #tearDown}.
+ * @return JDBC connection.
+ * @throws SQLException On error.
+ */
+ private Connection connection() throws SQLException {
+ println("JDBC connect to: " + url);
+
+ Connection conn = DriverManager.getConnection(url);
+
+ conn.setSchema("PUBLIC");
+
+ return conn;
+ }
+
+ /**
+ * Create thread local prepared statement.
+ * @param sql - sql query for statement.
+ * @return Prepared statement.
+ */
+ final ThreadLocal<PreparedStatement> newStatement(final String sql){
+ return new ThreadLocal<PreparedStatement>(){
+ @Override protected PreparedStatement initialValue() {
+ try {
+ return conn.get().prepareStatement(sql);
+ }
+ catch (SQLException e) {
+ throw new IgniteException(e);
+ }
+ }
+ };
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/63f6b1f4/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/AbstractNativeBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/AbstractNativeBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/AbstractNativeBenchmark.java
new file mode 100644
index 0000000..5e92514
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/AbstractNativeBenchmark.java
@@ -0,0 +1,37 @@
+/*
+ * 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.yardstick.jdbc;
+
+import org.apache.ignite.cache.query.SqlFieldsQuery;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.yardstick.IgniteAbstractBenchmark;
+import org.yardstickframework.BenchmarkConfiguration;
+
+import static org.apache.ignite.yardstick.jdbc.JdbcUtils.fillData;
+
+/**
+ * Abstract class for benchmarks that use {@link SqlFieldsQuery}.
+ */
+public abstract class AbstractNativeBenchmark extends IgniteAbstractBenchmark {
+ /** {@inheritDoc} */
+ @Override public void setUp(BenchmarkConfiguration cfg) throws Exception {
+ super.setUp(cfg);
+
+ fillData(cfg, (IgniteEx)ignite(), args.range());
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/63f6b1f4/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/DisjointRangeGenerator.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/DisjointRangeGenerator.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/DisjointRangeGenerator.java
new file mode 100644
index 0000000..b3dc2b6
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/DisjointRangeGenerator.java
@@ -0,0 +1,101 @@
+/*
+ * 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.yardstick.jdbc;
+
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ * Generates random fixed width ranges from [1..tableSize] interval.
+ * It is guaranteed that different threads get disjoint ranges.
+ */
+public class DisjointRangeGenerator {
+ /** Max number of threads that can use this generator. */
+ private final int maxThreadsCnt;
+
+ /** Width of generated range. */
+ private final long rangeWidth;
+
+ /** Size of test data table. */
+ private final long tableSize;
+
+ /** Counter of threads, that are using this idGen */
+ private final AtomicInteger registeredThreads = new AtomicInteger(0);
+
+ /**
+ * Number within [0..threadsCount).
+ * Thread order is used to provide each thread with exclusive set of id ranges
+ * to avoid concurrent updates same rows in test table.
+ */
+ private final ThreadLocal<Integer> threadOrder = new ThreadLocal<Integer>() {
+ @Override protected Integer initialValue() {
+ if (maxThreadsCnt == registeredThreads.get())
+ throw new IllegalStateException("Limit of threads using this generator exceeded. Limit is " + maxThreadsCnt);
+
+ return registeredThreads.getAndIncrement();
+ }
+ };
+
+ /**
+ * @param maxThreadsCnt Max threads count.
+ * @param tableSize Table size.
+ * @param rangeWidth Range width.
+ */
+ public DisjointRangeGenerator(int maxThreadsCnt, long tableSize, long rangeWidth) {
+ if (tableSize < maxThreadsCnt *rangeWidth)
+ throw new IllegalArgumentException("Table size is too small to generate ranges");
+
+ this.maxThreadsCnt = maxThreadsCnt;
+ this.rangeWidth = rangeWidth;
+ this.tableSize = tableSize;
+ }
+
+ /** Width of generated range. */
+ public long rangeWidth() {
+ return rangeWidth;
+ }
+
+ /**
+ * Get new random range from [1..tableSize] interval.
+ *
+ * @return start id of range.
+ */
+ public long nextRangeStartId() {
+ ThreadLocalRandom rnd = ThreadLocalRandom.current();
+
+ long blockWidth = rangeWidth * maxThreadsCnt;
+ long blocksCnt = tableSize / blockWidth;
+
+ long firstBlockId = rnd.nextLong(blocksCnt) * blockWidth + 1;
+
+ long off = threadOrder.get() * rangeWidth;
+
+ return firstBlockId + off;
+
+ }
+
+ /**
+ * Get the end of the range that starts with given id.
+ *
+ * @param startId start id of the range.
+ * @return id of the range (inclusive).
+ */
+ public long endRangeId(long startId) {
+ return startId + rangeWidth - 1;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/63f6b1f4/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/JdbcSqlInsertDeleteBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/JdbcSqlInsertDeleteBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/JdbcSqlInsertDeleteBenchmark.java
new file mode 100644
index 0000000..7ac18a6
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/JdbcSqlInsertDeleteBenchmark.java
@@ -0,0 +1,66 @@
+/*
+ * 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.yardstick.jdbc;
+
+import java.sql.PreparedStatement;
+import java.util.Map;
+import java.util.concurrent.ThreadLocalRandom;
+
+/**
+ * JDBC benchmark that performs insert operations.
+ */
+public class JdbcSqlInsertDeleteBenchmark extends AbstractJdbcBenchmark {
+ /** Statement that inserts one row. */
+ private final ThreadLocal<PreparedStatement> singleInsert = newStatement(
+ "INSERT INTO test_long (id, val) VALUES (?, ?)");
+
+ /** Statement that deletes one row. */
+ private final ThreadLocal<PreparedStatement> singleDelete = newStatement(
+ "DELETE FROM test_long WHERE id = ?");
+
+ /**
+ * Benchmarked action that inserts and immediately deletes single row.
+ *
+ * {@inheritDoc}
+ */
+ @Override public boolean test(Map<Object, Object> ctx) throws Exception {
+ ThreadLocalRandom rnd = ThreadLocalRandom.current();
+
+ long insertKey = rnd.nextLong(args.range()) + 1 + args.range();
+ long insertVal = insertKey + 1;
+
+ PreparedStatement insert = singleInsert.get();
+
+ insert.setLong(1, insertKey);
+ insert.setLong(2, insertVal);
+
+ PreparedStatement delete = singleDelete.get();
+
+ delete.setLong(1, insertKey);
+
+ try {
+ insert.executeUpdate();
+ delete.executeUpdate();
+ }
+ catch (Exception ignored){
+ // collision occurred, ignoring
+ }
+
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/63f6b1f4/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/JdbcSqlQueryRangeBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/JdbcSqlQueryRangeBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/JdbcSqlQueryRangeBenchmark.java
new file mode 100644
index 0000000..c1adb85
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/JdbcSqlQueryRangeBenchmark.java
@@ -0,0 +1,78 @@
+/*
+ * 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.yardstick.jdbc;
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.util.Map;
+import java.util.concurrent.ThreadLocalRandom;
+
+/**
+ * JDBC benchmark that performs select operations
+ */
+public class JdbcSqlQueryRangeBenchmark extends AbstractJdbcBenchmark {
+ /** Statement with range. */
+ private ThreadLocal<PreparedStatement> stmtRange = newStatement(
+ "SELECT id, val FROM test_long WHERE id BETWEEN ? AND ?");
+
+ /** Statement full scan. */
+ private ThreadLocal<PreparedStatement> stmtSingle = newStatement(
+ "SELECT id, val FROM test_long WHERE id = ?");
+
+ /** {@inheritDoc} */
+ @Override public boolean test(Map<Object, Object> ctx) throws Exception {
+ long expRsSize;
+
+ PreparedStatement stmt;
+
+ if (args.sqlRange() == 1) {
+ stmt = stmtSingle.get();
+
+ stmt.setLong(1, ThreadLocalRandom.current().nextLong(args.range()) + 1);
+
+ expRsSize = 1;
+ }
+ else {
+ stmt = stmtRange.get();
+
+ long id = ThreadLocalRandom.current().nextLong(args.range() - args.sqlRange()) + 1;
+ long maxId = id + args.sqlRange() - 1;
+
+ stmt.setLong(1, id);
+ stmt.setLong(2, maxId);
+
+ expRsSize = args.sqlRange();
+ }
+
+ long rsSize = 0;
+
+ try (ResultSet rs = stmt.executeQuery()) {
+ while (rs.next()) {
+ if (rs.getLong(1) + 1 != rs.getLong(2))
+ throw new Exception("Invalid result retrieved");
+
+ rsSize++;
+ }
+ }
+
+ if (rsSize != expRsSize)
+ throw new Exception("Invalid result set size [actual=" + rsSize + ", expected=" + expRsSize + ']');
+
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/63f6b1f4/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/JdbcSqlUpdateBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/JdbcSqlUpdateBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/JdbcSqlUpdateBenchmark.java
new file mode 100644
index 0000000..f7a17f5
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/JdbcSqlUpdateBenchmark.java
@@ -0,0 +1,81 @@
+/*
+ * 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.yardstick.jdbc;
+
+import java.sql.PreparedStatement;
+import java.util.Map;
+import org.yardstickframework.BenchmarkConfiguration;
+
+/**
+ * JDBC benchmark that performs update operations.
+ */
+public class JdbcSqlUpdateBenchmark extends AbstractJdbcBenchmark {
+ /** Statement that updates one row. */
+ private final ThreadLocal<PreparedStatement> singleUpdate = newStatement(
+ "UPDATE test_long SET val = (val + 1) WHERE id = ?");
+
+ /** Statement that updates range of rows. */
+ private final ThreadLocal<PreparedStatement> rangeUpdate = newStatement(
+ "UPDATE test_long SET val = (val + 1) WHERE id BETWEEN ? AND ?");
+
+ /**Generates disjoint (among threads) id ranges */
+ private DisjointRangeGenerator idGen;
+
+ /** Setup method */
+ @Override public void setUp(BenchmarkConfiguration cfg) throws Exception {
+ super.setUp(cfg);
+ idGen = new DisjointRangeGenerator(cfg.threads(), args.range(), args.sqlRange());
+ }
+
+ /**
+ * Benchmarked action that performs updates.
+ *
+ * {@inheritDoc}
+ */
+ @Override public boolean test(Map<Object, Object> ctx) throws Exception {
+
+ long expResSize = idGen.rangeWidth();
+
+ long startId = idGen.nextRangeStartId();
+ long endId = idGen.endRangeId(startId);
+
+ PreparedStatement update;
+
+ if (idGen.rangeWidth() == 1){
+ update = singleUpdate.get();
+
+ // startId == endId
+ update.setLong(1, startId);
+ }
+ else {
+ update = rangeUpdate.get();
+
+ update.setLong(1, startId);
+ update.setLong(2, endId);
+ }
+
+ int actualResSize = update.executeUpdate();
+
+ if (actualResSize != expResSize) {
+ throw new Exception("Invalid result set size [actual=" + actualResSize
+ + ", expected=" + expResSize + ']');
+ }
+
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/63f6b1f4/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/JdbcUtils.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/JdbcUtils.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/JdbcUtils.java
new file mode 100644
index 0000000..74b5da5
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/JdbcUtils.java
@@ -0,0 +1,55 @@
+/*
+ * 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.yardstick.jdbc;
+
+import org.apache.ignite.cache.query.SqlFieldsQuery;
+import org.apache.ignite.internal.IgniteEx;
+import org.yardstickframework.BenchmarkConfiguration;
+
+import static org.yardstickframework.BenchmarkUtils.println;
+
+/**
+ * Useful methods for JDBC benchmarks.
+ */
+public class JdbcUtils {
+ /**
+ * Common method to fill test stand with data.
+ * @param cfg Benchmark configuration.
+ * @param ignite Ignite node.
+ * @param range Data key range.
+ */
+ static void fillData(BenchmarkConfiguration cfg, IgniteEx ignite, long range) {
+ println(cfg, "Create table...");
+
+ ignite.context().query().querySqlFields(
+ new SqlFieldsQuery("CREATE TABLE test_long (id long primary key, val long)"), true);
+
+ println(cfg, "Populate data...");
+
+ for (long l = 1; l <= range; ++l) {
+ ignite.context().query().querySqlFields(
+ new SqlFieldsQuery("insert into test_long (id, val) values (?, ?)")
+ .setArgs(l, l + 1), true);
+
+ if (l % 10000 == 0)
+ println(cfg, "Populate " + l);
+ }
+
+ println(cfg, "Finished populating data");
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/63f6b1f4/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/NativeSqlInsertDeleteBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/NativeSqlInsertDeleteBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/NativeSqlInsertDeleteBenchmark.java
new file mode 100644
index 0000000..9b26703
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/NativeSqlInsertDeleteBenchmark.java
@@ -0,0 +1,61 @@
+/*
+ * 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.yardstick.jdbc;
+
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ThreadLocalRandom;
+import org.apache.ignite.cache.query.FieldsQueryCursor;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.processors.query.GridQueryProcessor;
+
+/**
+ * Native sql benchmark that performs insert operations.
+ */
+public class NativeSqlInsertDeleteBenchmark extends AbstractNativeBenchmark {
+ /**
+ * Benchmarked action that inserts and immediately deletes row.
+ *
+ * {@inheritDoc}
+ */
+ @Override public boolean test(Map<Object, Object> ctx) throws Exception {
+ long insertKey = ThreadLocalRandom.current().nextLong(args.range()) + 1 + args.range();
+ long insertVal = insertKey + 1;
+
+ SqlFieldsQuery insert = new SqlFieldsQuery("INSERT INTO test_long (id, val) VALUES (?, ?)");
+
+ insert.setArgs(insertKey, insertVal);
+
+ SqlFieldsQuery delete = new SqlFieldsQuery("DELETE FROM test_long WHERE id = ?");
+
+ delete.setArgs(insertKey);
+
+ GridQueryProcessor qryProc = ((IgniteEx)ignite()).context().query();
+
+ try (FieldsQueryCursor<List<?>> insCur = qryProc.querySqlFields(insert, false);
+ FieldsQueryCursor<List<?>> delCur = qryProc.querySqlFields(delete, false)) {
+ // No-op, there is no result
+ }
+ catch (Exception ign) {
+ // collision occurred, ignoring
+ }
+
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/63f6b1f4/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/NativeSqlQueryRangeBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/NativeSqlQueryRangeBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/NativeSqlQueryRangeBenchmark.java
new file mode 100644
index 0000000..8dcdda7
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/NativeSqlQueryRangeBenchmark.java
@@ -0,0 +1,77 @@
+/*
+ * 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.yardstick.jdbc;
+
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ThreadLocalRandom;
+import org.apache.ignite.cache.query.FieldsQueryCursor;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
+import org.apache.ignite.internal.IgniteEx;
+
+/**
+ * Native sql benchmark that performs select operations.
+ */
+public class NativeSqlQueryRangeBenchmark extends AbstractNativeBenchmark {
+ /**
+ * Benchmarked action that performs selects and validates results.
+ *
+ * {@inheritDoc}
+ */
+ @Override public boolean test(Map<Object, Object> ctx) throws Exception {
+ long expRsSize;
+
+ SqlFieldsQuery qry;
+
+ if (args.sqlRange() == 1) {
+ qry = new SqlFieldsQuery("SELECT id, val FROM test_long WHERE id = ?");
+
+ qry.setArgs(ThreadLocalRandom.current().nextLong(args.range()) + 1);
+
+ expRsSize = 1;
+ }
+ else {
+ qry = new SqlFieldsQuery("SELECT id, val FROM test_long WHERE id BETWEEN ? AND ?");
+
+ long id = ThreadLocalRandom.current().nextLong(args.range() - args.sqlRange()) + 1;
+ long maxId = id + args.sqlRange() - 1;
+
+ qry.setArgs(id, maxId);
+
+ expRsSize = args.sqlRange();
+ }
+
+ long rsSize = 0;
+
+ try (FieldsQueryCursor<List<?>> cursor = ((IgniteEx)ignite()).context().query()
+ .querySqlFields(qry, false)) {
+
+ for (List<?> row : cursor) {
+ if ((Long)row.get(0) + 1 != (Long)row.get(1))
+ throw new Exception("Invalid result retrieved");
+
+ rsSize++;
+ }
+ }
+
+ if (rsSize != expRsSize)
+ throw new Exception("Invalid result set size [actual=" + rsSize + ", expected=" + expRsSize + ']');
+
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/63f6b1f4/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/NativeSqlUpdateRangeBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/NativeSqlUpdateRangeBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/NativeSqlUpdateRangeBenchmark.java
new file mode 100644
index 0000000..9ceed68
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/NativeSqlUpdateRangeBenchmark.java
@@ -0,0 +1,83 @@
+/*
+ * 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.yardstick.jdbc;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import org.apache.ignite.cache.query.FieldsQueryCursor;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
+import org.apache.ignite.internal.IgniteEx;
+import org.yardstickframework.BenchmarkConfiguration;
+
+/**
+ * Native sql benchmark that performs update operations.
+ */
+public class NativeSqlUpdateRangeBenchmark extends AbstractNativeBenchmark {
+ /** Generates disjoint (among threads) id ranges */
+ private DisjointRangeGenerator idGen;
+
+ /** Setup method */
+ @Override public void setUp(BenchmarkConfiguration cfg) throws Exception {
+ super.setUp(cfg);
+ idGen = new DisjointRangeGenerator(cfg.threads(), args.range(), args.sqlRange());
+ }
+
+ /**
+ * Benchmarked action that performs updates (single row or batch).
+ *
+ * {@inheritDoc}
+ */
+ @Override public boolean test(Map<Object, Object> ctx) throws Exception {
+ long startId = idGen.nextRangeStartId();
+ long endId = idGen.endRangeId(startId);
+
+ long expRsSize = idGen.rangeWidth();
+
+ SqlFieldsQuery qry;
+
+ if (idGen.rangeWidth() == 1) {
+ qry = new SqlFieldsQuery("UPDATE test_long SET val = (val + 1) WHERE id = ?");
+
+ // startId == endId
+ qry.setArgs(startId);
+ }
+ else {
+ qry = new SqlFieldsQuery("UPDATE test_long SET val = (val + 1) WHERE id BETWEEN ? AND ?");
+
+ qry.setArgs(startId, endId);
+ }
+
+ try (FieldsQueryCursor<List<?>> cursor = ((IgniteEx)ignite()).context().query()
+ .querySqlFields(qry, false)) {
+ Iterator<List<?>> it = cursor.iterator();
+
+ List<?> cntRow = it.next();
+
+ long rsSize = (Long)cntRow.get(0);
+
+ if (it.hasNext())
+ throw new Exception("Only one row expected on UPDATE query");
+
+ if (rsSize != expRsSize)
+ throw new Exception("Invalid result set size [actual=" + rsSize + ", expected=" + expRsSize + ']');
+ }
+
+ return true;
+ }
+}