ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [40/50] [abbrv] ignite git commit: IGNITE-2952: SQL query load tests are added. This closes #653. Reviewed and merged by Denis Magda (dmagda@gridgain.com)
Date Fri, 22 Apr 2016 12:30:22 GMT
IGNITE-2952: SQL query load tests are added. This closes #653.
Reviewed and merged by Denis Magda (dmagda@gridgain.com)


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

Branch: refs/heads/ignite-db-x-10884
Commit: 2b5c4414c1a7ef0f53a233770856c85e7ebe5c10
Parents: 21bd626
Author: Vladislav Pyatkov <vldpyatkov@gmail.com>
Authored: Tue Apr 19 06:37:05 2016 +0300
Committer: Denis Magda <dmagda@gridgain.com>
Committed: Tue Apr 19 06:37:05 2016 +0300

----------------------------------------------------------------------
 .../IgniteBinaryCacheQueryTestSuite.java        |   1 -
 .../config/benchmark-cache-load-win.properties  |   2 +-
 .../config/benchmark-cache-load.properties      |  53 +++-
 .../config/ignite-base-load-config.xml          | 256 +++++++++++++++++++
 .../config/ignite-cache-load-config.xml         |  70 +++++
 .../IgniteCacheRandomOperationBenchmark.java    | 176 ++++++++++++-
 .../yardstick/cache/load/model/ModelUtil.java   |   2 +-
 7 files changed, 542 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/2b5c4414/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheQueryTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheQueryTestSuite.java
b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheQueryTestSuite.java
index 89ead35..30625fe 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheQueryTestSuite.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheQueryTestSuite.java
@@ -43,7 +43,6 @@ public class IgniteBinaryCacheQueryTestSuite extends TestSuite {
         // Serialization.
         suite.addTestSuite(BinarySerializationQuerySelfTest.class);
         suite.addTestSuite(BinarySerializationQueryWithReflectiveSerializerSelfTest.class);
-
         suite.addTestSuite(IgniteCacheBinaryObjectsScanSelfTest.class);
         suite.addTestSuite(CacheContinuousQueryLostPartitionTest.class);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/2b5c4414/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
index bfe98cf..bfcde77 100644
--- a/modules/yardstick/config/benchmark-cache-load-win.properties
+++ b/modules/yardstick/config/benchmark-cache-load-win.properties
@@ -53,4 +53,4 @@ set DRIVER_HOSTS=localhost
 :: 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-localhost-config.xml -b 1 -w 60 -d 300 -t 64 -sm PRIMARY_SYNC
-dn IgniteCacheRandomOperationBenchmark -sn IgniteNode -ds atomic-get-1-backup -nn 1
+-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
atomic-get-1-backup -nn 1

http://git-wip-us.apache.org/repos/asf/ignite/blob/2b5c4414/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
index ea25a27..3604f25 100644
--- a/modules/yardstick/config/benchmark-cache-load.properties
+++ b/modules/yardstick/config/benchmark-cache-load.properties
@@ -1,3 +1,4 @@
+
 # 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.
@@ -21,18 +22,20 @@
 JVM_OPTS=${JVM_OPTS}" -DIGNITE_QUIET=false"
 
 # Uncomment to enable concurrent garbage collection (GC) if you encounter long GC pauses.
-# 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 \
-#"
-
+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
@@ -44,7 +47,7 @@ BENCHMARK_PACKAGES=org.yardstickframework,org.apache.ignite.yardstick
 # 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
+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
@@ -55,7 +58,29 @@ DRIVER_HOSTS=localhost
 # 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
+
 # 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-localhost-config.xml -nn ${nodesNum} -b 1 -w 60 -d 300
-t 64 -sm PRIMARY_SYNC -dn IgniteCacheRandomOperationBenchmark -sn IgniteNode -ds atomic-get-1-backup"
+-cfg ${SCRIPT_DIR}/../config/ignite-cache-load-config.xml -nn ${nodesNum} -b ${b} -r ${r}
-w ${w} -d ${d} -pa ${pa} -t ${t} -sm ${sm}  -dn IgniteCacheRandomOperationBenchmark -sn IgniteNode
-ds cache-random-benchmark-1-backup"
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/2b5c4414/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..1ec1e23
--- /dev/null
+++ b/modules/yardstick/config/ignite-base-load-config.xml
@@ -0,0 +1,256 @@
+<?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.
+  -->
+
+<!--
+  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"/>
+
+        <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"/>
+
+        <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.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>
+
+                <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="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="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/2b5c4414/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..e14247a
--- /dev/null
+++ b/modules/yardstick/config/ignite-cache-load-config.xml
@@ -0,0 +1,70 @@
+<?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="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/2b5c4414/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
index 72c9aae..7fbcc78 100644
--- 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
@@ -33,6 +33,7 @@ import java.util.concurrent.ThreadLocalRandom;
 import javax.cache.processor.EntryProcessor;
 import javax.cache.processor.EntryProcessorException;
 import javax.cache.processor.MutableEntry;
+
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.IgniteCompute;
@@ -43,9 +44,13 @@ 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.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;
@@ -58,6 +63,7 @@ import org.apache.ignite.yardstick.IgniteAbstractBenchmark;
 import org.apache.ignite.yardstick.IgniteBenchmarkUtils;
 import org.apache.ignite.yardstick.cache.load.model.ModelUtil;
 import org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
 import org.yardstickframework.BenchmarkConfiguration;
 
 /**
@@ -88,6 +94,9 @@ public class IgniteCacheRandomOperationBenchmark extends IgniteAbstractBenchmark
     /** Map cache name on value classes. */
     private Map<String, Class[]> valuesCacheClasses;
 
+    /** List of query descriptors by cache names */
+    private Map<String, List<SqlCacheDescriptor>> cacheSqlDescriptors;
+
     /**
      * Replace value entry processor.
      */
@@ -131,6 +140,7 @@ public class IgniteCacheRandomOperationBenchmark extends IgniteAbstractBenchmark
         valuesCacheClasses = new HashMap<>();
         replaceEntryProc = new BenchmarkReplaceValueEntryProcessor(null);
         rmvEntryProc = new BenchmarkRemoveEntryProcessor();
+        cacheSqlDescriptors = new HashMap<>();
 
         for (String cacheName : ignite().cacheNames()) {
             IgniteCache<Object, Object> cache = ignite().cache(cacheName);
@@ -168,6 +178,8 @@ public class IgniteCacheRandomOperationBenchmark extends IgniteAbstractBenchmark
                             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);
                         }
                     }
                 }
