Repository: ignite Updated Branches: refs/heads/ignite-2.7 0c879bbec -> de21856bc
http://git-wip-us.apache.org/repos/asf/ignite/blob/de21856b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java index 7633d2a..24ff297 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java +++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java @@ -180,8 +180,8 @@ import org.apache.ignite.internal.processors.query.h2.H2ResultSetIteratorNullify import org.apache.ignite.internal.processors.query.h2.H2StatementCacheSelfTest; import org.apache.ignite.internal.processors.query.h2.IgniteSqlBigIntegerKeyTest; import org.apache.ignite.internal.processors.query.h2.IgniteSqlQueryMinMaxTest; +import org.apache.ignite.internal.processors.query.h2.ObjectPoolSelfTest; import org.apache.ignite.internal.processors.query.h2.PreparedStatementExSelfTest; -import org.apache.ignite.internal.processors.query.h2.ThreadLocalObjectPoolSelfTest; import org.apache.ignite.internal.processors.query.h2.sql.BaseH2CompareQueryTest; import org.apache.ignite.internal.processors.query.h2.sql.GridQueryParsingTest; import org.apache.ignite.internal.processors.query.h2.sql.H2CompareBigQueryDistributedJoinsTest; @@ -475,7 +475,7 @@ public class IgniteCacheQuerySelfTestSuite extends TestSuite { suite.addTestSuite(SqlUserCommandSelfTest.class); suite.addTestSuite(EncryptedSqlTableTest.class); - suite.addTestSuite(ThreadLocalObjectPoolSelfTest.class); + suite.addTestSuite(ObjectPoolSelfTest.class); suite.addTestSuite(H2StatementCacheSelfTest.class); suite.addTestSuite(PreparedStatementExSelfTest.class); http://git-wip-us.apache.org/repos/asf/ignite/blob/de21856b/modules/platforms/cpp/core/include/ignite/cache/query/query_sql_fields.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core/include/ignite/cache/query/query_sql_fields.h b/modules/platforms/cpp/core/include/ignite/cache/query/query_sql_fields.h index 519b2ed..4e4614c 100644 --- a/modules/platforms/cpp/core/include/ignite/cache/query/query_sql_fields.h +++ b/modules/platforms/cpp/core/include/ignite/cache/query/query_sql_fields.h @@ -54,7 +54,7 @@ namespace ignite loc(false), distributedJoins(false), enforceJoinOrder(false), - lazy(false), + lazy(true), args() { // No-op. @@ -73,7 +73,7 @@ namespace ignite loc(false), distributedJoins(false), enforceJoinOrder(false), - lazy(false), + lazy(true), args() { // No-op. http://git-wip-us.apache.org/repos/asf/ignite/blob/de21856b/modules/platforms/cpp/odbc-test/src/configuration_test.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc-test/src/configuration_test.cpp b/modules/platforms/cpp/odbc-test/src/configuration_test.cpp index 4cfc940..c7014f9 100644 --- a/modules/platforms/cpp/odbc-test/src/configuration_test.cpp +++ b/modules/platforms/cpp/odbc-test/src/configuration_test.cpp @@ -46,7 +46,7 @@ namespace const bool testEnforceJoinOrder = true; const bool testReplicatedOnly = true; const bool testCollocated = true; - const bool testLazy = true; + const bool testLazy = false; const bool testSkipReducerOnUpdate = true; const std::string testAddressStr = testServerHost + ':' + ignite::common::LexicalCast<std::string>(testServerPort); @@ -234,7 +234,7 @@ void CheckDsnConfig(const Configuration& cfg) BOOST_CHECK_EQUAL(cfg.IsEnforceJoinOrder(), false); BOOST_CHECK_EQUAL(cfg.IsReplicatedOnly(), false); BOOST_CHECK_EQUAL(cfg.IsCollocated(), false); - BOOST_CHECK_EQUAL(cfg.IsLazy(), false); + BOOST_CHECK_EQUAL(cfg.IsLazy(), true); BOOST_CHECK_EQUAL(cfg.IsSkipReducerOnUpdate(), false); BOOST_CHECK(cfg.GetAddresses().empty()); } http://git-wip-us.apache.org/repos/asf/ignite/blob/de21856b/modules/platforms/cpp/odbc/src/config/configuration.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/src/config/configuration.cpp b/modules/platforms/cpp/odbc/src/config/configuration.cpp index a99894d..6caf86e 100644 --- a/modules/platforms/cpp/odbc/src/config/configuration.cpp +++ b/modules/platforms/cpp/odbc/src/config/configuration.cpp @@ -43,7 +43,7 @@ namespace ignite const bool Configuration::DefaultValue::enforceJoinOrder = false; const bool Configuration::DefaultValue::replicatedOnly = false; const bool Configuration::DefaultValue::collocated = false; - const bool Configuration::DefaultValue::lazy = false; + const bool Configuration::DefaultValue::lazy = true; const bool Configuration::DefaultValue::skipReducerOnUpdate = false; const ProtocolVersion& Configuration::DefaultValue::protocolVersion = ProtocolVersion::GetCurrent(); http://git-wip-us.apache.org/repos/asf/ignite/blob/de21856b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Linq/CacheLinqTest.Introspection.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Linq/CacheLinqTest.Introspection.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Linq/CacheLinqTest.Introspection.cs index f5b5baa..67bde2e 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Linq/CacheLinqTest.Introspection.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Linq/CacheLinqTest.Introspection.cs @@ -103,6 +103,8 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Linq #pragma warning restore 618 // Type or member is obsolete fq = fieldsQuery.GetFieldsQuery(); + fq.Lazy = false; + Assert.AreEqual(GetSqlEscapeAll() ? "select _T0.\"Name\" from PERSON_ORG_SCHEMA.\"Person\" as _T0" : "select _T0.NAME from PERSON_ORG_SCHEMA.Person as _T0", http://git-wip-us.apache.org/repos/asf/ignite/blob/de21856b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/Cache/SqlQueryTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/Cache/SqlQueryTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/Cache/SqlQueryTest.cs index 02d13f6..d99fd156 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/Cache/SqlQueryTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/Cache/SqlQueryTest.cs @@ -150,9 +150,9 @@ namespace Apache.Ignite.Core.Tests.Client.Cache { var cache = GetClientCache<Person>(); - cache.PutAll(Enumerable.Range(1, 30000).ToDictionary(x => x, x => new Person(x))); + cache.PutAll(Enumerable.Range(1, 1000).ToDictionary(x => x, x => new Person(x))); - var qry = new SqlFieldsQuery("select * from Person where Name like '%ers%'") + var qry = new SqlFieldsQuery("select * from Person p0, Person p1, Person p2'") { Timeout = TimeSpan.FromMilliseconds(1) }; http://git-wip-us.apache.org/repos/asf/ignite/blob/de21856b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/SqlFieldsQuery.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/SqlFieldsQuery.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/SqlFieldsQuery.cs index a93e00d..f81e4ac 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/SqlFieldsQuery.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/SqlFieldsQuery.cs @@ -36,22 +36,23 @@ namespace Apache.Ignite.Core.Cache.Query /// <param name="args">Arguments.</param> public SqlFieldsQuery(string sql, params object[] args) : this(sql, false, args) { - // No-op. + Lazy = true; } - /// <summary> - /// Constructor, - /// </summary> - /// <param name="sql">SQL.</param> - /// <param name="loc">Whether query should be executed locally.</param> - /// <param name="args">Arguments.</param> - public SqlFieldsQuery(string sql, bool loc, params object[] args) + /// <summary> + /// Constructor, + /// </summary> + /// <param name="sql">SQL.</param> + /// <param name="loc">Whether query should be executed locally.</param> + /// <param name="args">Arguments.</param> + public SqlFieldsQuery(string sql, bool loc, params object[] args) { Sql = sql; Local = loc; Arguments = args; PageSize = DefaultPageSize; + Lazy = true; } /// <summary> @@ -135,18 +136,20 @@ namespace Apache.Ignite.Core.Cache.Query /// </summary> public string Schema { get; set; } - /// <summary> - /// Gets or sets a value indicating whether this <see cref="SqlFieldsQuery"/> is lazy. - /// <para /> - /// By default Ignite attempts to fetch the whole query result set to memory and send it to the client. - /// For small and medium result sets this provides optimal performance and minimize duration of internal - /// database locks, thus increasing concurrency. - /// <para /> - /// If result set is too big to fit in available memory this could lead to excessive GC pauses and even - /// OutOfMemoryError. Use this flag as a hint for Ignite to fetch result set lazily, thus minimizing memory - /// consumption at the cost of moderate performance hit. - /// </summary> - public bool Lazy { get; set; } + /// <summary> + /// Gets or sets a value indicating whether this <see cref="SqlFieldsQuery"/> is lazy. + /// <para /> + /// When lazy mode is turned off Ignite attempts to fetch the whole query result set to memory and send it to the client. + /// For small and medium result sets this provides optimal performance and minimize duration of internal + /// database locks, thus increasing concurrency. + /// <para /> + /// If result set is too big to fit in available memory this could lead to excessive GC pauses and even + /// OutOfMemoryError. Use this flag as a hint for Ignite to fetch result set lazily, thus minimizing memory + /// consumption at the cost of moderate performance hit. + /// <para /> + /// Default mode is lazy since version 2.7. The default value of the flag is changed to 'true'. + /// </summary> + public bool Lazy { get; set; } /// <summary> /// Returns a <see cref="string" /> that represents this instance. http://git-wip-us.apache.org/repos/asf/ignite/blob/de21856b/modules/yardstick/config/benchmark-native-sql-cache-select.properties ---------------------------------------------------------------------- diff --git a/modules/yardstick/config/benchmark-native-sql-cache-select.properties b/modules/yardstick/config/benchmark-native-sql-cache-select.properties new file mode 100644 index 0000000..cb397db --- /dev/null +++ b/modules/yardstick/config/benchmark-native-sql-cache-select.properties @@ -0,0 +1,96 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# +# Contains benchmarks for select queries +# + +now0=`date +'%H%M%S'` + +# JVM options. +JVM_OPTS=${JVM_OPTS}" -DIGNITE_QUIET=false" + +# Uncomment to enable concurrent garbage collection (GC) if you encounter long GC pauses. +JVM_OPTS=${JVM_OPTS}" \ +-Xms8g \ +-Xmx8g \ +-Xloggc:./gc${now0}.log \ +-XX:+PrintGCDetails \ +-verbose:gc \ +-XX:+UseParNewGC \ +-XX:+UseConcMarkSweepGC \ +-XX:+PrintGCDateStamps \ +" + +# Add to JVM_OPTS to generate JFR profile. +#-XX:+UnlockCommercialFeatures \ +#-XX:+FlightRecorder -XX:StartFlightRecording=delay=300s,duration=120s,filename=#filename#.jfr \ + +#Ignite version +ver="RELEASE-" + +# List of default probes. +# Add DStatProbe or VmStatProbe if your OS supports it (e.g. if running on Linux). +BENCHMARK_DEFAULT_PROBES=ThroughputLatencyProbe,PercentileProbe,DStatProbe + +# Packages where the specified benchmark is searched by reflection mechanism. +BENCHMARK_PACKAGES=org.yardstickframework,org.apache.ignite.yardstick + +# Flag which indicates to restart the servers before every benchmark execution. +RESTART_SERVERS=true + +# Probe point writer class name. +# BENCHMARK_WRITER= + +# The benchmark is applicable only for 1 server and 1 driver +SERVER_HOSTS=127.0.0.1,127.0.0.1 +DRIVER_HOSTS=127.0.0.1 + +# Remote username. +# REMOTE_USER= + +# Number of nodes, used to wait for the specified number of nodes to start. +nodesNum=$((`echo ${SERVER_HOSTS} | tr ',' '\n' | wc -l` + `echo ${DRIVER_HOSTS} | tr ',' '\n' | wc -l`)) + +# Backups count. +b=1 + +# Warmup. +w=60 + +# Duration. +d=300 + +# Threads count. +t=4 + +# Sync mode. +sm=PRIMARY_SYNC + +# Jobs. +j=10 + +# Run configuration which contains all benchmarks. +# Note that each benchmark is set to run for 300 seconds (5 min) with warm-up set to 60 seconds (1 minute). +CONFIGS="\ +-cfg ${SCRIPT_DIR}/../config/ignite-localhost-sql-query-config.xml -nn ${nodesNum} -w ${w} -d ${d} -t ${t} -sm ${sm} --sqlRange 1 -dn NativeSqlCacheQueryRangeBenchmark -sn IgniteNode --lazy false -ds ${ver}sql-select-native-r1-${b}-backup,\ +-cfg ${SCRIPT_DIR}/../config/ignite-localhost-sql-query-config.xml -nn ${nodesNum} -w ${w} -d ${d} -t ${t} -sm ${sm} --sqlRange 1000 -dn NativeSqlCacheQueryRangeBenchmark -sn IgniteNode --lazy false -ds ${ver}sql-select-native-r1K-${b}-backup,\ +-cfg ${SCRIPT_DIR}/../config/ignite-localhost-sql-query-config.xml -nn ${nodesNum} -w ${w} -d ${d} -t ${t} -sm ${sm} --sqlRange 2000 -dn NativeSqlCacheQueryRangeBenchmark -sn IgniteNode --lazy false -ds ${ver}sql-select-native-r2K-${b}-backup,\ +-cfg ${SCRIPT_DIR}/../config/ignite-localhost-sql-query-config.xml -nn ${nodesNum} -w ${w} -d ${d} -t ${t} -sm ${sm} --sqlRange 0 -dn NativeSqlCacheQueryRangeBenchmark -sn IgniteNode --lazy false -ds ${ver}sql-select-native-r1M-${b}-backup,\ +-cfg ${SCRIPT_DIR}/../config/ignite-localhost-sql-query-config.xml -nn ${nodesNum} -w ${w} -d ${d} -t ${t} -sm ${sm} --sqlRange 1 -dn NativeSqlCacheQueryRangeBenchmark -sn IgniteNode --lazy true -ds ${ver}sql-select-native-r1-lazy-${b}-backup,\ +-cfg ${SCRIPT_DIR}/../config/ignite-localhost-sql-query-config.xml -nn ${nodesNum} -w ${w} -d ${d} -t ${t} -sm ${sm} --sqlRange 1000 -dn NativeSqlCacheQueryRangeBenchmark -sn IgniteNode --lazy true -ds ${ver}sql-select-native-r1K-lazy-${b}-backup,\ +-cfg ${SCRIPT_DIR}/../config/ignite-localhost-sql-query-config.xml -nn ${nodesNum} -w ${w} -d ${d} -t ${t} -sm ${sm} --sqlRange 2000 -dn NativeSqlCacheQueryRangeBenchmark -sn IgniteNode --lazy true -ds ${ver}sql-select-native-r2K-lazy-${b}-backup,\ +-cfg ${SCRIPT_DIR}/../config/ignite-localhost-sql-query-config.xml -nn ${nodesNum} -w ${w} -d ${d} -t ${t} -sm ${sm} --sqlRange 0 -dn NativeSqlCacheQueryRangeBenchmark -sn IgniteNode --lazy true -ds ${ver}sql-select-native-r1M-lazy-${b}-backup,\ +" http://git-wip-us.apache.org/repos/asf/ignite/blob/de21856b/modules/yardstick/config/benchmark-native-sql-select.properties ---------------------------------------------------------------------- diff --git a/modules/yardstick/config/benchmark-native-sql-select.properties b/modules/yardstick/config/benchmark-native-sql-select.properties index 0f0b606..23b78be 100644 --- a/modules/yardstick/config/benchmark-native-sql-select.properties +++ b/modules/yardstick/config/benchmark-native-sql-select.properties @@ -51,8 +51,8 @@ RESTART_SERVERS=true # BENCHMARK_WRITER= # The benchmark is applicable only for 1 server and 1 driver -SERVER_HOSTS=127.0.0.1 -DRIVER_HOSTS=127.0.0.1 +SERVER_HOSTS=127.0.0.1,127.0.0.1 +DRIVER_HOSTS=127.0.0.1,127.0.0.1,127.0.0.1 # Remote username. # REMOTE_USER= @@ -64,7 +64,7 @@ nodesNum=$((`echo ${SERVER_HOSTS} | tr ',' '\n' | wc -l` + `echo ${DRIVER_HOSTS} b=1 # Warmup. -w=30 +w=60 # Duration. d=300 @@ -81,6 +81,13 @@ j=10 # Run configuration which contains all benchmarks. # Note that each benchmark is set to run for 300 seconds (5 min) with warm-up set to 60 seconds (1 minute). CONFIGS="\ --cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} --sqlRange 1 -dn NativeSqlQueryRangeBenchmark -sn IgniteNode -ds ${ver}sql-select-native-r1-${b}-backup -cl,\ --cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} --sqlRange 1000 -dn NativeSqlQueryRangeBenchmark -sn IgniteNode -ds ${ver}sql-select-native-r1000-${b}-backup -cl,\ +-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} --sqlRange 1 -dn NativeSqlQueryRangeBenchmark -sn IgniteNode -ds ${ver}sql-select-native-backups-${b}-r1 -cl --lazy false,\ +-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} --sqlRange 1000 -dn NativeSqlQueryRangeBenchmark -sn IgniteNode -ds ${ver}sql-select-native-backups-${b}-r1K -cl --lazy false,\ +-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} --sqlRange 0 -dn NativeSqlQueryRangeBenchmark -sn IgniteNode -ds ${ver}sql-select-native-backups-${b}-r1M -cl --lazy false,\ +-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} --sqlRange 1 -dn NativeSqlQueryRangeBenchmark -sn IgniteNode -ds ${ver}sql-select-native-backups-${b}-r1-lazy -cl --lazy true,\ +-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} --sqlRange 1000 -dn NativeSqlQueryRangeBenchmark -sn IgniteNode -ds ${ver}sql-select-native-backups-${b}-r1K-lazy -cl --lazy true,\ +-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} --sqlRange 0 -dn NativeSqlQueryRangeBenchmark -sn IgniteNode -ds ${ver}sql-select-native-backups-${b}-r1M-lazy -cl --lazy true,\ +" +CONFIGS="\ +-cfg ${SCRIPT_DIR}/../config/ignite-localhost-config.xml -nn ${nodesNum} -b ${b} -w ${w} -d ${d} -t ${t} -sm ${sm} --sqlRange 1 -dn NativeSqlQueryRangeBenchmark -sn IgniteNode -ds ${ver}sql-select-native-backups-${b}-r1 -cl --lazy false -r 10000,\ " http://git-wip-us.apache.org/repos/asf/ignite/blob/de21856b/modules/yardstick/config/ignite-localhost-sql-query-config.xml ---------------------------------------------------------------------- diff --git a/modules/yardstick/config/ignite-localhost-sql-query-config.xml b/modules/yardstick/config/ignite-localhost-sql-query-config.xml new file mode 100644 index 0000000..79a4de6 --- /dev/null +++ b/modules/yardstick/config/ignite-localhost-sql-query-config.xml @@ -0,0 +1,91 @@ +<?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-config.xml"/> + + <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"> + <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> + + <property name="communicationSpi"> + <bean class="org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi"> + <property name="sharedMemoryPort" value="-1"/> + </bean> + </property> + + <property name="cacheConfiguration"> + <list> + <bean class="org.apache.ignite.configuration.CacheConfiguration"> + <property name="name" value="test"/> + + <property name="backups" value="1"/> + + <property name="cacheMode" value="PARTITIONED"/> + + <property name="atomicityMode" value="ATOMIC"/> + + <property name="queryEntities"> + <list> + <bean class="org.apache.ignite.cache.QueryEntity"> + <property name="keyType" value="java.lang.Long"/> + <property name="valueType" value="TEST_LONG"/> + <property name="tableName" value="TEST_LONG"/> + <property name="keyFieldName" value="ID"/> + + <property name="fields"> + <map> + <entry key="ID" value="java.lang.Long"/> + <entry key="VAL" value="java.lang.Long"/> + </map> + </property> + </bean> + </list> + </property> + </bean> + </list> + </property> + </bean> +</beans> http://git-wip-us.apache.org/repos/asf/ignite/blob/de21856b/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 5aec308..21442dc 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 @@ -17,9 +17,10 @@ package org.apache.ignite.yardstick; -import java.util.concurrent.CountDownLatch; import java.util.concurrent.ThreadLocalRandom; +import java.util.concurrent.TimeUnit; import org.apache.ignite.Ignite; +import org.apache.ignite.IgniteCountDownLatch; import org.apache.ignite.IgniteLogger; import org.apache.ignite.IgniteState; import org.apache.ignite.Ignition; @@ -29,6 +30,7 @@ import org.yardstickframework.BenchmarkConfiguration; import org.yardstickframework.BenchmarkDriverAdapter; import org.yardstickframework.BenchmarkUtils; +import static org.apache.ignite.events.EventType.EVTS_DISCOVERY; import static org.apache.ignite.events.EventType.EVT_NODE_JOINED; import static org.yardstickframework.BenchmarkUtils.jcommander; import static org.yardstickframework.BenchmarkUtils.println; @@ -37,6 +39,8 @@ import static org.yardstickframework.BenchmarkUtils.println; * Abstract class for Ignite benchmarks. */ public abstract class IgniteAbstractBenchmark extends BenchmarkDriverAdapter { + private static final long WAIT_NODES_TIMEOUT = TimeUnit.SECONDS.toMillis(30); + /** Arguments. */ protected final IgniteBenchmarkArguments args = new IgniteBenchmarkArguments(); @@ -126,22 +130,30 @@ public abstract class IgniteAbstractBenchmark extends BenchmarkDriverAdapter { * @throws Exception If failed. */ private void waitForNodes() throws Exception { - final CountDownLatch nodesStartedLatch = new CountDownLatch(1); + IgniteCountDownLatch allNodesReady = ignite().countDownLatch("allNodesReady", 1, false, true); + // wait for condition when all nodes are ready and release distributed barrier. ignite().events().localListen(new IgnitePredicate<Event>() { @Override public boolean apply(Event gridEvt) { - if (nodesStarted()) - nodesStartedLatch.countDown(); + if (nodesStarted()) { + allNodesReady.countDown(); + // todo: return false so unregister? + } return true; } - }, EVT_NODE_JOINED); + }, EVTS_DISCOVERY); - if (!nodesStarted()) { - println(cfg, "Waiting for " + (args.nodes() - 1) + " nodes to start..."); + if (nodesStarted()) + allNodesReady.countDown(); - nodesStartedLatch.await(); - } + // block on distributed barrier till member 0 release it. + println(cfg, "Start waiting for cluster to contain " + args.nodes() + "."); + + //todo: timeouts? + allNodesReady.await(); + + println(cfg, "Cluster is ready."); } /** http://git-wip-us.apache.org/repos/asf/ignite/blob/de21856b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java ---------------------------------------------------------------------- diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java index 3f4fddc..3bd5e87 100644 --- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java +++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java @@ -289,6 +289,12 @@ public class IgniteBenchmarkArguments { @GridToStringInclude public long mvccContentionRange = 10_000; + /** */ + @Parameter(names = {"--lazy"}, + arity = 1, + description = "Lazy mode for SQL query execution (default true).") + private boolean lazy = true; + /** * @return {@code True} if need set {@link DataStorageConfiguration}. */ @@ -712,6 +718,13 @@ public class IgniteBenchmarkArguments { return mvccContentionRange; } + /** + * @return Lazy query execution mode. + */ + public boolean isLazy() { + return lazy; + } + /** {@inheritDoc} */ @Override public String toString() { return GridToStringBuilder.toString(IgniteBenchmarkArguments.class, this); http://git-wip-us.apache.org/repos/asf/ignite/blob/de21856b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/AbstractNativeBenchmark.java ---------------------------------------------------------------------- diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/AbstractNativeBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/AbstractNativeBenchmark.java index 129e6a4..0f99a9d 100644 --- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/AbstractNativeBenchmark.java +++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/AbstractNativeBenchmark.java @@ -21,6 +21,7 @@ import org.apache.ignite.cache.query.SqlFieldsQuery; import org.apache.ignite.internal.IgniteEx; import org.apache.ignite.yardstick.IgniteAbstractBenchmark; import org.yardstickframework.BenchmarkConfiguration; +import org.yardstickframework.BenchmarkUtils; import static org.apache.ignite.yardstick.jdbc.JdbcUtils.fillData; @@ -33,5 +34,7 @@ public abstract class AbstractNativeBenchmark extends IgniteAbstractBenchmark { super.setUp(cfg); fillData(cfg, (IgniteEx)ignite(), args.range(), args.atomicMode()); + + BenchmarkUtils.println("Lazy mode: " + args.isLazy()); } } http://git-wip-us.apache.org/repos/asf/ignite/blob/de21856b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/JdbcUtils.java ---------------------------------------------------------------------- diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/JdbcUtils.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/JdbcUtils.java index 81d6c17..4466f89 100644 --- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/JdbcUtils.java +++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/JdbcUtils.java @@ -17,6 +17,7 @@ package org.apache.ignite.yardstick.jdbc; +import org.apache.ignite.IgniteSemaphore; import org.apache.ignite.cache.CacheAtomicityMode; import org.apache.ignite.cache.query.SqlFieldsQuery; import org.apache.ignite.internal.IgniteEx; @@ -33,30 +34,46 @@ public class JdbcUtils { * @param cfg Benchmark configuration. * @param ignite Ignite node. * @param range Data key range. + * @param atomicMode Cache atomic mode. */ public static void fillData(BenchmarkConfiguration cfg, IgniteEx ignite, long range, CacheAtomicityMode atomicMode) { - println(cfg, "Create table..."); + IgniteSemaphore sem = ignite.semaphore("jdbc-setup", 1, true, true); - String withExpr = atomicMode != null ? " WITH \"atomicity=" + atomicMode.name() + "\";" : ";"; + try { + if (sem.tryAcquire()) { + println(cfg, "Create table..."); - String qry = "CREATE TABLE test_long (id long primary key, val long)" + withExpr; + String withExpr = atomicMode != null ? " WITH \"atomicity=" + atomicMode.name() + "\";" : ";"; - println(cfg, "Creating table with schema: " + qry); + String qry = "CREATE TABLE test_long (id long primary key, val long)" + withExpr; - ignite.context().query().querySqlFields( - new SqlFieldsQuery(qry), true); + println(cfg, "Creating table with schema: " + qry); - println(cfg, "Populate data..."); + ignite.context().query().querySqlFields( + new SqlFieldsQuery(qry), true); - for (long l = 1; l <= range; ++l) { - ignite.context().query().querySqlFields( - new SqlFieldsQuery("insert into test_long (id, val) values (?, ?)") - .setArgs(l, l + 1), true); + println(cfg, "Populate data..."); - if (l % 10000 == 0) - println(cfg, "Populate " + l); - } + for (long l = 1; l <= range; ++l) { + ignite.context().query().querySqlFields( + new SqlFieldsQuery("insert into test_long (id, val) values (?, ?)") + .setArgs(l, l + 1), true); + + if (l % 10000 == 0) + println(cfg, "Populate " + l); + } + + println(cfg, "Finished populating data"); + } + else { + // Acquire (wait setup by other client) and immediately release/ + println(cfg, "Waits for setup..."); - println(cfg, "Finished populating data"); + sem.acquire(); + } + } + finally { + sem.release(); + } } } http://git-wip-us.apache.org/repos/asf/ignite/blob/de21856b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/NativeSqlCacheQueryRangeBenchmark.java ---------------------------------------------------------------------- diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/NativeSqlCacheQueryRangeBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/NativeSqlCacheQueryRangeBenchmark.java new file mode 100644 index 0000000..e361c9a --- /dev/null +++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/NativeSqlCacheQueryRangeBenchmark.java @@ -0,0 +1,145 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.yardstick.jdbc; + +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ThreadLocalRandom; +import org.apache.ignite.IgniteCache; +import org.apache.ignite.IgniteSemaphore; +import org.apache.ignite.cache.query.FieldsQueryCursor; +import org.apache.ignite.cache.query.SqlFieldsQuery; +import org.apache.ignite.configuration.CacheConfiguration; +import org.apache.ignite.internal.IgniteEx; +import org.apache.ignite.yardstick.IgniteAbstractBenchmark; +import org.yardstickframework.BenchmarkConfiguration; +import org.yardstickframework.BenchmarkUtils; + +import static org.apache.ignite.yardstick.jdbc.JdbcUtils.fillData; +import static org.yardstickframework.BenchmarkUtils.println; + +/** + * Native sql benchmark that performs select operations. + */ +public class NativeSqlCacheQueryRangeBenchmark extends IgniteAbstractBenchmark { + private IgniteCache cache; + + /** {@inheritDoc} */ + @Override public void setUp(BenchmarkConfiguration cfg) throws Exception { + super.setUp(cfg); + + fillData(); + + BenchmarkUtils.println("Lazy mode: " + args.isLazy()); + } + + /** + * + */ + private void fillData() { + IgniteEx ignite = (IgniteEx)ignite(); + + IgniteSemaphore sem = ignite.semaphore("data-setup", 1, true, true); + + cache = ignite.getOrCreateCache("test").withKeepBinary(); + + try { + if (sem.tryAcquire()) { + + println(cfg, "Populate data..."); + + for (long l = 1; l <= args.range(); ++l) { + cache.query( + new SqlFieldsQuery("insert into test_long(id, val) values (?, ?)") + .setArgs(l, l + 1)); + + if (l % 10000 == 0) + println(cfg, "Populate " + l); + } + + println(cfg, "Finished populating data"); + } + else { + // Acquire (wait setup by other client) and immediately release/ + println(cfg, "Waits for setup..."); + + sem.acquire(); + } + } + finally { + sem.release(); + } + } + + /** + * Benchmarked action that performs selects and validates results. + * + * {@inheritDoc} + */ + @Override public boolean test(Map<Object, Object> ctx) throws Exception { + long expRsSize; + + SqlFieldsQuery qry; + + if (args.sqlRange() == 1) { + qry = new SqlFieldsQuery("SELECT id, val FROM test_long WHERE id = ?"); + + qry.setArgs(ThreadLocalRandom.current().nextLong(args.range()) + 1); + + expRsSize = 1; + } + else if (args.sqlRange() <= 0) { + qry = new SqlFieldsQuery("SELECT id, val FROM test_long"); + + expRsSize = args.range(); + } + else { + qry = new SqlFieldsQuery("SELECT id, val FROM test_long WHERE id BETWEEN ? AND ?"); + + long id = ThreadLocalRandom.current().nextLong(args.range() - args.sqlRange()) + 1; + long maxId = id + args.sqlRange() - 1; + + qry.setArgs(id, maxId); + + expRsSize = args.sqlRange(); + } + + qry.setLazy(args.isLazy()); + + long rsSize = 0; + + try (FieldsQueryCursor<List<?>> cursor = cache.query(qry)) { + Iterator<List<?>> it = cursor.iterator(); + + while (it.hasNext()) { + List<?> row = it.next(); + + if ((Long)row.get(0) + 1 != (Long)row.get(1)) + throw new Exception("Invalid result retrieved"); + + rsSize++; + } + } + + if (rsSize != expRsSize) + throw new Exception("Invalid result set size [actual=" + rsSize + ", expected=" + expRsSize + ']'); + + return true; + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/de21856b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/NativeSqlQueryRangeBenchmark.java ---------------------------------------------------------------------- diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/NativeSqlQueryRangeBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/NativeSqlQueryRangeBenchmark.java index 8dcdda7..33630fd 100644 --- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/NativeSqlQueryRangeBenchmark.java +++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/jdbc/NativeSqlQueryRangeBenchmark.java @@ -17,6 +17,7 @@ package org.apache.ignite.yardstick.jdbc; +import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.concurrent.ThreadLocalRandom; @@ -45,6 +46,11 @@ public class NativeSqlQueryRangeBenchmark extends AbstractNativeBenchmark { expRsSize = 1; } + else if (args.sqlRange() <= 0) { + qry = new SqlFieldsQuery("SELECT id, val FROM test_long"); + + expRsSize = args.range(); + } else { qry = new SqlFieldsQuery("SELECT id, val FROM test_long WHERE id BETWEEN ? AND ?"); @@ -56,12 +62,17 @@ public class NativeSqlQueryRangeBenchmark extends AbstractNativeBenchmark { expRsSize = args.sqlRange(); } + qry.setLazy(args.isLazy()); + long rsSize = 0; try (FieldsQueryCursor<List<?>> cursor = ((IgniteEx)ignite()).context().query() .querySqlFields(qry, false)) { + Iterator<List<?>> it = cursor.iterator(); + + while (it.hasNext()) { + List<?> row = it.next(); - for (List<?> row : cursor) { if ((Long)row.get(0) + 1 != (Long)row.get(1)) throw new Exception("Invalid result retrieved");
