ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [11/25] ignite git commit: Yardstick backport from master
Date Fri, 01 Jul 2016 12:59:59 GMT
Yardstick backport from master


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4670bc53
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4670bc53
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4670bc53

Branch: refs/heads/ignite-3154
Commit: 4670bc53eebafa8b0f7ef053097c7c5cb5136aa5
Parents: 1873fd8
Author: Anton Vinogradov <av@apache.org>
Authored: Wed Jun 29 16:05:09 2016 +0300
Committer: Anton Vinogradov <av@apache.org>
Committed: Wed Jun 29 16:05:09 2016 +0300

----------------------------------------------------------------------
 .../config/benchmark-cache-load-win.properties  |   60 +
 .../config/benchmark-cache-load.properties      |   92 ++
 .../yardstick/config/benchmark-full.properties  |  116 ++
 .../config/ignite-base-load-config.xml          |  255 ++++
 .../config/ignite-cache-load-config.xml         |   71 ++
 modules/yardstick/config/queries.sql            |    2 +
 modules/yardstick/pom.xml                       |    2 +-
 .../yardstick/IgniteBenchmarkArguments.java     |   50 +-
 .../org/apache/ignite/yardstick/IgniteNode.java |    2 +
 .../cache/IgniteCacheAbstractBenchmark.java     |   59 +
 .../yardstick/cache/IgniteGetTxBenchmark.java   |   30 +
 .../yardstick/cache/IgniteInvokeBenchmark.java  |   65 +
 .../cache/IgniteInvokeTxBenchmark.java          |   30 +
 .../IgniteCacheRandomOperationBenchmark.java    | 1160 ++++++++++++++++++
 .../yardstick/cache/load/model/ModelUtil.java   |  181 +++
 .../cache/load/model/key/Identifier.java        |  113 ++
 .../yardstick/cache/load/model/key/Mark.java    |  115 ++
 .../yardstick/cache/load/model/value/Car.java   |  126 ++
 .../yardstick/cache/load/model/value/Color.java |   50 +
 .../yardstick/cache/load/model/value/Truck.java |   69 ++
 .../ignite/yardstick/cache/model/Account.java   |    6 +
 .../ignite/yardstick/cache/model/Person1.java   |    2 +-
 .../ignite/yardstick/cache/model/Person2.java   |    2 +-
 .../ignite/yardstick/cache/model/SampleKey.java |    2 +-
 .../yardstick/cache/model/SampleValue.java      |    2 +-
 25 files changed, 2656 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/4670bc53/modules/yardstick/config/benchmark-cache-load-win.properties
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/benchmark-cache-load-win.properties b/modules/yardstick/config/benchmark-cache-load-win.properties
new file mode 100644
index 0000000..efe24f5
--- /dev/null
+++ b/modules/yardstick/config/benchmark-cache-load-win.properties
@@ -0,0 +1,60 @@
+# 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 execute random operation on various caches.
+::
+
+:: JVM options.
+set JVM_OPTS=%JVM_OPTS% -DIGNITE_QUIET=false
+
+:: Uncomment to enable concurrent garbage collection (GC) if you encounter long GC pauses.
+:: set JVM_OPTS=%JVM_OPTS%^
+::  -XX:+UseParNewGC^
+::  -XX:+UseConcMarkSweepGC^
+::  -XX:+UseTLAB^
+::  -XX:NewSize=128m^
+::  -XX:MaxNewSize=128m^
+::  -XX:MaxTenuringThreshold=0^
+::  -XX:SurvivorRatio=1024^
+::  -XX:+UseCMSInitiatingOccupancyOnly^
+::  -XX:CMSInitiatingOccupancyFraction=60
+
+:: List of default probes.
+BENCHMARK_DEFAULT_PROBES=ThroughputLatencyProbe,PercentileProbe
+
+:: Packages where the specified benchmark is searched by reflection mechanism.
+BENCHMARK_PACKAGES=org.yardstickframework,org.apache.ignite.yardstick
+
+:: Probe point writer class name.
+:: BENCHMARK_WRITER=
+
+:: Comma-separated list of the hosts to run BenchmarkServers on. 2 nodes on local host are enabled by default.
+set SERVER_HOSTS=localhost,localhost
+
+:: Comma-separated list of the hosts to run BenchmarkDrivers on. 1 node on local host is enabled by default.
+set DRIVER_HOSTS=localhost
+
+:: Remote username.
+:: set REMOTE_USER=
+
+:: Allow Operation
+set ops=PUT PUT_ALL GET GET_ALL INVOKE INVOKE_ALL REMOVE REMOVE_ALL PUT_IF_ABSENT REPLACE SCAN_QUERY SQL_QUERY CONTINUOUS_QUERY
+
+:: Run configuration which contains all benchmarks.
+:: Note that each benchmark is set to run for 300 seconds (5 mins) with warm-up set to 60 seconds (1 minute).
+set CONFIGS=^
+-cfg %SCRIPT_DIR%\..\config\ignite-cache-load-config.xml -r 10000 -pa 500 -bs 50 -b 1 -w 20 -d 30 -t 64 -sm PRIMARY_SYNC -dn IgniteCacheRandomOperationBenchmark -sn IgniteNode -ds cache-random-benchmark-1-backup -nn 1^
+  -ltqf config\queries.sql -ltops %ops%

http://git-wip-us.apache.org/repos/asf/ignite/blob/4670bc53/modules/yardstick/config/benchmark-cache-load.properties
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/benchmark-cache-load.properties b/modules/yardstick/config/benchmark-cache-load.properties
new file mode 100644
index 0000000..7312cb6
--- /dev/null
+++ b/modules/yardstick/config/benchmark-cache-load.properties
@@ -0,0 +1,92 @@
+
+# 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.
+
+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}" \
+-Xloggc:./gc${now0}.log \
+-XX:+PrintGCDetails \
+-verbose:gc \
+-XX:+UseParNewGC \
+-XX:+UseConcMarkSweepGC \
+-XX:+UseTLAB \
+-XX:NewSize=128m \
+-XX:MaxNewSize=128m \
+-XX:MaxTenuringThreshold=0 \
+-XX:SurvivorRatio=1024 \
+-XX:+UseCMSInitiatingOccupancyOnly \
+-XX:CMSInitiatingOccupancyFraction=60 \
+"
+# List of default probes.
+# Add DStatProbe or VmStatProbe if your OS supports it (e.g. if running on Linux).
+BENCHMARK_DEFAULT_PROBES=ThroughputLatencyProbe,PercentileProbe
+
+# Packages where the specified benchmark is searched by reflection mechanism.
+BENCHMARK_PACKAGES=org.yardstickframework,org.apache.ignite.yardstick
+
+# Probe point writer class name.
+# BENCHMARK_WRITER=
+
+# Comma-separated list of the hosts to run BenchmarkServers on. 2 nodes on local host are enabled by default.
+SERVER_HOSTS=localhost,localhost,localhost
+
+# Comma-separated list of the hosts to run BenchmarkDrivers on. 1 node on local host is enabled by default.
+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=60
+
+# Duration.
+d=300
+
+# Threads count.
+t=64
+
+# Sync mode.
+sm=PRIMARY_SYNC
+
+# Preload amount 
+pa=500000
+
+# Key range
+r=1000000
+
+# Batch size
+
+bs=50
+
+# Allow Operation
+ops="PUT PUT_ALL GET GET_ALL INVOKE INVOKE_ALL REMOVE REMOVE_ALL PUT_IF_ABSENT REPLACE SCAN_QUERY SQL_QUERY CONTINUOUS_QUERY"
+
+# Run configuration.
+# Note that each benchmark is set to run for 300 seconds (5 mins) with warm-up set to 60 seconds (1 minute).
+CONFIGS="\
+-cfg ${SCRIPT_DIR}/../config/ignite-cache-load-config.xml -r ${r} -pa ${pa} -bs ${bs} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} -dn IgniteCacheRandomOperationBenchmark -sn IgniteNode -ds cache-random-benchmark-${b}-backup -nn ${nodesNum} \
+-ltqf ${SCRIPT_DIR}/../config/queries.sql -ltops ${ops}"