@@ -204,6 +216,9 @@ public class IgniteCacheRandomOperationBenchmark extends IgniteAbstractBenchmark
                 keysCacheClasses.put(cacheName, keys.toArray(new Class[] {}));
                 valuesCacheClasses.put(cacheName, values.toArray(new Class[] {}));
             }
+            else
+                keysCacheClasses.put(cacheName,
+                    new Class[] {randomKeyClass(cacheName)});
 
             if (configuration.getCacheMode() != CacheMode.LOCAL)
                 affCaches.add(cache);
@@ -216,6 +231,35 @@ public class IgniteCacheRandomOperationBenchmark extends IgniteAbstractBenchmark
     }
 
     /**
+     * @param cacheName Ignite cache name.
+     * @param queryEntity Query entry.
+     * @param valCls Class of value.
+     * @throws ClassNotFoundException
+     */
+    private void cofigureCacheSqlDescriptor(String cacheName, QueryEntity queryEntity, 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 : queryEntity.getIndexes()) {
+            for (String iField : index.getFieldNames()) {
+                indexedFields.put(iField,
+                    getClass().forName(queryEntity.getFields().get(iField)));
+            }
+        }
+
+        descs.add(new SqlCacheDescriptor(valCls, queryEntity.getFields().keySet(),
+            indexedFields));
+    }
+
+    /**
      * @param configuration Ignite cache configuration.
      * @return True if defined.
      */
@@ -417,6 +461,10 @@ public class IgniteCacheRandomOperationBenchmark extends IgniteAbstractBenchmark
 
             case SCAN_QUERY:
                 doScanQuery(cache);
