# IGNITE-102. Fixes to make benchmarks runnable.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/aee11a01 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/aee11a01 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/aee11a01 Branch: refs/heads/ingite-9655-merge Commit: aee11a01f1c937a8cdef5ae88a465848be8ea533 Parents: c9aadf0 Author: AKuznetsov <akuznet...@gridgain.com> Authored: Wed Jan 28 15:17:37 2015 +0700 Committer: AKuznetsov <akuznet...@gridgain.com> Committed: Wed Jan 28 15:17:37 2015 +0700 ---------------------------------------------------------------------- .../config/benchmark-atomic-win.properties | 2 +- .../config/benchmark-atomic.properties | 2 +- .../config/benchmark-compute-win.properties | 2 +- .../config/benchmark-compute.properties | 2 +- .../config/benchmark-query-win.properties | 2 +- .../yardstick/config/benchmark-query.properties | 2 +- .../config/benchmark-tx-win.properties | 2 +- .../yardstick/config/benchmark-tx.properties | 2 +- .../yardstick/config/benchmark-win.properties | 2 +- modules/yardstick/config/benchmark.properties | 2 +- modules/yardstick/config/ignite-base-config.xml | 10 +- .../config/ignite-localhost-config.xml | 4 +- .../config/ignite-multicast-config.xml | 4 +- modules/yardstick/pom.xml | 8 ++ .../yardstick/IgniteAbstractBenchmark.java | 6 +- .../org/apache/ignite/yardstick/IgniteNode.java | 18 +-- .../yardstick/cache/IgnitePutBenchmark.java | 42 +++++++ .../cache/IgnitePutBenchmarkIgnite.java | 42 ------- .../yardstick/cache/IgnitePutGetBenchmark.java | 47 ++++++++ .../cache/IgnitePutGetBenchmarkIgnite.java | 47 -------- .../cache/IgnitePutGetTxBenchmark.java | 52 ++++++++ .../cache/IgnitePutGetTxBenchmarkIgnite.java | 52 -------- .../yardstick/cache/IgnitePutTxBenchmark.java | 43 +++++++ .../cache/IgnitePutTxBenchmarkIgnite.java | 43 ------- .../cache/IgniteSqlQueryBenchmark.java | 94 +++++++++++++++ .../cache/IgniteSqlQueryBenchmarkIgnite.java | 94 --------------- .../cache/IgniteSqlQueryJoinBenchmark.java | 118 +++++++++++++++++++ .../IgniteSqlQueryJoinBenchmarkIgnite.java | 118 ------------------- .../cache/IgniteSqlQueryPutBenchmark.java | 86 ++++++++++++++ .../cache/IgniteSqlQueryPutBenchmarkIgnite.java | 86 -------------- 30 files changed, 521 insertions(+), 513 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aee11a01/modules/yardstick/config/benchmark-atomic-win.properties ---------------------------------------------------------------------- diff --git a/modules/yardstick/config/benchmark-atomic-win.properties b/modules/yardstick/config/benchmark-atomic-win.properties index 97132f0..96dde32 100644 --- a/modules/yardstick/config/benchmark-atomic-win.properties +++ b/modules/yardstick/config/benchmark-atomic-win.properties @@ -21,7 +21,7 @@ set JVM_OPTS=%JVM_OPTS% -DGRIDGAIN_QUIET=false BENCHMARK_DEFAULT_PROBES=ThroughputLatencyProbe,PercentileProbe :: Packages where the specified benchmark is searched by reflection mechanism. -BENCHMARK_PACKAGES=org.yardstickframework +BENCHMARK_PACKAGES=org.yardstickframework,org.apache.ignite.yardstick :: Probe point writer class name. :: BENCHMARK_WRITER= http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aee11a01/modules/yardstick/config/benchmark-atomic.properties ---------------------------------------------------------------------- diff --git a/modules/yardstick/config/benchmark-atomic.properties b/modules/yardstick/config/benchmark-atomic.properties index d10259d..1f93d5c 100644 --- a/modules/yardstick/config/benchmark-atomic.properties +++ b/modules/yardstick/config/benchmark-atomic.properties @@ -23,7 +23,7 @@ JVM_OPTS=${JVM_OPTS}" -DGRIDGAIN_QUIET=false" BENCHMARK_DEFAULT_PROBES=ThroughputLatencyProbe,PercentileProbe # Packages where the specified benchmark is searched by reflection mechanism. -BENCHMARK_PACKAGES=org.yardstickframework +BENCHMARK_PACKAGES=org.yardstickframework,org.apache.ignite.yardstick # Probe point writer class name. # BENCHMARK_WRITER= http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aee11a01/modules/yardstick/config/benchmark-compute-win.properties ---------------------------------------------------------------------- diff --git a/modules/yardstick/config/benchmark-compute-win.properties b/modules/yardstick/config/benchmark-compute-win.properties index 06c7f6a..35e8873 100644 --- a/modules/yardstick/config/benchmark-compute-win.properties +++ b/modules/yardstick/config/benchmark-compute-win.properties @@ -21,7 +21,7 @@ set JVM_OPTS=%JVM_OPTS% -DGRIDGAIN_QUIET=false BENCHMARK_DEFAULT_PROBES=ThroughputLatencyProbe,PercentileProbe :: Packages where the specified benchmark is searched by reflection mechanism. -BENCHMARK_PACKAGES=org.yardstickframework +BENCHMARK_PACKAGES=org.yardstickframework,org.apache.ignite.yardstick :: Probe point writer class name. :: BENCHMARK_WRITER= http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aee11a01/modules/yardstick/config/benchmark-compute.properties ---------------------------------------------------------------------- diff --git a/modules/yardstick/config/benchmark-compute.properties b/modules/yardstick/config/benchmark-compute.properties index d90a954..1f38eb6 100644 --- a/modules/yardstick/config/benchmark-compute.properties +++ b/modules/yardstick/config/benchmark-compute.properties @@ -23,7 +23,7 @@ JVM_OPTS=${JVM_OPTS}" -DGRIDGAIN_QUIET=false" BENCHMARK_DEFAULT_PROBES=ThroughputLatencyProbe,PercentileProbe # Packages where the specified benchmark is searched by reflection mechanism. -BENCHMARK_PACKAGES=org.yardstickframework +BENCHMARK_PACKAGES=org.yardstickframework,org.apache.ignite.yardstick # Probe point writer class name. # BENCHMARK_WRITER= http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aee11a01/modules/yardstick/config/benchmark-query-win.properties ---------------------------------------------------------------------- diff --git a/modules/yardstick/config/benchmark-query-win.properties b/modules/yardstick/config/benchmark-query-win.properties index 377bac0..a2c102c 100644 --- a/modules/yardstick/config/benchmark-query-win.properties +++ b/modules/yardstick/config/benchmark-query-win.properties @@ -21,7 +21,7 @@ set JVM_OPTS=%JVM_OPTS%^ BENCHMARK_DEFAULT_PROBES=ThroughputLatencyProbe,PercentileProbe :: Packages where the specified benchmark is searched by reflection mechanism. -BENCHMARK_PACKAGES=org.yardstickframework +BENCHMARK_PACKAGES=org.yardstickframework,org.apache.ignite.yardstick :: Probe point writer class name. :: BENCHMARK_WRITER= http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aee11a01/modules/yardstick/config/benchmark-query.properties ---------------------------------------------------------------------- diff --git a/modules/yardstick/config/benchmark-query.properties b/modules/yardstick/config/benchmark-query.properties index b467e0b..c3e7a6e 100644 --- a/modules/yardstick/config/benchmark-query.properties +++ b/modules/yardstick/config/benchmark-query.properties @@ -23,7 +23,7 @@ JVM_OPTS=${JVM_OPTS}" -DGRIDGAIN_QUIET=false" \ BENCHMARK_DEFAULT_PROBES=ThroughputLatencyProbe,PercentileProbe # Packages where the specified benchmark is searched by reflection mechanism. -BENCHMARK_PACKAGES=org.yardstickframework +BENCHMARK_PACKAGES=org.yardstickframework,org.apache.ignite.yardstick # Probe point writer class name. # BENCHMARK_WRITER= http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aee11a01/modules/yardstick/config/benchmark-tx-win.properties ---------------------------------------------------------------------- diff --git a/modules/yardstick/config/benchmark-tx-win.properties b/modules/yardstick/config/benchmark-tx-win.properties index 7e098a5..7b12202 100644 --- a/modules/yardstick/config/benchmark-tx-win.properties +++ b/modules/yardstick/config/benchmark-tx-win.properties @@ -21,7 +21,7 @@ set JVM_OPTS=%JVM_OPTS% -DGRIDGAIN_QUIET=false BENCHMARK_DEFAULT_PROBES=ThroughputLatencyProbe,PercentileProbe :: Packages where the specified benchmark is searched by reflection mechanism. -BENCHMARK_PACKAGES=org.yardstickframework +BENCHMARK_PACKAGES=org.yardstickframework,org.apache.ignite.yardstick :: Probe point writer class name. :: BENCHMARK_WRITER= http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aee11a01/modules/yardstick/config/benchmark-tx.properties ---------------------------------------------------------------------- diff --git a/modules/yardstick/config/benchmark-tx.properties b/modules/yardstick/config/benchmark-tx.properties index 83be491..c3d69f2 100644 --- a/modules/yardstick/config/benchmark-tx.properties +++ b/modules/yardstick/config/benchmark-tx.properties @@ -23,7 +23,7 @@ JVM_OPTS=${JVM_OPTS}" -DGRIDGAIN_QUIET=false" BENCHMARK_DEFAULT_PROBES=ThroughputLatencyProbe,PercentileProbe # Packages where the specified benchmark is searched by reflection mechanism, comma separated. -BENCHMARK_PACKAGES=org.yardstickframework +BENCHMARK_PACKAGES=org.yardstickframework,org.apache.ignite.yardstick # Probe point writer class name. # BENCHMARK_WRITER= http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aee11a01/modules/yardstick/config/benchmark-win.properties ---------------------------------------------------------------------- diff --git a/modules/yardstick/config/benchmark-win.properties b/modules/yardstick/config/benchmark-win.properties index ba77c84..00a3c17 100644 --- a/modules/yardstick/config/benchmark-win.properties +++ b/modules/yardstick/config/benchmark-win.properties @@ -24,7 +24,7 @@ set JVM_OPTS=%JVM_OPTS% -DGRIDGAIN_QUIET=false BENCHMARK_DEFAULT_PROBES=ThroughputLatencyProbe,PercentileProbe :: Packages where the specified benchmark is searched by reflection mechanism. -BENCHMARK_PACKAGES=org.yardstickframework +BENCHMARK_PACKAGES=org.yardstickframework,org.apache.ignite.yardstick :: Probe point writer class name. :: BENCHMARK_WRITER= http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aee11a01/modules/yardstick/config/benchmark.properties ---------------------------------------------------------------------- diff --git a/modules/yardstick/config/benchmark.properties b/modules/yardstick/config/benchmark.properties index bbe9ff0..034eb46 100644 --- a/modules/yardstick/config/benchmark.properties +++ b/modules/yardstick/config/benchmark.properties @@ -26,7 +26,7 @@ JVM_OPTS=${JVM_OPTS}" -DGRIDGAIN_QUIET=false" BENCHMARK_DEFAULT_PROBES=ThroughputLatencyProbe,PercentileProbe # Packages where the specified benchmark is searched by reflection mechanism. -BENCHMARK_PACKAGES=org.yardstickframework +BENCHMARK_PACKAGES=org.yardstickframework,org.apache.ignite.yardstick # Probe point writer class name. # BENCHMARK_WRITER= http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aee11a01/modules/yardstick/config/ignite-base-config.xml ---------------------------------------------------------------------- diff --git a/modules/yardstick/config/ignite-base-config.xml b/modules/yardstick/config/ignite-base-config.xml index 69fe9b1..16d0a70 100644 --- a/modules/yardstick/config/ignite-base-config.xml +++ b/modules/yardstick/config/ignite-base-config.xml @@ -24,7 +24,7 @@ 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-grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration" abstract="true"> + <bean id="base-ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration" abstract="true"> <property name="peerClassLoadingEnabled" value="false"/> <!--property name="marshaller"> @@ -46,7 +46,7 @@ <property name="cacheConfiguration"> <list> - <bean class="org.gridgain.grid.cache.GridCacheConfiguration"> + <bean class="org.apache.ignite.cache.CacheConfiguration"> <property name="name" value="atomic"/> <property name="cacheMode" value="PARTITIONED"/> @@ -58,7 +58,7 @@ <property name="queryIndexEnabled" value="false"/> </bean> - <bean class="org.gridgain.grid.cache.GridCacheConfiguration"> + <bean class="org.apache.ignite.cache.CacheConfiguration"> <property name="name" value="tx"/> <property name="cacheMode" value="PARTITIONED"/> @@ -70,7 +70,7 @@ <property name="queryIndexEnabled" value="false"/> </bean> - <bean class="org.gridgain.grid.cache.GridCacheConfiguration"> + <bean class="org.apache.ignite.cache.CacheConfiguration"> <property name="name" value="query"/> <property name="cacheMode" value="PARTITIONED"/> @@ -83,7 +83,7 @@ <property name="queryIndexEnabled" value="true"/> </bean> - <bean class="org.gridgain.grid.cache.GridCacheConfiguration"> + <bean class="org.apache.ignite.cache.CacheConfiguration"> <property name="name" value="compute"/> <property name="cacheMode" value="PARTITIONED"/> http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aee11a01/modules/yardstick/config/ignite-localhost-config.xml ---------------------------------------------------------------------- diff --git a/modules/yardstick/config/ignite-localhost-config.xml b/modules/yardstick/config/ignite-localhost-config.xml index 7a51bb0..95d881c 100644 --- a/modules/yardstick/config/ignite-localhost-config.xml +++ b/modules/yardstick/config/ignite-localhost-config.xml @@ -24,9 +24,9 @@ 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="gridgain-base-config.xml"/> + <import resource="ignite-base-config.xml"/> - <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration" parent="base-grid.cfg"> + <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration" parent="base-ignite.cfg"> <property name="localHost" value="127.0.0.1"/> <property name="discoverySpi"> http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aee11a01/modules/yardstick/config/ignite-multicast-config.xml ---------------------------------------------------------------------- diff --git a/modules/yardstick/config/ignite-multicast-config.xml b/modules/yardstick/config/ignite-multicast-config.xml index a81b0d5..89710c7 100644 --- a/modules/yardstick/config/ignite-multicast-config.xml +++ b/modules/yardstick/config/ignite-multicast-config.xml @@ -24,9 +24,9 @@ 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="gridgain-base-config.xml"/> + <import resource="ignite-base-config.xml"/> - <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration" parent="base-grid.cfg"> + <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration" parent="base-ignite.cfg"> <property name="discoverySpi"> <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi"> <property name="ipFinder"> http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aee11a01/modules/yardstick/pom.xml ---------------------------------------------------------------------- diff --git a/modules/yardstick/pom.xml b/modules/yardstick/pom.xml index 67052dc..22ce876 100644 --- a/modules/yardstick/pom.xml +++ b/modules/yardstick/pom.xml @@ -172,6 +172,14 @@ </filesets> </configuration> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <version>2.9.1</version> + <configuration> + <skip>true</skip> + </configuration> + </plugin> </plugins> </build> </project> http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aee11a01/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteAbstractBenchmark.java ---------------------------------------------------------------------- diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteAbstractBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteAbstractBenchmark.java index 5cbfee1..cca6935 100644 --- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteAbstractBenchmark.java +++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteAbstractBenchmark.java @@ -24,8 +24,8 @@ import org.yardstickframework.*; import java.util.concurrent.*; -import static org.apache.ignite.events.IgniteEventType.*; import static org.apache.ignite.cache.CacheDistributionMode.*; +import static org.apache.ignite.events.IgniteEventType.*; import static org.yardstickframework.BenchmarkUtils.*; /** @@ -42,7 +42,7 @@ public abstract class IgniteAbstractBenchmark extends BenchmarkDriverAdapter { @Override public void setUp(BenchmarkConfiguration cfg) throws Exception { super.setUp(cfg); - jcommander(cfg.commandLineArguments(), args, "<gridgain-driver>"); + jcommander(cfg.commandLineArguments(), args, "<ignite-driver>"); if (Ignition.state() != IgniteState.STARTED) { node = new IgniteNode(args.distributionMode() == CLIENT_ONLY); @@ -79,7 +79,7 @@ public abstract class IgniteAbstractBenchmark extends BenchmarkDriverAdapter { * @return Grid. */ protected Ignite grid() { - return node.grid(); + return node.ignite(); } /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aee11a01/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 38a61be..b80e7bf 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 @@ -40,7 +40,7 @@ import static org.apache.ignite.cache.CacheMemoryMode.*; */ public class IgniteNode implements BenchmarkServer { /** Grid instance. */ - private Ignite grid; + private Ignite ignite; /** Client mode. */ private boolean clientMode; @@ -56,16 +56,16 @@ public class IgniteNode implements BenchmarkServer { } /** */ - public IgniteNode(boolean clientMode, Ignite grid) { + public IgniteNode(boolean clientMode, Ignite ignite) { this.clientMode = clientMode; - this.grid = grid; + this.ignite = ignite; } /** {@inheritDoc} */ @Override public void start(BenchmarkConfiguration cfg) throws Exception { IgniteBenchmarkArguments args = new IgniteBenchmarkArguments(); - BenchmarkUtils.jcommander(cfg.commandLineArguments(), args, "<gridgain-node>"); + BenchmarkUtils.jcommander(cfg.commandLineArguments(), args, "<ignite-node>"); IgniteConfiguration c = loadConfiguration(args.configuration()); @@ -119,7 +119,7 @@ public class IgniteNode implements BenchmarkServer { c.setCommunicationSpi(commSpi); - grid = Ignition.start(c); + ignite = Ignition.start(c); } /** @@ -167,7 +167,7 @@ public class IgniteNode implements BenchmarkServer { } if (cfgMap == null || cfgMap.isEmpty()) - throw new Exception("Failed to find grid configuration in: " + url); + throw new Exception("Failed to find ignite configuration in: " + url); return cfgMap.values().iterator().next(); } @@ -183,9 +183,9 @@ public class IgniteNode implements BenchmarkServer { } /** - * @return Grid. + * @return Ignite. */ - public Ignite grid() { - return grid; + public Ignite ignite() { + return ignite; } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aee11a01/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutBenchmark.java ---------------------------------------------------------------------- diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutBenchmark.java new file mode 100644 index 0000000..5136bde --- /dev/null +++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutBenchmark.java @@ -0,0 +1,42 @@ +/* + * 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.*; +import org.apache.ignite.yardstick.cache.model.*; + +import java.util.*; + +/** + * GridGain benchmark that performs put operations. + */ +public class IgnitePutBenchmark extends IgniteCacheAbstractBenchmark { + /** {@inheritDoc} */ + @Override public boolean test(Map<Object, Object> ctx) throws Exception { + int key = nextRandom(args.range()); + + cache.put(key, new SampleValue(key)); + + return true; + } + + /** {@inheritDoc} */ + @Override protected IgniteCache<Integer, Object> cache() { + return grid().jcache("atomic"); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aee11a01/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutBenchmarkIgnite.java ---------------------------------------------------------------------- diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutBenchmarkIgnite.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutBenchmarkIgnite.java deleted file mode 100644 index fbe55f3..0000000 --- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutBenchmarkIgnite.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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.*; -import org.apache.ignite.yardstick.cache.model.*; - -import java.util.*; - -/** - * GridGain benchmark that performs put operations. - */ -public class IgnitePutBenchmarkIgnite extends IgniteCacheAbstractBenchmark { - /** {@inheritDoc} */ - @Override public boolean test(Map<Object, Object> ctx) throws Exception { - int key = nextRandom(args.range()); - - cache.put(key, new SampleValue(key)); - - return true; - } - - /** {@inheritDoc} */ - @Override protected IgniteCache<Integer, Object> cache() { - return grid().jcache("atomic"); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aee11a01/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutGetBenchmark.java ---------------------------------------------------------------------- diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutGetBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutGetBenchmark.java new file mode 100644 index 0000000..2b9fa02 --- /dev/null +++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutGetBenchmark.java @@ -0,0 +1,47 @@ +/* + * 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.*; +import org.apache.ignite.yardstick.cache.model.*; + +import java.util.*; + +/** + * GridGain benchmark that performs put and get operations. + */ +public class IgnitePutGetBenchmark extends IgniteCacheAbstractBenchmark { + /** {@inheritDoc} */ + @Override public boolean test(Map<Object, Object> ctx) throws Exception { + int key = nextRandom(args.range()); + + Object val = cache.get(key); + + if (val != null) + key = nextRandom(args.range()); + + cache.put(key, new SampleValue(key)); + + return true; + } + + /** {@inheritDoc} */ + @Override protected IgniteCache<Integer, Object> cache() { + return grid().jcache("atomic"); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aee11a01/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutGetBenchmarkIgnite.java ---------------------------------------------------------------------- diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutGetBenchmarkIgnite.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutGetBenchmarkIgnite.java deleted file mode 100644 index a3b3486..0000000 --- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutGetBenchmarkIgnite.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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.*; -import org.apache.ignite.yardstick.cache.model.*; - -import java.util.*; - -/** - * GridGain benchmark that performs put and get operations. - */ -public class IgnitePutGetBenchmarkIgnite extends IgniteCacheAbstractBenchmark { - /** {@inheritDoc} */ - @Override public boolean test(Map<Object, Object> ctx) throws Exception { - int key = nextRandom(args.range()); - - Object val = cache.get(key); - - if (val != null) - key = nextRandom(args.range()); - - cache.put(key, new SampleValue(key)); - - return true; - } - - /** {@inheritDoc} */ - @Override protected IgniteCache<Integer, Object> cache() { - return grid().jcache("atomic"); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aee11a01/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutGetTxBenchmark.java ---------------------------------------------------------------------- diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutGetTxBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutGetTxBenchmark.java new file mode 100644 index 0000000..30acb41 --- /dev/null +++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutGetTxBenchmark.java @@ -0,0 +1,52 @@ +/* + * 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.*; +import org.apache.ignite.transactions.*; +import org.apache.ignite.yardstick.cache.model.*; + +import java.util.*; + +/** + * GridGain benchmark that performs transactional put and get operations. + */ +public class IgnitePutGetTxBenchmark extends IgniteCacheAbstractBenchmark { + /** {@inheritDoc} */ + @Override public boolean test(Map<Object, Object> ctx) throws Exception { + int key = nextRandom(0, args.range() / 2); + + try (IgniteTx tx = grid().transactions().txStart()) { + Object val = cache.get(key); + + if (val != null) + key = nextRandom(args.range() / 2, args.range()); + + cache.put(key, new SampleValue(key)); + + tx.commit(); + } + + return true; + } + + /** {@inheritDoc} */ + @Override protected IgniteCache<Integer, Object> cache() { + return grid().jcache("tx"); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aee11a01/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutGetTxBenchmarkIgnite.java ---------------------------------------------------------------------- diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutGetTxBenchmarkIgnite.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutGetTxBenchmarkIgnite.java deleted file mode 100644 index 3cad7d7..0000000 --- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutGetTxBenchmarkIgnite.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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.*; -import org.apache.ignite.transactions.*; -import org.apache.ignite.yardstick.cache.model.*; - -import java.util.*; - -/** - * GridGain benchmark that performs transactional put and get operations. - */ -public class IgnitePutGetTxBenchmarkIgnite extends IgniteCacheAbstractBenchmark { - /** {@inheritDoc} */ - @Override public boolean test(Map<Object, Object> ctx) throws Exception { - int key = nextRandom(0, args.range() / 2); - - try (IgniteTx tx = grid().transactions().txStart()) { - Object val = cache.get(key); - - if (val != null) - key = nextRandom(args.range() / 2, args.range()); - - cache.put(key, new SampleValue(key)); - - tx.commit(); - } - - return true; - } - - /** {@inheritDoc} */ - @Override protected IgniteCache<Integer, Object> cache() { - return grid().jcache("tx"); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aee11a01/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutTxBenchmark.java ---------------------------------------------------------------------- diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutTxBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutTxBenchmark.java new file mode 100644 index 0000000..e1cefbc --- /dev/null +++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutTxBenchmark.java @@ -0,0 +1,43 @@ +/* + * 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.*; +import org.apache.ignite.yardstick.cache.model.*; + +import java.util.*; + +/** + * GridGain benchmark that performs transactional put operations. + */ +public class IgnitePutTxBenchmark extends IgniteCacheAbstractBenchmark { + /** {@inheritDoc} */ + @Override public boolean test(Map<Object, Object> ctx) throws Exception { + int key = nextRandom(args.range()); + + // Implicit transaction is used. + cache.put(key, new SampleValue(key)); + + return true; + } + + /** {@inheritDoc} */ + @Override protected IgniteCache<Integer, Object> cache() { + return grid().jcache("tx"); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aee11a01/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutTxBenchmarkIgnite.java ---------------------------------------------------------------------- diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutTxBenchmarkIgnite.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutTxBenchmarkIgnite.java deleted file mode 100644 index dd2fd58..0000000 --- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgnitePutTxBenchmarkIgnite.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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.*; -import org.apache.ignite.yardstick.cache.model.*; - -import java.util.*; - -/** - * GridGain benchmark that performs transactional put operations. - */ -public class IgnitePutTxBenchmarkIgnite extends IgniteCacheAbstractBenchmark { - /** {@inheritDoc} */ - @Override public boolean test(Map<Object, Object> ctx) throws Exception { - int key = nextRandom(args.range()); - - // Implicit transaction is used. - cache.put(key, new SampleValue(key)); - - return true; - } - - /** {@inheritDoc} */ - @Override protected IgniteCache<Integer, Object> cache() { - return grid().jcache("tx"); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aee11a01/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryBenchmark.java ---------------------------------------------------------------------- diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryBenchmark.java new file mode 100644 index 0000000..38aa632 --- /dev/null +++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryBenchmark.java @@ -0,0 +1,94 @@ +/* + * 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.*; +import org.apache.ignite.cache.query.*; +import org.apache.ignite.yardstick.cache.model.*; +import org.yardstickframework.*; + +import java.util.*; +import java.util.concurrent.*; + +import static org.yardstickframework.BenchmarkUtils.*; + +/** + * GridGain benchmark that performs query operations. + */ +public class IgniteSqlQueryBenchmark extends IgniteCacheAbstractBenchmark { + /** */ + private CacheQuery qry; + + /** {@inheritDoc} */ + @Override public void setUp(BenchmarkConfiguration cfg) throws Exception { + super.setUp(cfg); + + println(cfg, "Populating query data..."); + + long start = System.nanoTime(); + + try (IgniteDataLoader<Integer, Person> dataLdr = grid().dataLoader(cache.getName())) { + for (int i = 0; i < args.range() && !Thread.currentThread().isInterrupted(); i++) { + dataLdr.addData(i, new Person(i, "firstName" + i, "lastName" + i, i * 1000)); + + if (i % 100000 == 0) + println(cfg, "Populated persons: " + i); + } + } + + println(cfg, "Finished populating query data in " + ((System.nanoTime() - start) / 1_000_000) + " ms."); + + qry = null; // TODO: should be fixed after IGNITE-2 cache.queries().createSqlQuery(Person.class, "salary >= ? and salary <= ?"); + } + + /** {@inheritDoc} */ + @Override public boolean test(Map<Object, Object> ctx) throws Exception { + double salary = ThreadLocalRandom.current().nextDouble() * args.range() * 1000; + + double maxSalary = salary + 1000; + + Collection<Map.Entry<Integer, Person>> entries = executeQuery(salary, maxSalary); + + for (Map.Entry<Integer, Person> entry : entries) { + Person p = entry.getValue(); + + if (p.getSalary() < salary || p.getSalary() > maxSalary) + throw new Exception("Invalid person retrieved [min=" + salary + ", max=" + maxSalary + + ", person=" + p + ']'); + } + + return true; + } + + /** + * @param minSalary Min salary. + * @param maxSalary Max salary. + * @return Query result. + * @throws Exception If failed. + */ + private Collection<Map.Entry<Integer, Person>> executeQuery(double minSalary, double maxSalary) throws Exception { + CacheQuery<Map.Entry<Integer, Person>> q = (CacheQuery<Map.Entry<Integer, Person>>)qry; + + return q.execute(minSalary, maxSalary).get(); + } + + /** {@inheritDoc} */ + @Override protected IgniteCache<Integer, Object> cache() { + return grid().jcache("query"); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aee11a01/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryBenchmarkIgnite.java ---------------------------------------------------------------------- diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryBenchmarkIgnite.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryBenchmarkIgnite.java deleted file mode 100644 index c769e53..0000000 --- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryBenchmarkIgnite.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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.*; -import org.apache.ignite.cache.query.*; -import org.apache.ignite.yardstick.cache.model.*; -import org.yardstickframework.*; - -import java.util.*; -import java.util.concurrent.*; - -import static org.yardstickframework.BenchmarkUtils.*; - -/** - * GridGain benchmark that performs query operations. - */ -public class IgniteSqlQueryBenchmarkIgnite extends IgniteCacheAbstractBenchmark { - /** */ - private CacheQuery qry; - - /** {@inheritDoc} */ - @Override public void setUp(BenchmarkConfiguration cfg) throws Exception { - super.setUp(cfg); - - println(cfg, "Populating query data..."); - - long start = System.nanoTime(); - - try (IgniteDataLoader<Integer, Person> dataLdr = grid().dataLoader(cache.getName())) { - for (int i = 0; i < args.range() && !Thread.currentThread().isInterrupted(); i++) { - dataLdr.addData(i, new Person(i, "firstName" + i, "lastName" + i, i * 1000)); - - if (i % 100000 == 0) - println(cfg, "Populated persons: " + i); - } - } - - println(cfg, "Finished populating query data in " + ((System.nanoTime() - start) / 1_000_000) + " ms."); - - qry = null; // TODO: should be fixed after IGNITE-2 cache.queries().createSqlQuery(Person.class, "salary >= ? and salary <= ?"); - } - - /** {@inheritDoc} */ - @Override public boolean test(Map<Object, Object> ctx) throws Exception { - double salary = ThreadLocalRandom.current().nextDouble() * args.range() * 1000; - - double maxSalary = salary + 1000; - - Collection<Map.Entry<Integer, Person>> entries = executeQuery(salary, maxSalary); - - for (Map.Entry<Integer, Person> entry : entries) { - Person p = entry.getValue(); - - if (p.getSalary() < salary || p.getSalary() > maxSalary) - throw new Exception("Invalid person retrieved [min=" + salary + ", max=" + maxSalary + - ", person=" + p + ']'); - } - - return true; - } - - /** - * @param minSalary Min salary. - * @param maxSalary Max salary. - * @return Query result. - * @throws Exception If failed. - */ - private Collection<Map.Entry<Integer, Person>> executeQuery(double minSalary, double maxSalary) throws Exception { - CacheQuery<Map.Entry<Integer, Person>> q = (CacheQuery<Map.Entry<Integer, Person>>)qry; - - return q.execute(minSalary, maxSalary).get(); - } - - /** {@inheritDoc} */ - @Override protected IgniteCache<Integer, Object> cache() { - return grid().jcache("query"); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aee11a01/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryJoinBenchmark.java ---------------------------------------------------------------------- diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryJoinBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryJoinBenchmark.java new file mode 100644 index 0000000..7b4262b --- /dev/null +++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryJoinBenchmark.java @@ -0,0 +1,118 @@ +/* + * 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.*; +import org.apache.ignite.cache.query.*; +import org.apache.ignite.yardstick.cache.model.*; +import org.yardstickframework.*; + +import java.util.*; +import java.util.concurrent.*; + +import static org.yardstickframework.BenchmarkUtils.*; + +/** + * GridGain benchmark that performs query operations with joins. + */ +public class IgniteSqlQueryJoinBenchmark extends IgniteCacheAbstractBenchmark { + /** */ + private CacheQuery qry; + + /** {@inheritDoc} */ + @Override public void setUp(BenchmarkConfiguration cfg) throws Exception { + super.setUp(cfg); + + println(cfg, "Populating query data..."); + + long start = System.nanoTime(); + + try (IgniteDataLoader<Object, Object> dataLdr = grid().dataLoader(cache.getName())) { + final int orgRange = args.range() / 10; + + // Populate organizations. + for (int i = 0; i < orgRange && !Thread.currentThread().isInterrupted(); i++) + dataLdr.addData(i, new Organization(i, "org" + i)); + + dataLdr.flush(); + + // Populate persons. + for (int i = 0; i < args.range() && !Thread.currentThread().isInterrupted(); i++) { + Person p = + new Person(i, ThreadLocalRandom.current().nextInt(orgRange), "firstName" + i, "lastName" + i, i * 1000); + + dataLdr.addData(i, p); + + if (i % 100000 == 0) + println(cfg, "Populated persons: " + i); + } + } + + println(cfg, "Finished populating join query data in " + ((System.nanoTime() - start) / 1_000_000) + " ms."); + + qry = null; // TODO: should be fixed after IGNITE-2 cache.queries().createSqlFieldsQuery( + // "select p.id, p.orgId, p.firstName, p.lastName, p.salary, o.name " + + // "from Person p, Organization o " + + // "where p.id = o.id and salary >= ? and salary <= ?"); + } + + /** {@inheritDoc} */ + @Override public boolean test(Map<Object, Object> ctx) throws Exception { + double salary = ThreadLocalRandom.current().nextDouble() * args.range() * 1000; + + double maxSalary = salary + 1000; + + Collection<List<?>> lists = executeQueryJoin(salary, maxSalary); + + for (List<?> l : lists) { + double sal = (Double)l.get(4); + + if (sal < salary || sal > maxSalary) { + Person p = new Person(); + + p.setId((Integer)l.get(0)); + p.setOrganizationId((Integer)l.get(1)); + p.setFirstName((String)l.get(2)); + p.setLastName((String)l.get(3)); + p.setSalary(sal); + + throw new Exception("Invalid person retrieved [min=" + salary + ", max=" + maxSalary + + ", person=" + p + ']'); + } + } + + return true; + } + + /** + * @param minSalary Min salary. + * @param maxSalary Max salary. + * @return Query results. + * @throws Exception If failed. + */ + private Collection<List<?>> executeQueryJoin(double minSalary, double maxSalary) throws Exception { + CacheQuery<List<?>> q = (CacheQuery<List<?>>)qry; + + return q.execute(minSalary, maxSalary).get(); + } + + /** {@inheritDoc} */ + @Override protected IgniteCache<Integer, Object> cache() { + return grid().jcache("query"); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aee11a01/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryJoinBenchmarkIgnite.java ---------------------------------------------------------------------- diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryJoinBenchmarkIgnite.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryJoinBenchmarkIgnite.java deleted file mode 100644 index 4405afa..0000000 --- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryJoinBenchmarkIgnite.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * 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.*; -import org.apache.ignite.cache.query.*; -import org.apache.ignite.yardstick.cache.model.*; -import org.yardstickframework.*; - -import java.util.*; -import java.util.concurrent.*; - -import static org.yardstickframework.BenchmarkUtils.*; - -/** - * GridGain benchmark that performs query operations with joins. - */ -public class IgniteSqlQueryJoinBenchmarkIgnite extends IgniteCacheAbstractBenchmark { - /** */ - private CacheQuery qry; - - /** {@inheritDoc} */ - @Override public void setUp(BenchmarkConfiguration cfg) throws Exception { - super.setUp(cfg); - - println(cfg, "Populating query data..."); - - long start = System.nanoTime(); - - try (IgniteDataLoader<Object, Object> dataLdr = grid().dataLoader(cache.getName())) { - final int orgRange = args.range() / 10; - - // Populate organizations. - for (int i = 0; i < orgRange && !Thread.currentThread().isInterrupted(); i++) - dataLdr.addData(i, new Organization(i, "org" + i)); - - dataLdr.flush(); - - // Populate persons. - for (int i = 0; i < args.range() && !Thread.currentThread().isInterrupted(); i++) { - Person p = - new Person(i, ThreadLocalRandom.current().nextInt(orgRange), "firstName" + i, "lastName" + i, i * 1000); - - dataLdr.addData(i, p); - - if (i % 100000 == 0) - println(cfg, "Populated persons: " + i); - } - } - - println(cfg, "Finished populating join query data in " + ((System.nanoTime() - start) / 1_000_000) + " ms."); - - qry = null; // TODO: should be fixed after IGNITE-2 cache.queries().createSqlFieldsQuery( - // "select p.id, p.orgId, p.firstName, p.lastName, p.salary, o.name " + - // "from Person p, Organization o " + - // "where p.id = o.id and salary >= ? and salary <= ?"); - } - - /** {@inheritDoc} */ - @Override public boolean test(Map<Object, Object> ctx) throws Exception { - double salary = ThreadLocalRandom.current().nextDouble() * args.range() * 1000; - - double maxSalary = salary + 1000; - - Collection<List<?>> lists = executeQueryJoin(salary, maxSalary); - - for (List<?> l : lists) { - double sal = (Double)l.get(4); - - if (sal < salary || sal > maxSalary) { - Person p = new Person(); - - p.setId((Integer)l.get(0)); - p.setOrganizationId((Integer)l.get(1)); - p.setFirstName((String)l.get(2)); - p.setLastName((String)l.get(3)); - p.setSalary(sal); - - throw new Exception("Invalid person retrieved [min=" + salary + ", max=" + maxSalary + - ", person=" + p + ']'); - } - } - - return true; - } - - /** - * @param minSalary Min salary. - * @param maxSalary Max salary. - * @return Query results. - * @throws Exception If failed. - */ - private Collection<List<?>> executeQueryJoin(double minSalary, double maxSalary) throws Exception { - CacheQuery<List<?>> q = (CacheQuery<List<?>>)qry; - - return q.execute(minSalary, maxSalary).get(); - } - - /** {@inheritDoc} */ - @Override protected IgniteCache<Integer, Object> cache() { - return grid().jcache("query"); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aee11a01/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryPutBenchmark.java ---------------------------------------------------------------------- diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryPutBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryPutBenchmark.java new file mode 100644 index 0000000..9d8ef4f --- /dev/null +++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryPutBenchmark.java @@ -0,0 +1,86 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.yardstick.cache; + +import org.apache.ignite.*; +import org.apache.ignite.cache.query.*; +import org.apache.ignite.yardstick.cache.model.*; +import org.yardstickframework.*; + +import java.util.*; +import java.util.concurrent.*; + +/** + * GridGain benchmark that performs put and query operations. + */ +public class IgniteSqlQueryPutBenchmark extends IgniteCacheAbstractBenchmark { + /** */ + private CacheQuery qry; + + /** {@inheritDoc} */ + @Override public void setUp(BenchmarkConfiguration cfg) throws Exception { + super.setUp(cfg); + + qry = null; // TODO: should be fixed after IGNITE-2 cache.queries().createSqlQuery(Person.class, "salary >= ? and salary <= ?"); + } + + /** {@inheritDoc} */ + @Override public boolean test(Map<Object, Object> ctx) throws Exception { + ThreadLocalRandom rnd = ThreadLocalRandom.current(); + + if (rnd.nextBoolean()) { + double salary = rnd.nextDouble() * args.range() * 1000; + + double maxSalary = salary + 1000; + + Collection<Map.Entry<Integer, Person>> entries = executeQuery(salary, maxSalary); + + for (Map.Entry<Integer, Person> entry : entries) { + Person p = entry.getValue(); + + if (p.getSalary() < salary || p.getSalary() > maxSalary) + throw new Exception("Invalid person retrieved [min=" + salary + ", max=" + maxSalary + + ", person=" + p + ']'); + } + } + else { + int i = rnd.nextInt(args.range()); + + cache.put(i, new Person(i, "firstName" + i, "lastName" + i, i * 1000)); + } + + return true; + } + + /** + * @param minSalary Min salary. + * @param maxSalary Max salary. + * @return Query result. + * @throws Exception If failed. + */ + private Collection<Map.Entry<Integer, Person>> executeQuery(double minSalary, double maxSalary) throws Exception { + CacheQuery<Map.Entry<Integer, Person>> q = (CacheQuery<Map.Entry<Integer, Person>>)qry; + + return q.execute(minSalary, maxSalary).get(); + } + + /** {@inheritDoc} */ + @Override protected IgniteCache<Integer, Object> cache() { + return grid().jcache("query"); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aee11a01/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryPutBenchmarkIgnite.java ---------------------------------------------------------------------- diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryPutBenchmarkIgnite.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryPutBenchmarkIgnite.java deleted file mode 100644 index 8bef1e5..0000000 --- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryPutBenchmarkIgnite.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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.*; -import org.apache.ignite.cache.query.*; -import org.apache.ignite.yardstick.cache.model.*; -import org.yardstickframework.*; - -import java.util.*; -import java.util.concurrent.*; - -/** - * GridGain benchmark that performs put and query operations. - */ -public class IgniteSqlQueryPutBenchmarkIgnite extends IgniteCacheAbstractBenchmark { - /** */ - private CacheQuery qry; - - /** {@inheritDoc} */ - @Override public void setUp(BenchmarkConfiguration cfg) throws Exception { - super.setUp(cfg); - - qry = null; // TODO: should be fixed after IGNITE-2 cache.queries().createSqlQuery(Person.class, "salary >= ? and salary <= ?"); - } - - /** {@inheritDoc} */ - @Override public boolean test(Map<Object, Object> ctx) throws Exception { - ThreadLocalRandom rnd = ThreadLocalRandom.current(); - - if (rnd.nextBoolean()) { - double salary = rnd.nextDouble() * args.range() * 1000; - - double maxSalary = salary + 1000; - - Collection<Map.Entry<Integer, Person>> entries = executeQuery(salary, maxSalary); - - for (Map.Entry<Integer, Person> entry : entries) { - Person p = entry.getValue(); - - if (p.getSalary() < salary || p.getSalary() > maxSalary) - throw new Exception("Invalid person retrieved [min=" + salary + ", max=" + maxSalary + - ", person=" + p + ']'); - } - } - else { - int i = rnd.nextInt(args.range()); - - cache.put(i, new Person(i, "firstName" + i, "lastName" + i, i * 1000)); - } - - return true; - } - - /** - * @param minSalary Min salary. - * @param maxSalary Max salary. - * @return Query result. - * @throws Exception If failed. - */ - private Collection<Map.Entry<Integer, Person>> executeQuery(double minSalary, double maxSalary) throws Exception { - CacheQuery<Map.Entry<Integer, Person>> q = (CacheQuery<Map.Entry<Integer, Person>>)qry; - - return q.execute(minSalary, maxSalary).get(); - } - - /** {@inheritDoc} */ - @Override protected IgniteCache<Integer, Object> cache() { - return grid().jcache("query"); - } -}