http://git-wip-us.apache.org/repos/asf/ignite/blob/4670bc53/modules/yardstick/config/benchmark-full.properties
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/benchmark-full.properties b/modules/yardstick/config/benchmark-full.properties
new file mode 100644
index 0000000..da3ae9f
--- /dev/null
+++ b/modules/yardstick/config/benchmark-full.properties
@@ -0,0 +1,116 @@
+# 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 all benchmarks
+#
+
+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}" \
+  -Xloggc:./gc${now0}.log \
+  -XX:+PrintGCDetails \
+  -verbose:gc \
+  -XX:+UseParNewGC \
+  -XX:+UseConcMarkSweepGC \
+  -XX:+UseTLAB \
+  -XX:NewSize=128m \
+  -XX:MaxNewSize=128m \
+  -XX:MaxTenuringThreshold=0 \
+  -XX:SurvivorRatio=1024 \
+  -XX:+UseCMSInitiatingOccupancyOnly \
+  -XX:CMSInitiatingOccupancyFraction=60 \
+"
+
+#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
+
+RESTART_SERVERS=true
+
+# Probe point writer class name.
+# BENCHMARK_WRITER=
+
+# Comma-separated list of the hosts to run BenchmarkServers on. 2 nodes on local host are enabled by default.
+SERVER_HOSTS=localhost,localhost,localhost
+
+# Comma-separated list of the hosts to run BenchmarkDrivers on. 1 node on local host is enabled by default.
+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=60
+
+# Duration.
+d=300
+
+# Threads count.
+t=64
+
+# Sync mode.
+sm=PRIMARY_SYNC
+
+
+# Run configuration which contains all benchmarks.
+# Note that each benchmark is set to run for 300 seconds (5 mins) with warm-up set to 60 seconds (1 minute).
+CONFIGS="\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t}  -sm ${sm} -dn IgnitePutBenchmark -sn IgniteNode -ds ${ver}atomic-put-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t}  -sm ${sm} -dn IgnitePutGetBenchmark -sn IgniteNode -ds ${ver}atomic-put-get-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t}  -sm ${sm} -bs 2 -dn IgnitePutGetBatchBenchmark -sn IgniteNode -ds ${ver}atomic-put-get-bs-2-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t}  -sm ${sm} -bs 6 -dn IgnitePutGetBatchBenchmark -sn IgniteNode -ds ${ver}atomic-put-get-bs-6-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t}  -sm ${sm} -bs 10 -dn IgnitePutGetBatchBenchmark -sn IgniteNode -ds ${ver}atomic-put-get-bs-10-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t}  -sm ${sm} -dn IgnitePutTxImplicitBenchmark -sn IgniteNode -ds ${ver}tx-optimistic-put-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t}  -sm ${sm} -txc OPTIMISTIC -dn IgnitePutGetTxBenchmark -sn IgniteNode -ds ${ver}tx-optim-repRead-put-get-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t}  -sm ${sm} -txc PESSIMISTIC -dn IgnitePutGetTxBenchmark -sn IgniteNode -ds ${ver}tx-pessim-repRead-put-get-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t}  -sm ${sm} -txc OPTIMISTIC -txi SERIALIZABLE -dn IgnitePutGetTxBenchmark -sn IgniteNode -ds ${ver}tx-opt-serial-put-get-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t}  -sm ${sm} -dn IgniteSqlQueryBenchmark -sn IgniteNode -ds ${ver}sql-query-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t}  -sm ${sm} -dn IgniteSqlQueryPutBenchmark -sn IgniteNode -ds ${ver}sql-query-put-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t}  -sm ${sm} -bs 2 -dn IgnitePutAllBenchmark -sn IgniteNode -ds ${ver}atomic-putAll-bs-2-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t}  -sm ${sm} -bs 6 -dn IgnitePutAllBenchmark -sn IgniteNode -ds ${ver}atomic-putAll-bs-6-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t}  -sm ${sm} -bs 10 -dn IgnitePutAllBenchmark -sn IgniteNode -ds ${ver}atomic-putAll-bs-10-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t}  -sm ${sm} -bs 2 -dn IgnitePutAllTxBenchmark -sn IgniteNode -ds ${ver}tx-putAll-bs2-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t}  -sm ${sm} -bs 6 -dn IgnitePutAllTxBenchmark -sn IgniteNode -ds ${ver}tx-putAll-bs-6-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t}  -sm ${sm} -bs 10 -dn IgnitePutAllTxBenchmark -sn IgniteNode -ds ${ver}tx-putAll-bs-10-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t}  -sm ${sm} -bs 2 -dn IgnitePutAllSerializableTxBenchmark -sn IgniteNode -ds ${ver}tx-putAllSerializable-bs-2-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t}  -sm ${sm} -bs 6 -dn IgnitePutAllSerializableTxBenchmark -sn IgniteNode -ds ${ver}tx-putAllSerializable-bs-6-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t}  -sm ${sm} -bs 10 -dn IgnitePutAllSerializableTxBenchmark -sn IgniteNode -ds ${ver}tx-putAllSerializable-bs-10-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t}  -sm ${sm} -bs 2 -txc OPTIMISTIC  -dn IgniteGetAllPutAllTxBenchmark -sn IgniteNode -ds ${ver}tx-optimistic-getAllPutAll-bs-2-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t}  -sm ${sm} -bs 6 -txc OPTIMISTIC  -dn IgniteGetAllPutAllTxBenchmark -sn IgniteNode -ds ${ver}tx-optimistic-getAllPutAll-bs-6-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t}  -sm ${sm} -bs 10 -txc OPTIMISTIC  -dn IgniteGetAllPutAllTxBenchmark -sn IgniteNode -ds ${ver}tx-optimistic-getAllPutAll-bs-10-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t}  -sm ${sm} -bs 2 -txc PESSIMISTIC -dn IgniteGetAllPutAllTxBenchmark -sn IgniteNode -ds ${ver}tx-pessimistic-getAllPutAll-bs-2-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t}  -sm ${sm} -bs 6 -txc PESSIMISTIC -dn IgniteGetAllPutAllTxBenchmark -sn IgniteNode -ds ${ver}tx-pessimistic-getAllPutAll-bs-6-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t}  -sm ${sm} -bs 10 -txc PESSIMISTIC -dn IgniteGetAllPutAllTxBenchmark -sn IgniteNode -ds ${ver}tx-pessimistic-getAllPutAll-bs-10-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t}  -sm ${sm} -bs 2 -txc OPTIMISTIC -txi SERIALIZABLE -dn IgniteGetAllPutAllTxBenchmark -sn IgniteNode -ds ${ver}tx-opt-serializable-getAllPutAll-bs-2-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t}  -sm ${sm} -bs 6 -txc OPTIMISTIC -txi SERIALIZABLE -dn IgniteGetAllPutAllTxBenchmark -sn IgniteNode -ds ${ver}tx-opt-serializable-getAllPutAll-bs-6-1-backup,\
+-cfg ${SCRIPT_DIR}/../config/ignite-multicast-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t}  -sm ${sm} -bs 10 -txc OPTIMISTIC -txi SERIALIZABLE -dn IgniteGetAllPutAllTxBenchmark -sn IgniteNode -ds ${ver}tx-opt-serializable-getAllPutAll-bs-10-1-backup,\
+"
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/4670bc53/modules/yardstick/config/ignite-base-load-config.xml
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/ignite-base-load-config.xml b/modules/yardstick/config/ignite-base-load-config.xml
new file mode 100644
index 0000000..614f778
--- /dev/null
+++ b/modules/yardstick/config/ignite-base-load-config.xml
@@ -0,0 +1,255 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+<!--
+    Ignite Spring configuration file to startup grid.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
+    <bean id="base-ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration" abstract="true">
+        <property name="peerClassLoadingEnabled" value="false"/>
+
+        <property name="metricsLogFrequency" value="5000"/>
+
+        <property name="includeEventTypes">
+            <list/>
+        </property>
+
+        <property name="loadBalancingSpi">
+            <bean class="org.apache.ignite.spi.loadbalancing.roundrobin.RoundRobinLoadBalancingSpi">
+                <property name="perTask" value="false"/>
+            </bean>
+        </property>
+    </bean>
+
+    <bean name="atomic" class="org.apache.ignite.configuration.CacheConfiguration">
+        <property name="name" value="atomic-fat-values"/>
+
+        <property name="cacheMode" value="PARTITIONED"/>
+
+        <property name="atomicityMode" value="ATOMIC"/>
+
+        <property name="swapEnabled" value="false"/>
+    </bean>
+
+    <bean name="atomic-offheap" class="org.apache.ignite.configuration.CacheConfiguration">
+        <property name="name" value="atomic-offheap"/>
+
+        <property name="cacheMode" value="PARTITIONED"/>
+
+        <property name="atomicityMode" value="ATOMIC"/>
+
+        <property name="swapEnabled" value="false"/>
+
+        <property name="memoryMode" value="OFFHEAP_TIERED"/>
+    </bean>
+
+    <bean name="atomic-offheap-values" class="org.apache.ignite.configuration.CacheConfiguration">
+        <property name="name" value="atomic-offheap-values"/>
+
+        <property name="cacheMode" value="PARTITIONED"/>
+
+        <property name="atomicityMode" value="ATOMIC"/>
+
+        <property name="swapEnabled" value="false"/>
+
+        <property name="memoryMode" value="OFFHEAP_VALUES"/>
+
+    </bean>
+
+    <bean name="tx" class="org.apache.ignite.configuration.CacheConfiguration">
+        <property name="name" value="tx-fat-values"/>
+
+        <property name="cacheMode" value="PARTITIONED"/>
+
+        <property name="atomicityMode" value="TRANSACTIONAL"/>
+
+        <property name="swapEnabled" value="false"/>
+
+    </bean>
+
+    <bean name="tx-offheap" class="org.apache.ignite.configuration.CacheConfiguration">
+        <property name="name" value="tx-offheap"/>
+
+        <property name="cacheMode" value="PARTITIONED"/>
+
+        <property name="atomicityMode" value="TRANSACTIONAL"/>
+
+        <property name="swapEnabled" value="false"/>
+
+        <property name="memoryMode" value="OFFHEAP_TIERED"/>
+
+    </bean>
+
+    <bean name="tx-offheap-values" class="org.apache.ignite.configuration.CacheConfiguration">
+        <property name="name" value="tx-offheap-values"/>
+
+        <property name="cacheMode" value="PARTITIONED"/>
+
+        <property name="atomicityMode" value="TRANSACTIONAL"/>
+
+        <property name="swapEnabled" value="false"/>
+
+        <property name="memoryMode" value="OFFHEAP_VALUES"/>
+
+    </bean>
+
+    <bean name="atomic-index" class="org.apache.ignite.configuration.CacheConfiguration">
+        <property name="name" value="atomic-index"/>
+
+        <property name="cacheMode" value="PARTITIONED"/>
+
+        <property name="atomicityMode" value="ATOMIC"/>
+
+        <property name="swapEnabled" value="false"/>
+
+        <property name="indexedTypes">
+            <list>
+                <value>java.lang.Integer</value>
+                <value>org.apache.ignite.yardstick.cache.model.Person1</value>
+
+                <value>java.lang.Integer</value>
+                <value>org.apache.ignite.yardstick.cache.model.Person2</value>
+
+                <value>java.lang.Integer</value>
+                <value>org.apache.ignite.yardstick.cache.model.Person8</value>
+            </list>
+        </property>
+    </bean>
+
+    <bean name="query" class="org.apache.ignite.configuration.CacheConfiguration">
+        <property name="name" value="query"/>
+
+        <property name="cacheMode" value="PARTITIONED"/>
+
+        <property name="atomicityMode" value="ATOMIC"/>
+
+        <property name="swapEnabled" value="false"/>
+
+        <!-- Configure query entities -->
+        <property name="queryEntities">
+            <list>
+                <bean class="org.apache.ignite.cache.QueryEntity">
+                    <property name="keyType" value="java.lang.Integer"/>
+                    <property name="valueType" value="org.apache.ignite.yardstick.cache.model.Person"/>
+
+                    <property name="fields">
+                        <map>
+                            <entry key="id" value="java.lang.Integer"/>
+                            <entry key="orgId" value="java.lang.Integer"/>
+                            <entry key="firstName" value="java.lang.String"/>
+                            <entry key="lastName" value="java.lang.String"/>
+                            <entry key="salary" value="java.lang.Double"/>
+                        </map>
+                    </property>
+
+                    <property name="indexes">
+                        <list>
+                            <bean class="org.apache.ignite.cache.QueryIndex">
+                                <constructor-arg value="id"/>
+                            </bean>
+                            <!-- Group index. -->
+                            <bean class="org.apache.ignite.cache.QueryIndex">
+                                <constructor-arg>
+                                    <list>
+                                        <value>id</value>
+                                        <value>salary</value>
+                                    </list>
+                                </constructor-arg>
+                                <constructor-arg value="SORTED"/>
+                            </bean>
+                        </list>
+                    </property>
+                </bean>
+            </list>
+        </property>
+    </bean>
+
+    <bean name="orgCache" class="org.apache.ignite.configuration.CacheConfiguration">
+        <property name="name" value="orgCache"/>
+
+        <property name="cacheMode" value="PARTITIONED"/>
+
+        <property name="atomicityMode" value="ATOMIC"/>
+
+        <property name="swapEnabled" value="false"/>
+
+        <!-- Configure query entities -->
+        <property name="queryEntities">
+            <list>
+                <bean class="org.apache.ignite.cache.QueryEntity">
+                    <property name="keyType" value="java.lang.Integer"/>
+                    <property name="valueType" value="org.apache.ignite.yardstick.cache.model.Organization"/>
+
+                    <property name="fields">
+                        <map>
+                            <entry key="id" value="java.lang.Integer"/>
+                            <entry key="name" value="java.lang.String"/>
+                        </map>
+                    </property>
+
+                    <property name="indexes">
+                        <list>
+                            <bean class="org.apache.ignite.cache.QueryIndex">
+                                <constructor-arg value="id"/>
+                            </bean>
+                            <bean class="org.apache.ignite.cache.QueryIndex">
+                                <constructor-arg value="name"/>
+                            </bean>
+                        </list>
+                    </property>
+                </bean>
+            </list>
+        </property>
+    </bean>
+
+    <bean name="query-offheap" class="org.apache.ignite.configuration.CacheConfiguration">
+        <property name="name" value="query-offheap"/>
+
+        <property name="cacheMode" value="PARTITIONED"/>
+
+        <property name="atomicityMode" value="ATOMIC"/>
+
+        <property name="swapEnabled" value="false"/>
+
+        <property name="memoryMode" value="OFFHEAP_TIERED"/>
+
+        <property name="indexedTypes">
+            <list>
+                <value>java.lang.Integer</value>
+                <value>org.apache.ignite.yardstick.cache.model.Organization</value>
+
+                <value>java.lang.Integer</value>
+                <value>org.apache.ignite.yardstick.cache.model.Person</value>
+            </list>
+        </property>
+    </bean>
+
+    <bean name="compute" class="org.apache.ignite.configuration.CacheConfiguration">
+        <property name="name" value="compute"/>
+
+        <property name="cacheMode" value="PARTITIONED"/>
+
+        <property name="atomicityMode" value="TRANSACTIONAL"/>
+
+        <property name="swapEnabled" value="false"/>
+    </bean>
+</beans>