+                break;
+
+            case SQL_QUERY:
+                doSqlQuery(cache);
         }
     }
 
@@ -644,6 +692,27 @@ public class IgniteCacheRandomOperationBenchmark extends IgniteAbstractBenchmark
     }
 
     /**
+     * @param cache Ignite cache.
+     * @throws Exception If failed.
+     */
+    private void doSqlQuery(IgniteCache cache) throws Exception {
+        List<SqlCacheDescriptor> descriptors = cacheSqlDescriptors.get(cache.getName());
+
+        if (descriptors != null && !descriptors.isEmpty()) {
+            SqlCacheDescriptor randomDescriptor = descriptors.get(nextRandom(descriptors.size()));
+
+            int id = nextRandom(args.range());
+
+            Query sq = nextBoolean() ? randomDescriptor.getSqlQuery(id) : randomDescriptor.getSqlFieldsQuery(id);
+
+            try (QueryCursor cursor = cache.query(sq)) {
+                for (Object obj : cursor)
+                    ;
+            }
+        }
+    }
+
+    /**
      * Closure for scan query executing.
      */
     private static class ScanQueryBroadcastClosure implements IgniteRunnable {
@@ -713,6 +782,108 @@ public class IgniteCacheRandomOperationBenchmark extends IgniteAbstractBenchmark
     }
 
     /**
+     * Query descriptor.
+     */
+    private static class SqlCacheDescriptor {
+
+        /**
+         * Class of value.
+         */
+        private Class valueClass;
+
+        /**
+         * Select fields.
+         */
+        private Set<String> fields;
+
+        /**
+         * Indexed fields.
+         */
+        private Map<String, Class> indexedFieldsByCls;
+
+        /**
+         * @param valueClass Class of value.
+         * @param fields All select fields.
+         * @param indexedFieldsByClass Indexed fields.
+         */
+        public SqlCacheDescriptor(Class valueClass, Set<String> fields,
+            Map<String, Class> indexedFieldsByClass) {
+            this.valueClass = valueClass;
+            this.fields = fields;
+            this.indexedFieldsByCls = indexedFieldsByClass;
+        }
+
+        /**
+         * @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) {
+            StringBuffer sb = new StringBuffer();
+
+            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
+         */
+        public SqlQuery getSqlQuery(int id) {
+            return new SqlQuery(valueClass, makeQueryCondition(id));
+        }
+
+        /**
+         * @param id Query id.
+         * @return
+         */
+        public SqlFieldsQuery getSqlFieldsQuery(int id) {
+            return new SqlFieldsQuery(String.format("SELECT %s FROM %s WHERE %s",
+                makeQuerySelect(id), valueClass.getSimpleName(), makeQueryCondition(id)));
+        }
+
+    }
+
+    /**
      * @return Nex random boolean value.
      */
     protected boolean nextBoolean() {
@@ -754,7 +925,10 @@ public class IgniteCacheRandomOperationBenchmark extends IgniteAbstractBenchmark
         REPLACE,
 
         /** Scan query operation. */
-        SCAN_QUERY;
+        SCAN_QUERY,
+
+        /** SQL query operation. */
+        SQL_QUERY;
 
         /**
          * @param num Number of operation.

http://git-wip-us.apache.org/repos/asf/ignite/blob/2b5c4414/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/model/ModelUtil.java
----------------------------------------------------------------------
diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/model/ModelUtil.java
b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/model/ModelUtil.java
index ecb3872..db6359e 100644
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/model/ModelUtil.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/model/ModelUtil.java
@@ -110,7 +110,7 @@ public class ModelUtil {
                 res = new Truck(id, "Mark " + id, id / 2.123 * 100, Color.values()[id % colors],
id / 4.123 * 100);
                 break;
             case "Person":
-                res = new Person(id, "First Name " + id, "Last Name " + id, id / 2.123 *
100);
+                res = new Person(id, id+1, "First Name " + id, "Last Name " + id, id / 2.123
* 100);
                 break;
             case "Organization":
                 res = new Organization(id, "Organization " + id);


Mime
View raw message