http://git-wip-us.apache.org/repos/asf/ignite/blob/4670bc53/modules/yardstick/config/ignite-cache-load-config.xml
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/ignite-cache-load-config.xml b/modules/yardstick/config/ignite-cache-load-config.xml
new file mode 100644
index 0000000..6c6ac89
--- /dev/null
+++ b/modules/yardstick/config/ignite-cache-load-config.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~ 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.
+  -->
+
+<!--
+    Ignite Spring configuration file to startup grid.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
+    <import resource="ignite-base-load-config.xml"/>
+
+    <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration" parent="base-ignite.cfg">
+        <property name="localHost" value="127.0.0.1"/>
+
+        <property name="cacheConfiguration">
+            <list>
+                <ref bean="atomic" />
+                <ref bean="atomic-offheap" />
+                <ref bean="atomic-offheap-values" />
+                <ref bean="tx" />
+                <ref bean="tx-offheap" />
+                <ref bean="tx-offheap-values" />
+                <ref bean="atomic-index" />
+                <ref bean="query" />
+                <ref bean="orgCache" />
+                <!--<ref bean="query-offheap" />-->
+                <ref bean="compute" />
+            </list>
+        </property>
+
+        <property name="discoverySpi">
+            <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
+                <property name="ipFinder">
+                    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
+                        <property name="addresses">
+                            <list>
+                                <value>127.0.0.1:47500</value>
+                                <value>127.0.0.1:47501</value>
+                                <value>127.0.0.1:47502</value>
+                                <value>127.0.0.1:47503</value>
+                                <value>127.0.0.1:47504</value>
+                                <value>127.0.0.1:47505</value>
+                                <value>127.0.0.1:47506</value>
+                                <value>127.0.0.1:47507</value>
+                                <value>127.0.0.1:47508</value>
+                                <value>127.0.0.1:47509</value>
+                            </list>
+                        </property>
+                    </bean>
+                </property>
+            </bean>
+        </property>
+    </bean>
+</beans>

http://git-wip-us.apache.org/repos/asf/ignite/blob/4670bc53/modules/yardstick/config/queries.sql
----------------------------------------------------------------------
diff --git a/modules/yardstick/config/queries.sql b/modules/yardstick/config/queries.sql
new file mode 100644
index 0000000..8271100
--- /dev/null
+++ b/modules/yardstick/config/queries.sql
@@ -0,0 +1,2 @@
+SELECT Person.firstName  FROM "query".Person, "orgCache".Organization WHERE Person.orgId = Organization.id AND lower(Organization.name) = lower('Organization 55')
+SELECT Organization.name  FROM "orgCache".Organization WHERE lower(Organization.name) LIKE lower('%55%')

http://git-wip-us.apache.org/repos/asf/ignite/blob/4670bc53/modules/yardstick/pom.xml
----------------------------------------------------------------------
diff --git a/modules/yardstick/pom.xml b/modules/yardstick/pom.xml
index 52418d9..a0f7de5 100644
--- a/modules/yardstick/pom.xml
+++ b/modules/yardstick/pom.xml
@@ -31,7 +31,7 @@
     </parent>
 
     <artifactId>ignite-yardstick</artifactId>
-    <version>1.6.0-SNAPSHOT</version>
+    <version>1.7.0-SNAPSHOT</version>
     <url>http://ignite.apache.org</url>
 
     <properties>

http://git-wip-us.apache.org/repos/asf/ignite/blob/4670bc53/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 1ecfa0f..1854938 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
@@ -24,6 +24,9 @@ import org.apache.ignite.internal.util.tostring.GridToStringBuilder;
 import org.apache.ignite.transactions.TransactionConcurrency;
 import org.apache.ignite.transactions.TransactionIsolation;
 
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * Input arguments for Ignite benchmarks.
  */
@@ -37,10 +40,15 @@ public class IgniteBenchmarkArguments {
     @Parameter(names = {"-b", "--backups"}, description = "Backups")
     private int backups;
 
+    /** */
     @Parameter(names = {"-cfg", "--Config"}, description = "Configuration file")
     private String cfg = "config/ignite-localhost-config.xml";
 
     /** */
+    @Parameter(names = {"-ltqf", "--loadTestQueriesFile"}, description = "File with predefined SQL queries")
+    private String loadTestQueriesFile = null;
+
+    /** */
     @Parameter(names = {"-sm", "--syncMode"}, description = "Synchronization mode")
     private CacheWriteSynchronizationMode syncMode = CacheWriteSynchronizationMode.PRIMARY_SYNC;
 
@@ -86,7 +94,11 @@ public class IgniteBenchmarkArguments {
 
     /** */
     @Parameter(names = {"-r", "--range"}, description = "Key range")
-    private int range = 1_000_000;
+    public int range = 1_000_000;
+
+    /** */
+    @Parameter(names = {"-pa", "--preloadAmount"}, description = "Data pre-loading amount for load tests")
+    public int preloadAmount = 500_000;
 
     /** */
     @Parameter(names = {"-j", "--jobs"}, description = "Number of jobs for compute benchmarks")
@@ -136,6 +148,28 @@ public class IgniteBenchmarkArguments {
     @Parameter(names = {"-kpt", "--keysPerThread"}, description = "Use not intersecting keys in putAll benchmark")
     private boolean keysPerThread;
 
+    /** */
+    @Parameter(names = {"-pp", "--printPartitionStats"}, description = "Print partition statistics")
+    private boolean printPartStats;
+
+    /** */
+    @Parameter(names = {"-ltops", "--allowedLoadTestOperations"}, variableArity = true, description = "List of enabled load test operations")
+    private List<String> allowedLoadTestOps = new ArrayList<>();
+
+    /**
+     * @return List of enabled load test operations.
+     */
+    public List<String> allowedLoadTestOps() {
+        return allowedLoadTestOps;
+    }
+
+    /**
+     * @return If {@code true} when need to print partition statistics.
+     */
+    public boolean printPartitionStatistics() {
+        return printPartStats;
+    }
+
     /**
      * @return JDBC url.
      */
@@ -249,6 +283,13 @@ public class IgniteBenchmarkArguments {
     }
 
     /**
+     * @return Preload key range, from {@code 0} to this number.
+     */
+    public int preloadAmount() {
+        return preloadAmount;
+    }
+
+    /**
      * @return Configuration file.
      */
     public String configuration() {
@@ -256,6 +297,13 @@ public class IgniteBenchmarkArguments {
     }
 
     /**
+     * @return File with predefined SQL queries.
+     */
+    public String loadTestQueriesFile() {
+        return loadTestQueriesFile;
+    }
+
+    /**
      * @return Number of jobs
      */
     public int jobs() {

http://git-wip-us.apache.org/repos/asf/ignite/blob/4670bc53/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 33656fb..eed4450 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
@@ -136,6 +136,8 @@ public class IgniteNode implements BenchmarkServer {
             cc.setWriteThrough(args.isStoreEnabled());
 
             cc.setWriteBehindEnabled(args.isWriteBehind());
+
+            BenchmarkUtils.println(cfg, "Cache configured with the following parameters: " + cc);
         }
 
         TransactionConfiguration tc = c.getTransactionConfiguration();

http://git-wip-us.apache.org/repos/asf/ignite/blob/4670bc53/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteCacheAbstractBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteCacheAbstractBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteCacheAbstractBenchmark.java
index 3efa4a5..da5cb1d 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteCacheAbstractBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteCacheAbstractBenchmark.java
@@ -17,9 +17,19 @@
 
 package org.apache.ignite.yardstick.cache;
 
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 import java.util.concurrent.ThreadLocalRandom;
 import java.util.concurrent.atomic.AtomicInteger;
 import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.util.typedef.T2;
+import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.yardstick.IgniteAbstractBenchmark;
 import org.yardstickframework.BenchmarkConfiguration;
 import org.yardstickframework.BenchmarkUtils;
@@ -42,6 +52,55 @@ public abstract class IgniteCacheAbstractBenchmark<K, V> extends IgniteAbstractB
         super.setUp(cfg);
 
         cache = cache();
+
+        BenchmarkUtils.println(cfg, "Benchmark setUp [name=" + getClass().getSimpleName() +
+            ", cacheName="+ cache.getName() +
+            ", cacheCfg=" + cache.getConfiguration(CacheConfiguration.class) + ']');
+
+        if (args.printPartitionStatistics()) {
+            Map<ClusterNode, T2<List<Integer>, List<Integer>>> parts = new HashMap<>();
+
+            for (ClusterNode node : ignite().cluster().nodes())
+                parts.put(node,
+                    new T2<List<Integer>, List<Integer>>(new ArrayList<Integer>(), new ArrayList<Integer>()));
+
+            U.sleep(5000);
+
+            Affinity<Object> aff = ignite().affinity(cache.getName());
+
+            for (int p = 0; p < aff.partitions(); p++) {
+                Collection<ClusterNode> nodes = aff.mapPartitionToPrimaryAndBackups(p);
+
+                boolean primary = true;
+
+                for (ClusterNode node : nodes) {
+                    if (primary) {
+                        parts.get(node).get1().add(p);
+
+                        primary = false;
+                    }
+                    else
+                        parts.get(node).get2().add(p);
+                }
+            }
+
+            BenchmarkUtils.println(cfg, "Partition stats. [cacheName: "+ cache.getName() +", topVer: "
+                + ignite().cluster().topologyVersion() + "]");
+            BenchmarkUtils.println(cfg, "(Node id,  Number of Primary, Percent, Number of Backup, Percent, Total, Percent)");
+
+            for (Map.Entry<ClusterNode, T2<List<Integer>, List<Integer>>> e : parts.entrySet()) {
+                List<Integer> primary = e.getValue().get1();
+                List<Integer> backup = e.getValue().get2();
+
+                BenchmarkUtils.println(cfg, e.getKey().id() + "  "
+                    + primary.size() + "  " + primary.size() * 1. /aff.partitions() + "  "
+                    + backup.size() + "  "
+                    + backup.size() * 1. / (aff.partitions() * (args.backups() == 0 ? 1 : args.backups())) + "  "
+                    + (primary.size() + backup.size()) + "  "
+                    + (primary.size() + backup.size() * 1.) / (aff.partitions() * args.backups() + aff.partitions())
+                );
+            }
+        }
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/4670bc53/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteGetTxBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteGetTxBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteGetTxBenchmark.java
new file mode 100644
index 0000000..fbb73e2
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteGetTxBenchmark.java
@@ -0,0 +1,30 @@
+/*
+ * 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.cache;
+
+import org.apache.ignite.IgniteCache;
+
+/**
+ *
+ */
+public class IgniteGetTxBenchmark extends IgniteGetBenchmark {
+    /** {@inheritDoc} */
+    @Override protected IgniteCache<Integer, Object> cache() {
+        return ignite().cache("tx");
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/4670bc53/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteInvokeBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteInvokeBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteInvokeBenchmark.java
new file mode 100644
index 0000000..a1e80f0
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteInvokeBenchmark.java
@@ -0,0 +1,65 @@
+/*
+ * 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.cache;
+
+import java.util.Map;
+import javax.cache.processor.MutableEntry;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheEntryProcessor;
+import org.apache.ignite.yardstick.cache.model.SampleValue;
+
+/**
+ * Ignite benchmark that performs invoke operations.
+ */
+public class IgniteInvokeBenchmark extends IgniteCacheAbstractBenchmark<Integer, Object> {
+    /** {@inheritDoc} */
+    @Override public boolean test(Map<Object, Object> ctx) throws Exception {
+        int key = nextRandom(args.range());
+
+        cache.invoke(key, new SetValueEntryProcessor(new SampleValue(key)));
+
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteCache<Integer, Object> cache() {
+        return ignite().cache("atomic");
+    }
+
+    /**
+     *
+     */
+    public static class SetValueEntryProcessor implements CacheEntryProcessor<Integer, Object, Object> {
+        /** */
+        private Object val;
+
+        /**
+         * @param val Value.
+         */
+        public SetValueEntryProcessor(Object val) {
+            this.val = val;
+        }
+
+        /** {@inheritDoc} */
+        @Override public Object process(MutableEntry<Integer, Object> entry, Object... args) {
+            entry.setValue(val);
+
+            return null;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/4670bc53/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteInvokeTxBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteInvokeTxBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteInvokeTxBenchmark.java
new file mode 100644
index 0000000..8f05598
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteInvokeTxBenchmark.java
@@ -0,0 +1,30 @@
+/*
+ * 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.cache;
+
+import org.apache.ignite.IgniteCache;
+
+/**
+ * Ignite benchmark that performs invoke operations.
+ */
+public class IgniteInvokeTxBenchmark extends IgniteInvokeBenchmark {
+    /** {@inheritDoc} */
+    @Override protected IgniteCache<Integer, Object> cache() {
+        return ignite().cache("tx");
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/4670bc53/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/IgniteCacheRandomOperationBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/IgniteCacheRandomOperationBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/IgniteCacheRandomOperationBenchmark.java
new file mode 100644
index 0000000..e676b38
--- /dev/null
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/IgniteCacheRandomOperationBenchmark.java
@@ -0,0 +1,1160 @@
+/*
+ * 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.cache.load;
+
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.TreeSet;
+import java.util.UUID;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.concurrent.atomic.AtomicLong;
+import javax.cache.configuration.FactoryBuilder;
+import javax.cache.event.CacheEntryEvent;
+import javax.cache.event.CacheEntryListenerException;
+import javax.cache.event.CacheEntryUpdatedListener;
+import javax.cache.processor.EntryProcessor;
+import javax.cache.processor.MutableEntry;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCompute;
+import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheEntryEventSerializableFilter;
+import org.apache.ignite.cache.CacheMemoryMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cache.CacheTypeMetadata;
+import org.apache.ignite.cache.QueryEntity;
+import org.apache.ignite.cache.QueryIndex;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cache.query.ContinuousQuery;
+import org.apache.ignite.cache.query.Query;
+import org.apache.ignite.cache.query.QueryCursor;
+import org.apache.ignite.cache.query.ScanQuery;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
+import org.apache.ignite.cache.query.SqlQuery;
+import org.apache.ignite.cluster.ClusterGroup;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.lang.IgniteBiPredicate;
+import org.apache.ignite.lang.IgniteRunnable;
+import org.apache.ignite.resources.IgniteInstanceResource;
+import org.apache.ignite.transactions.TransactionConcurrency;
+import org.apache.ignite.transactions.TransactionIsolation;
+import org.apache.ignite.yardstick.IgniteAbstractBenchmark;
+import org.apache.ignite.yardstick.IgniteBenchmarkUtils;
+import org.apache.ignite.yardstick.cache.load.model.ModelUtil;
+import org.jetbrains.annotations.NotNull;
+import org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
+import org.yardstickframework.BenchmarkConfiguration;
+import org.yardstickframework.BenchmarkUtils;
+
+/**
+ * Ignite cache random operation benchmark.
+ */
+public class IgniteCacheRandomOperationBenchmark extends IgniteAbstractBenchmark {
+    /** */
+    public static final int operations = Operation.values().length;
+
+    /***/
+    public static final int CONTINUOUS_QUERY_PER_CACHE = 3;
+
+    /** Scan query predicate. */
+    private static BenchmarkIgniteBiPredicate igniteBiPred = new BenchmarkIgniteBiPredicate();
+
+    /** Amount partitions. */
+    private static final int SCAN_QUERY_PARTITION_AMOUNT = 10;
+
+    /** List off all available cache. */
+    private List<IgniteCache<Object, Object>> availableCaches;
+
+    /** List of available transactional cache. */
+    private List<IgniteCache<Object, Object>> txCaches;
+
+    /** List of affinity cache. */
+    private List<IgniteCache<Object, Object>> affCaches;
+
+    /** Map cache name on key classes. */
+    private Map<String, Class[]> keysCacheClasses;
+
+    /** Map cache name on value classes. */
+    private Map<String, Class[]> valuesCacheClasses;
+
+    /** List of query descriptors by cache names. */
+    private Map<String, List<SqlCacheDescriptor>> cacheSqlDescriptors;
+
+    /** List of SQL queries. */
+    private List<String> queries;
+
+    /** List of allowed cache operations which will be executed. */
+    private List<Operation> allowedLoadTestOps;
+
+    /**
+     * Replace value entry processor.
+     */
+    private BenchmarkReplaceValueEntryProcessor replaceEntryProc;
+
+    /**
+     * Remove entry processor.
+     */
+    private BenchmarkRemoveEntryProcessor rmvEntryProc;
+
+    /**
+     * Map of statistic information.
+     */
+    private Map<String, AtomicLong> operationStatistics;
+
+    /** {@inheritDoc} */
+    @Override public void setUp(BenchmarkConfiguration cfg) throws Exception {
+        super.setUp(cfg);
+
+        searchCache();
+
+        preLoading();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onException(Throwable e) {
+        BenchmarkUtils.errorHelp(cfg, "The benchmark of random operation failed.");
+        super.onException(e);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean test(Map<Object, Object> map) throws Exception {
+        if (nextBoolean()) {
+            executeInTransaction(map);
+
+            executeOutOfTx(map, true);
+        }
+        else
+            executeOutOfTx(map, false);
+
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void tearDown() throws Exception {
+        try {
+            BenchmarkUtils.println("Benchmark statistics");
+
+            for (String cacheName : ignite().cacheNames()) {
+                BenchmarkUtils.println(String.format("Operations over cache '%s'", cacheName));
+
+                for (Operation op : Operation.values()) {
+                    BenchmarkUtils.println(cfg, String.format("%s: %s", op,
+                        operationStatistics.get(op + "_" + cacheName)));
+                }
+            }
+        }
+        finally {
+            super.tearDown();
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    private void searchCache() throws Exception {
+        availableCaches = new ArrayList<>(ignite().cacheNames().size());
+        txCaches = new ArrayList<>();
+        affCaches = new ArrayList<>();
+        keysCacheClasses = new HashMap<>();
+        valuesCacheClasses = new HashMap<>();
+        replaceEntryProc = new BenchmarkReplaceValueEntryProcessor(null);
+        rmvEntryProc = new BenchmarkRemoveEntryProcessor();
+        cacheSqlDescriptors = new HashMap<>();
+        operationStatistics = new HashMap<>();
+
+        loadQueries();
+
+        loadAllowedOperations();
+
+        for (String cacheName : ignite().cacheNames()) {
+            IgniteCache<Object, Object> cache = ignite().cache(cacheName);
+
+            for (Operation op : Operation.values())
+                operationStatistics.put(op + "_" + cacheName, new AtomicLong(0));
+
+            CacheConfiguration configuration = cache.getConfiguration(CacheConfiguration.class);
+
+            if (isClassDefinedInConfig(configuration)) {
+                if (configuration.getMemoryMode() == CacheMemoryMode.OFFHEAP_TIERED &&
+                    configuration.getQueryEntities().size() > 2) {
+                    throw new IgniteException("Off-heap mode is unsupported by the load test due to bugs IGNITE-2982" +
+                        " and IGNITE-2997");
+                }
+
+                ArrayList<Class> keys = new ArrayList<>();
+                ArrayList<Class> values = new ArrayList<>();
+
+                if (configuration.getQueryEntities() != null) {
+                    Collection<QueryEntity> entries = configuration.getQueryEntities();
+
+                    for (QueryEntity queryEntity : entries) {
+                        if (queryEntity.getKeyType() != null) {
+                            Class keyCls = Class.forName(queryEntity.getKeyType());
+
+                            if (ModelUtil.canCreateInstance(keyCls))
+                                keys.add(keyCls);
+                            else
+                                throw new IgniteException("Class is unknown for the load test. Make sure you " +
+                                    "specified its full name [clsName=" + queryEntity.getKeyType() + ']');
+                        }
+
+                        if (queryEntity.getValueType() != null) {
+                            Class valCls = Class.forName(queryEntity.getValueType());
+
+                            if (ModelUtil.canCreateInstance(valCls))
+                                values.add(valCls);
+                            else
+                                throw new IgniteException("Class is unknown for the load test. Make sure you " +
+                                    "specified its full name [clsName=" + queryEntity.getKeyType() + ']');
+
+                            cofigureCacheSqlDescriptor(cacheName, queryEntity, valCls);
+                        }
+                    }
+                }
+
+                if (configuration.getTypeMetadata() != null) {
+                    Collection<CacheTypeMetadata> entries = configuration.getTypeMetadata();
+
+                    for (CacheTypeMetadata cacheTypeMetadata : entries) {
+                        if (cacheTypeMetadata.getKeyType() != null) {
+                            Class keyCls = Class.forName(cacheTypeMetadata.getKeyType());
+
+                            if (ModelUtil.canCreateInstance(keyCls))
+                                keys.add(keyCls);
+                            else
+                                throw new IgniteException("Class is unknown for the load test. Make sure you " +
+                                    "specified its full name [clsName=" + cacheTypeMetadata.getKeyType() + ']');
+                        }
+
+                        if (cacheTypeMetadata.getValueType() != null) {
+                            Class valCls = Class.forName(cacheTypeMetadata.getValueType());
+
+                            if (ModelUtil.canCreateInstance(valCls))
+                                values.add(valCls);
+                            else
+                                throw new IgniteException("Class is unknown for the load test. Make sure you " +
+                                    "specified its full name [clsName=" + cacheTypeMetadata.getKeyType() + ']');
+                        }
+                    }
+                }
+
+                if (keys.isEmpty() || values.isEmpty())
+                    continue;
+
+                keysCacheClasses.put(cacheName, keys.toArray(new Class[] {}));
+
+                valuesCacheClasses.put(cacheName, values.toArray(new Class[] {}));
+            }
+            else
+                keysCacheClasses.put(cacheName, new Class[] {randomKeyClass(cacheName)});
+
+            valuesCacheClasses.put(cacheName, determineValueClasses(cacheName));
+
+            if (configuration.getCacheMode() != CacheMode.LOCAL)
+                affCaches.add(cache);
+
+            if (configuration.getAtomicityMode() == CacheAtomicityMode.TRANSACTIONAL)
+                txCaches.add(cache);
+
+            availableCaches.add(cache);
+        }
+    }
+
+    /**
+     * Load allowed operation from parameters.
+     */
+    private void loadAllowedOperations() {
+        allowedLoadTestOps = new ArrayList<>();
+        if (args.allowedLoadTestOps().isEmpty())
+            Collections.addAll(allowedLoadTestOps, Operation.values());
+        else
+            for (String opName : args.allowedLoadTestOps())
+                allowedLoadTestOps.add(Operation.valueOf(opName.toUpperCase()));
+    }
+
+    /**
+     * Load query from file.
+     *
+     * @throws Exception If fail.
+     */
+    private void loadQueries() throws Exception {
+        queries = new ArrayList<>();
+
+        if (args.loadTestQueriesFile() != null) {
+            try (FileReader fr = new FileReader(args.loadTestQueriesFile())) {
+                try (BufferedReader br = new BufferedReader(fr)) {
+                    String line;
+                    while ((line = br.readLine()) != null) {
+                        if (line.trim().isEmpty())
+                            continue;
+
+                        queries.add(line.trim());
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * @param cacheName Ignite cache name.
+     * @param qryEntity Query entry.
+     * @param valCls Class of value.
+     * @throws ClassNotFoundException If fail.
+     */
+    private void cofigureCacheSqlDescriptor(String cacheName, QueryEntity qryEntity, Class valCls)
+        throws ClassNotFoundException {
+        List<SqlCacheDescriptor> descs = cacheSqlDescriptors.get(cacheName);
+
+        if (descs == null) {
+            descs = new ArrayList<>();
+
+            cacheSqlDescriptors.put(cacheName, descs);
+        }
+
+        Map<String, Class> indexedFields = new HashMap<>();
+
+        for (QueryIndex index : qryEntity.getIndexes()) {
+            for (String iField : index.getFieldNames()) {
+                indexedFields.put(iField,
+                    Class.forName(qryEntity.getFields().get(iField)));
+            }
+        }
+
+        descs.add(new SqlCacheDescriptor(valCls, qryEntity.getFields().keySet(),
+            indexedFields));
+    }
+
+    /**
+     * @param configuration Ignite cache configuration.
+     * @return True if defined.
+     */
+    private boolean isClassDefinedInConfig(CacheConfiguration configuration) {
+        return (configuration.getIndexedTypes() != null && configuration.getIndexedTypes().length > 0)
+            || !CollectionUtils.isEmpty(configuration.getQueryEntities())
+            || !CollectionUtils.isEmpty(configuration.getTypeMetadata());
+    }
+
+    /**
+     * @throws Exception If fail.
+     */
+    private void preLoading() throws Exception {
+        if (args.preloadAmount() > args.range())
+            throw new IllegalArgumentException("Preloading amount (\"-pa\", \"--preloadAmount\") must by less then the" +
+                " range (\"-r\", \"--range\").");
+
+        Thread[] threads = new Thread[availableCaches.size()];
+
+        for (int i = 0; i < availableCaches.size(); i++) {
+            final String cacheName = availableCaches.get(i).getName();
+
+            threads[i] = new Thread() {
+                @Override public void run() {
+                    try (IgniteDataStreamer<Object, Object> dataLdr = ignite().dataStreamer(cacheName)) {
+                        for (int i = 0; i < args.preloadAmount() && !isInterrupted(); i++)
+                            dataLdr.addData(createRandomKey(i, cacheName), createRandomValue(i, cacheName));
+                    }
+                }
+            };
+
+            threads[i].start();
+        }
+
+        for (Thread thread : threads)
+            thread.join();
+    }
+
+    /**
+     * Building a map that contains mapping of node ID to a list of partitions stored on the node.
+     *
+     * @param cacheName Name of Ignite cache.
+     * @return Node to partitions map.
+     */
+    private Map<UUID, List<Integer>> personCachePartitions(String cacheName) {
+        // Getting affinity for person cache.
+        Affinity<Object> affinity = ignite().affinity(cacheName);
+
+        // Building a list of all partitions numbers.
+        List<Integer> rndParts = new ArrayList<>(10);
+
+        if (affinity.partitions() <= SCAN_QUERY_PARTITION_AMOUNT)
+            for (int i = 0; i < affinity.partitions(); i++)
+                rndParts.add(i);
+        else {
+            for (int i = 0; i < SCAN_QUERY_PARTITION_AMOUNT; i++) {
+                int partNum;
+
+                do
+                    partNum = nextRandom(affinity.partitions());
+                while (rndParts.contains(partNum));
+
+                rndParts.add(partNum);
+            }
+        }
+
+        Collections.sort(rndParts);
+
+        // Getting partition to node mapping.
+        Map<Integer, ClusterNode> partPerNodes = affinity.mapPartitionsToNodes(rndParts);
+
+        // Building node to partitions mapping.
+        Map<UUID, List<Integer>> nodesToPart = new HashMap<>();
+
+        for (Map.Entry<Integer, ClusterNode> entry : partPerNodes.entrySet()) {
+            List<Integer> nodeParts = nodesToPart.get(entry.getValue().id());
+
+            if (nodeParts == null) {
+                nodeParts = new ArrayList<>();
+
+                nodesToPart.put(entry.getValue().id(), nodeParts);
+            }
+
+            nodeParts.add(entry.getKey());
+        }
+
+        return nodesToPart;
+    }
+
+    /**
+     * @param id Object identifier.
+     * @param cacheName Name of Ignite cache.
+     * @return Random object.
+     */
+    private Object createRandomKey(int id, String cacheName) {
+        Class clazz = randomKeyClass(cacheName);
+
+        return ModelUtil.create(clazz, id);
+    }
+
+    /**
+     * @param cacheName Ignite cache name.
+     * @return Random key class.
+     */
+    private Class randomKeyClass(String cacheName) {
+        Class[] keys = keysCacheClasses.containsKey(cacheName)
+            ? keysCacheClasses.get(cacheName) : ModelUtil.keyClasses();
+
+        return keys[nextRandom(keys.length)];
+    }
+
+    /**
+     * @param cacheName Cache name.
+     * @return Set classes for cache.
+     */
+    private Class[] determineValueClasses(@NotNull String cacheName) {
+        return cacheName.toLowerCase().contains("fat-values") ? ModelUtil.fatValueClasses() :
+            ModelUtil.simpleValueClasses();
+    }
+
+    /**
+     * @param id Object identifier.
+     * @param cacheName Name of Ignite cache.
+     * @return Random object.
+     */
+    private Object createRandomValue(int id, String cacheName) {
+        Class clazz = randomValueClass(cacheName);
+
+        return ModelUtil.create(clazz, id);
+    }
+
+    /**
+     * @param cacheName Ignite cache name.
+     * @return Random value class.
+     */
+    private Class randomValueClass(String cacheName) {
+        Class[] values = valuesCacheClasses.containsKey(cacheName)
+            ? valuesCacheClasses.get(cacheName) : ModelUtil.valueClasses();
+
+        return values[nextRandom(values.length)];
+    }
+
+    /**
+     * @param map Parameters map.
+     * @param withoutTransactionCache Without transaction cache.
+     * @throws Exception If fail.
+     */
+    private void executeOutOfTx(Map<Object, Object> map, boolean withoutTransactionCache) throws Exception {
+        for (IgniteCache<Object, Object> cache : availableCaches) {
+            if (withoutTransactionCache && txCaches.contains(cache))
+                continue;
+
+            executeRandomOperation(map, cache);
+        }
+    }
+
+    /**
+     * @param map Parameters map.
+     * @param cache Ignite cache.
+     * @throws Exception If fail.
+     */
+    private void executeRandomOperation(Map<Object, Object> map, IgniteCache<Object, Object> cache) throws Exception {
+        Operation op = nextRandomOperation();
+
+        switch (op) {
+            case PUT:
+                doPut(cache);
+                break;
+
+            case PUT_ALL:
+                doPutAll(cache);
+                break;
+
+            case GET:
+                doGet(cache);
+                break;
+
+            case GET_ALL:
+                doGetAll(cache);
+                break;
+
+            case INVOKE:
+                doInvoke(cache);
+                break;
+
+            case INVOKE_ALL:
+                doInvokeAll(cache);
+                break;
+
+            case REMOVE:
+                doRemove(cache);
+                break;
+
+            case REMOVE_ALL:
+                doRemoveAll(cache);
+                break;
+
+            case PUT_IF_ABSENT:
+                doPutIfAbsent(cache);
+                break;
+
+            case REPLACE:
+                doReplace(cache);
+                break;
+
+            case SCAN_QUERY:
+                doScanQuery(cache);
+                break;
+
+            case SQL_QUERY:
+                doSqlQuery(cache);
+                break;
+
+            case CONTINUOUS_QUERY:
+                doContinuousQuery(cache, map);
+        }
+        storeStatistics(cache.getName(), map, op);
+    }
+
+    /**
+     * @return Operation.
+     */
+    @NotNull private Operation nextRandomOperation() {
+        return allowedLoadTestOps.get(nextRandom(allowedLoadTestOps.size()));
+    }
+
+    /**
+     * @param cacheName Ignite cache name.
+     * @param map Parameters map.
+     * @param op Operation.
+     */
+    private void storeStatistics(String cacheName, Map<Object, Object> map, Operation op) {
+        String opCacheKey = op + "_" + cacheName;
+
+        Long opAmount = (Long)map.get("amount");
+
+        opAmount = opAmount == null ? 1L : opAmount + 1;
+
+        Integer opCacheCnt = (Integer)map.get(opCacheKey);
+
+        opCacheCnt = opCacheCnt == null ? 1 : opCacheCnt + 1;
+
+        if (opAmount % 100 == 0)
+            updateStat(map);
+        else
+            map.put(opCacheKey, opCacheCnt);
+
+        map.put("amount", opAmount);
+    }
+
+    /**
+     * @param map Parameters map.
+     */
+    private void updateStat(Map<Object, Object> map) {
+        for (Operation op: Operation.values())
+            for (String cacheName: ignite().cacheNames()) {
+                String opCacheKey = op + "_" + cacheName;
+
+                Integer val = (Integer)map.get(opCacheKey);
+
+                if (val != null) {
+                    operationStatistics.get(opCacheKey).addAndGet(val.longValue());
+
+                    map.put(opCacheKey, 0);
+                }
+
+            }
+    }
+
+    /**
+     * Execute operations in transaction.
+     * @param map Parameters map.
+     * @throws Exception if fail.
+     */
+    private void executeInTransaction(final Map<Object, Object> map) throws Exception {
+        IgniteBenchmarkUtils.doInTransaction(ignite().transactions(),
+            TransactionConcurrency.fromOrdinal(nextRandom(TransactionConcurrency.values().length)),
+            TransactionIsolation.fromOrdinal(nextRandom(TransactionIsolation.values().length)),
+
+            new Callable<Object>() {
+                @Override public Object call() throws Exception {
+                    for (IgniteCache<Object, Object> cache : txCaches)
+                        if (nextBoolean())
+                            executeRandomOperation(map, cache);
+
+                    return null;
+                }
+            });
+    }
+
+    /**
+     * @param cache Ignite cache.
+     * @throws Exception If failed.
+     */
+    private void doPut(IgniteCache<Object, Object> cache) throws Exception {
+        int i = nextRandom(args.range());
+
+        cache.put(createRandomKey(i, cache.getName()), createRandomValue(i, cache.getName()));
+    }
+
+    /**
+     * @param cache Ignite cache.
+     * @throws Exception If failed.
+     */
+    private void doPutAll(IgniteCache<Object, Object> cache) throws Exception {
+        Map<Object, Object> putMap = new TreeMap<>();
+
+        Class keyCass = randomKeyClass(cache.getName());
+
+        for (int cnt = 0; cnt < args.batch(); cnt++) {
+            int i = nextRandom(args.range());
+
+            putMap.put(ModelUtil.create(keyCass, i), createRandomValue(i, cache.getName()));
+        }
+
+        cache.putAll(putMap);
+    }
+
+    /**
+     * @param cache Ignite cache.
+     * @throws Exception If failed.
+     */
+    private void doGet(IgniteCache<Object, Object> cache) throws Exception {
+        int i = nextRandom(args.range());
+
+        cache.get(createRandomKey(i, cache.getName()));
+    }
+
+    /**
+     * @param cache Ignite cache.
+     * @throws Exception If failed.
+     */
+    private void doGetAll(IgniteCache<Object, Object> cache) throws Exception {
+        Set<Object> keys = new TreeSet<>();
+
+        Class keyCls = randomKeyClass(cache.getName());
+
+        for (int cnt = 0; cnt < args.batch(); cnt++) {
+            int i = nextRandom(args.range());
+
+            keys.add(ModelUtil.create(keyCls, i));
+        }
+
+        cache.getAll(keys);
+    }
+
+    /**
+     * @param cache Ignite cache.
+     * @throws Exception If failed.
+     */
+    private void doInvoke(final IgniteCache<Object, Object> cache) throws Exception {
+        final int i = nextRandom(args.range());
+
+        if (nextBoolean())
+            cache.invoke(createRandomKey(i, cache.getName()), replaceEntryProc,
+                createRandomValue(i + 1, cache.getName()));
+        else
+            cache.invoke(createRandomKey(i, cache.getName()), rmvEntryProc);
+
+    }
+
+    /**
+     * Entry processor for local benchmark replace value task.
+     */
+    private static class BenchmarkReplaceValueEntryProcessor implements EntryProcessor<Object, Object, Object>, Serializable {
+        /**
+         * New value for update during process by default.
+         */
+        private Object newVal;
+
+        /**
+         * @param newVal default new value
+         */
+        private BenchmarkReplaceValueEntryProcessor(Object newVal) {
+            this.newVal = newVal;
+        }
+
+        /** {@inheritDoc} */
+        @Override public Object process(MutableEntry<Object, Object> entry, Object... arguments) {
+            Object newVal = arguments == null || arguments[0] == null ? this.newVal : arguments[0];
+
+            Object oldVal = entry.getValue();
+
+            entry.setValue(newVal);
+
+            return oldVal;
+        }
+    }
+
+    /**
+     * Entry processor for local benchmark remove entry task.
+     */
+    private static class BenchmarkRemoveEntryProcessor implements EntryProcessor<Object, Object, Object>, Serializable {
+        /** {@inheritDoc} */
+        @Override public Object process(MutableEntry<Object, Object> entry, Object... arguments) {
+            Object oldVal = entry.getValue();
+
+            entry.remove();
+
+            return oldVal;
+        }
+    }
+
+    /**
+     * @param cache Ignite cache.
+     * @throws Exception If failed.
+     */
+    private void doInvokeAll(IgniteCache<Object, Object> cache) throws Exception {
+        Map<Object, EntryProcessor<Object, Object, Object>> map = new TreeMap<>();
+
+        Class keyCls = randomKeyClass(cache.getName());
+
+        for (int cnt = 0; cnt < args.batch(); cnt++) {
+            int i = nextRandom(args.range());
+
+            Object key = ModelUtil.create(keyCls, i);
+
+            if (nextBoolean())
+                map.put(key,
+                    new BenchmarkReplaceValueEntryProcessor(createRandomValue(i + 1, cache.getName())));
+            else
+                map.put(key, rmvEntryProc);
+        }
+
+        cache.invokeAll(map);
+    }
+
+    /**
+     * @param cache Ignite cache.
+     * @throws Exception If failed.
+     */
+    private void doRemove(IgniteCache<Object, Object> cache) throws Exception {
+        int i = nextRandom(args.range());
+
+        cache.remove(createRandomKey(i, cache.getName()));
+    }
+
+    /**
+     * @param cache Ignite cache.
+     * @throws Exception If failed.
+     */
+    private void doRemoveAll(IgniteCache<Object, Object> cache) throws Exception {
+        Set<Object> keys = new TreeSet<>();
+
+        Class keyCls = randomKeyClass(cache.getName());
+
+        for (int cnt = 0; cnt < args.batch(); cnt++) {
+            int i = nextRandom(args.range());
+
+            keys.add(ModelUtil.create(keyCls, i));
+        }
+
+        cache.removeAll(keys);
+    }
+
+    /**
+     * @param cache Ignite cache.
+     * @throws Exception If failed.
+     */
+    private void doPutIfAbsent(IgniteCache<Object, Object> cache) throws Exception {
+        int i = nextRandom(args.range());
+
+        cache.putIfAbsent(createRandomKey(i, cache.getName()), createRandomValue(i, cache.getName()));
+    }
+
+    /**
+     * @param cache Ignite cache.
+     * @throws Exception If failed.
+     */
+    private void doReplace(IgniteCache<Object, Object> cache) throws Exception {
+        int i = nextRandom(args.range());
+
+        cache.replace(createRandomKey(i, cache.getName()),
+            createRandomValue(i, cache.getName()),
+            createRandomValue(i + 1, cache.getName()));
+    }
+
+    /**
+     * @param cache Ignite cache.
+     * @throws Exception If failed.
+     */
+    private void doScanQuery(IgniteCache<Object, Object> cache) throws Exception {
+        if (!affCaches.contains(cache))
+            return;
+
+        Map<UUID, List<Integer>> partitionsMap = personCachePartitions(cache.getName());
+
+        ScanQueryBroadcastClosure c = new ScanQueryBroadcastClosure(cache.getName(), partitionsMap);
+
+        ClusterGroup clusterGrp = ignite().cluster().forNodeIds(partitionsMap.keySet());
+
+        IgniteCompute compute = ignite().compute(clusterGrp);
+
+        compute.broadcast(c);
+    }
+
+    /**
+     * @param cache Ignite cache.
+     * @throws Exception If failed.
+     */
+    private void doSqlQuery(IgniteCache<Object, Object> cache) throws Exception {
+        List<SqlCacheDescriptor> descriptors = cacheSqlDescriptors.get(cache.getName());
+
+        if (descriptors != null && !descriptors.isEmpty()) {
+            SqlCacheDescriptor randomDesc = descriptors.get(nextRandom(descriptors.size()));
+
+            int id = nextRandom(args.range());
+
+            Query sq;
+            if (queries.isEmpty())
+                sq = nextBoolean() ? randomDesc.getSqlQuery(id) : randomDesc.getSqlFieldsQuery(id);
+            else
+                sq = new SqlFieldsQuery(queries.get(nextRandom(queries.size())));
+
+            try (QueryCursor cursor = cache.query(sq)) {
+                for (Object obj : cursor) {
+                    // No-op.
+                }
+            }
+        }
+    }
+
+    /**
+     * @param cache Ignite cache.
+     * @param map Parameters map.
+     * @throws Exception If failed.
+     */
+    private void doContinuousQuery(IgniteCache<Object, Object> cache, Map<Object, Object> map) throws Exception {
+        List<QueryCursor> cursors = (ArrayList<QueryCursor>)map.get(cache.getName());
+
+        if (cursors == null) {
+            cursors = new ArrayList<>(CONTINUOUS_QUERY_PER_CACHE);
+            map.put(cache.getName(), cursors);
+        }
+
+        if (cursors.size() == CONTINUOUS_QUERY_PER_CACHE) {
+            QueryCursor cursor = cursors.get(nextRandom(cursors.size()));
+            cursor.close();
+            cursors.remove(cursor);
+        }
+
+        ContinuousQuery qry = new ContinuousQuery();
+
+        qry.setLocalListener(new ContinuousQueryUpdater());
+
+        qry.setRemoteFilterFactory(FactoryBuilder.factoryOf(new ContinuousQueryFilter()));
+
+        cursors.add(cache.query(qry));
+    }
+
+    /**
+     * @return Nex random boolean value.
+     */
+    private boolean nextBoolean() {
+        return ThreadLocalRandom.current().nextBoolean();
+    }
+
+    /**
+     * Continuous query updater class.
+     */
+    private static class ContinuousQueryUpdater implements CacheEntryUpdatedListener, Serializable {
+
+        /** {@inheritDoc} */
+        @Override public void onUpdated(Iterable iterable) throws CacheEntryListenerException {
+            for (Object o : iterable) {
+                // No-op.
+            }
+        }
+    }
+
+    /**
+     * Continuous query filter class.
+     */
+    private static class ContinuousQueryFilter implements CacheEntryEventSerializableFilter, Serializable {
+        /** */
+        private boolean flag = true;
+
+        /** {@inheritDoc} */
+        @Override public boolean evaluate(CacheEntryEvent evt) throws CacheEntryListenerException {
+            return flag =! flag;
+        }
+    }
+
+    /**
+     * Closure for scan query executing.
+     */
+    private static class ScanQueryBroadcastClosure implements IgniteRunnable {
+        /**
+         * Ignite node.
+         */
+        @IgniteInstanceResource
+        private Ignite node;
+
+        /**
+         * Information about partition.
+         */
+        private Map<UUID, List<Integer>> cachePart;
+
+        /**
+         * Name of Ignite cache.
+         */
+        private String cacheName;
+
+        /**
+         * @param cacheName Name of Ignite cache.
+         * @param cachePart Partition by node for Ignite cache.
+         */
+        private ScanQueryBroadcastClosure(String cacheName, Map<UUID, List<Integer>> cachePart) {
+            this.cachePart = cachePart;
+            this.cacheName = cacheName;
+        }
+
+        /** {@inheritDoc} */
+        @Override public void run() {
+            IgniteCache cache = node.cache(cacheName);
+
+            // Getting a list of the partitions owned by this node.
+            List<Integer> myPartitions = cachePart.get(node.cluster().localNode().id());
+
+            for (Integer part : myPartitions) {
+
+                ScanQuery scanQry = new ScanQuery();
+
+                scanQry.setPartition(part);
+
+                scanQry.setFilter(igniteBiPred);
+
+                try (QueryCursor cursor = cache.query(scanQry)) {
+                    for (Object obj : cursor) {
+                        // No-op.
+                    }
+                }
+
+            }
+        }
+    }
+
+    /**
+     * Scan query predicate class.
+     */
+    private static class BenchmarkIgniteBiPredicate implements IgniteBiPredicate {
+        /**
+         * @param key Cache key.
+         * @param val Cache value.
+         * @return true If is hit.
+         */
+        @Override public boolean apply(Object key, Object val) {
+            return true;
+        }
+    }
+
+    /**
+     * Query descriptor.
+     */
+    private static class SqlCacheDescriptor {
+        /**
+         * Class of value.
+         */
+        private Class valCls;
+
+        /**
+         * Select fields.
+         */
+        private Set<String> fields;
+
+        /**
+         * Indexed fields.
+         */
+        private Map<String, Class> indexedFieldsByCls;
+
+        /**
+         * @param valCls Class of value.
+         * @param fields All select fields.
+         * @param indexedFieldsByCls Indexed fields.
+         */
+        SqlCacheDescriptor(Class valCls, Set<String> fields,
+            Map<String, Class> indexedFieldsByCls) {
+            this.valCls = valCls;
+            this.fields = fields;
+            this.indexedFieldsByCls = indexedFieldsByCls;
+        }
+
+        /**
+         * @param id Query id.
+         * @return Condition string.
+         */
+        private String makeQuerySelect(int id) {
+            return StringUtils.collectionToDelimitedString(fields, ", ");
+        }
+
+        /**
+         * @param id Query id.
+         * @return Condition string.
+         */
+        private String makeQueryCondition(int id) {
+            StringBuilder sb = new StringBuilder();
+
+            for (String iField : indexedFieldsByCls.keySet()) {
+                Class cl = indexedFieldsByCls.get(iField);
+
+                if (!Number.class.isAssignableFrom(cl) && !String.class.equals(cl))
+                    continue;
+
+                if (sb.length() != 0) {
+                    switch (id % 3 % 2) {
+                        case 0:
+                            sb.append(" OR ");
+                            break;
+                        case 1:
+                            sb.append(" AND ");
+                            break;
+                    }
+                }
+
+                if (Number.class.isAssignableFrom(cl)) {
+                    sb.append(iField);
+                    switch (id % 2) {
+                        case 0:
+                            sb.append(" > ");
+                            break;
+                        case 1:
+                            sb.append(" < ");
+                            break;
+                    }
+                    sb.append(id);
+                }
+                else if (String.class.equals(cl))
+                    sb.append("lower(").append(iField).append(") LIKE lower('%").append(id).append("%')");
+
+            }
+            return sb.toString();
+        }
+
+        /**
+         * @param id Query id.
+         * @return SQL query object.
+         */
+        SqlQuery getSqlQuery(int id) {
+            return new SqlQuery(valCls, makeQueryCondition(id));
+        }
+
+        /**
+         * @param id Query id.
+         * @return SQL filed query object.
+         */
+        SqlFieldsQuery getSqlFieldsQuery(int id) {
+            return new SqlFieldsQuery(String.format("SELECT %s FROM %s WHERE %s",
+                makeQuerySelect(id), valCls.getSimpleName(), makeQueryCondition(id)));
+        }
+
+    }
+
+    /**
+     * Cache operation enum.
+     */
+    private enum Operation {
+        /** Put operation. */
+        PUT,
+
+        /** Put all operation. */
+        PUT_ALL,
+
+        /** Get operation. */
+        GET,
+
+        /** Get all operation. */
+        GET_ALL,
+
+        /** Invoke operation. */
+        INVOKE,
+
+        /** Invoke all operation. */
+        INVOKE_ALL,
+
+        /** Remove operation. */
+        REMOVE,
+
+        /** Remove all operation. */
+        REMOVE_ALL,
+
+        /** Put if absent operation. */
+        PUT_IF_ABSENT,
+
+        /** Replace operation. */
+        REPLACE,
+
+        /** Scan query operation. */
+        SCAN_QUERY,
+
+        /** SQL query operation. */
+        SQL_QUERY,
+
+        /** Continuous Query. */
+        CONTINUOUS_QUERY;
+
+        /**
+         * @param num Number of operation.
+         * @return Operation.
+         */
+        public static Operation valueOf(int num) {
+            return values()[num];
+        }
+    }
+}


Mime
View raw message