Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 360C5200B60 for ; Thu, 7 Jul 2016 08:01:32 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 34CE2160A73; Thu, 7 Jul 2016 06:01:32 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 49689160A9C for ; Thu, 7 Jul 2016 08:01:29 +0200 (CEST) Received: (qmail 81466 invoked by uid 500); 7 Jul 2016 06:01:28 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 79976 invoked by uid 99); 7 Jul 2016 06:01:27 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Jul 2016 06:01:27 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 317C6E9411; Thu, 7 Jul 2016 06:01:27 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sboikov@apache.org To: commits@ignite.apache.org Date: Thu, 07 Jul 2016 06:02:06 -0000 Message-Id: <7fbe294671d143a5a7a767c176f3db86@git.apache.org> In-Reply-To: <078d677a2cf641a7b437be012bf63361@git.apache.org> References: <078d677a2cf641a7b437be012bf63361@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [41/50] [abbrv] ignite git commit: gg-11253: load tests based on SB cases archived-at: Thu, 07 Jul 2016 06:01:32 -0000 gg-11253: load tests based on SB cases Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f267a304 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f267a304 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f267a304 Branch: refs/heads/ignite-1232 Commit: f267a3042d79969405f957301bfb4ad462c7344f Parents: aabe815 Author: Denis Magda Authored: Wed Jul 6 13:05:14 2016 +0300 Committer: Denis Magda Committed: Wed Jul 6 13:05:14 2016 +0300 ---------------------------------------------------------------------- modules/yardstick/pom.xml | 46 +++--- .../IgniteCacheRandomOperationBenchmark.java | 147 ++++++++++++------- .../yardstick/cache/load/model/ModelUtil.java | 6 +- 3 files changed, 124 insertions(+), 75 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/f267a304/modules/yardstick/pom.xml ---------------------------------------------------------------------- diff --git a/modules/yardstick/pom.xml b/modules/yardstick/pom.xml index a0f7de5..51d714e 100644 --- a/modules/yardstick/pom.xml +++ b/modules/yardstick/pom.xml @@ -137,7 +137,7 @@ copy-dependencies - ${basedir}/libs + ${basedir}/target/assembly/libs pom @@ -155,7 +155,7 @@ ${yardstick.version} zip resources - ${basedir} + ${basedir}/target/assembly @@ -168,36 +168,40 @@ maven-jar-plugin 2.4 - ${basedir}/libs + ${basedir}/target/assembly/libs org.apache.maven.plugins - maven-clean-plugin - 2.5 - - - - ${basedir}/bin - - - ${basedir}/libs - - **/*.jar - - - - - - - org.apache.maven.plugins maven-javadoc-plugin 2.9.1 true + + + org.apache.maven.plugins + maven-antrun-plugin + 1.7 + + + copy-yardstick-cfg-ignite + + run + + validate + + + + + + + + + + http://git-wip-us.apache.org/repos/asf/ignite/blob/f267a304/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/IgniteCacheRandomOperationBenchmark.java ---------------------------------------------------------------------- diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/IgniteCacheRandomOperationBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/IgniteCacheRandomOperationBenchmark.java index e676b38..c2947ba 100644 --- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/IgniteCacheRandomOperationBenchmark.java +++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/load/IgniteCacheRandomOperationBenchmark.java @@ -141,7 +141,7 @@ public class IgniteCacheRandomOperationBenchmark extends IgniteAbstractBenchmark /** {@inheritDoc} */ @Override public void onException(Throwable e) { - BenchmarkUtils.errorHelp(cfg, "The benchmark of random operation failed."); + BenchmarkUtils.error("The benchmark of random operation failed.", e); super.onException(e); } @@ -217,26 +217,34 @@ public class IgniteCacheRandomOperationBenchmark extends IgniteAbstractBenchmark Collection entries = configuration.getQueryEntities(); for (QueryEntity queryEntity : entries) { - if (queryEntity.getKeyType() != null) { - Class keyCls = Class.forName(queryEntity.getKeyType()); - - if (ModelUtil.canCreateInstance(keyCls)) - keys.add(keyCls); - else - throw new IgniteException("Class is unknown for the load test. Make sure you " + - "specified its full name [clsName=" + queryEntity.getKeyType() + ']'); - } - - if (queryEntity.getValueType() != null) { - Class valCls = Class.forName(queryEntity.getValueType()); - - if (ModelUtil.canCreateInstance(valCls)) - values.add(valCls); - else - throw new IgniteException("Class is unknown for the load test. Make sure you " + - "specified its full name [clsName=" + queryEntity.getKeyType() + ']'); - - cofigureCacheSqlDescriptor(cacheName, queryEntity, valCls); + try { + if (queryEntity.getKeyType() != null) { + Class keyCls = Class.forName(queryEntity.getKeyType()); + + if (ModelUtil.canCreateInstance(keyCls)) + keys.add(keyCls); + else + throw new IgniteException("Class is unknown for the load test. Make sure you " + + "specified its full name [clsName=" + queryEntity.getKeyType() + ']'); + } + + if (queryEntity.getValueType() != null) { + Class valCls = Class.forName(queryEntity.getValueType()); + + if (ModelUtil.canCreateInstance(valCls)) + values.add(valCls); + else + throw new IgniteException("Class is unknown for the load test. Make sure you " + + "specified its full name [clsName=" + queryEntity.getKeyType() + ']'); + + cofigureCacheSqlDescriptor(cacheName, queryEntity, valCls); + } + } catch (ClassNotFoundException e) { + BenchmarkUtils.println(e.getMessage()); + BenchmarkUtils.println("This can be a BinaryObject. Ignoring exception."); + + if (!cacheSqlDescriptors.containsKey(cacheName)) + cacheSqlDescriptors.put(cacheName, new ArrayList()); } } } @@ -245,31 +253,36 @@ public class IgniteCacheRandomOperationBenchmark extends IgniteAbstractBenchmark Collection entries = configuration.getTypeMetadata(); for (CacheTypeMetadata cacheTypeMetadata : entries) { - if (cacheTypeMetadata.getKeyType() != null) { - Class keyCls = Class.forName(cacheTypeMetadata.getKeyType()); - - if (ModelUtil.canCreateInstance(keyCls)) - keys.add(keyCls); - else - throw new IgniteException("Class is unknown for the load test. Make sure you " + - "specified its full name [clsName=" + cacheTypeMetadata.getKeyType() + ']'); - } - - if (cacheTypeMetadata.getValueType() != null) { - Class valCls = Class.forName(cacheTypeMetadata.getValueType()); - - if (ModelUtil.canCreateInstance(valCls)) - values.add(valCls); - else - throw new IgniteException("Class is unknown for the load test. Make sure you " + - "specified its full name [clsName=" + cacheTypeMetadata.getKeyType() + ']'); + try { + if (cacheTypeMetadata.getKeyType() != null) { + Class keyCls = Class.forName(cacheTypeMetadata.getKeyType()); + + if (ModelUtil.canCreateInstance(keyCls)) + keys.add(keyCls); + else + throw new IgniteException("Class is unknown for the load test. Make sure you " + + "specified its full name [clsName=" + cacheTypeMetadata.getKeyType() + ']'); + } + + if (cacheTypeMetadata.getValueType() != null) { + Class valCls = Class.forName(cacheTypeMetadata.getValueType()); + + if (ModelUtil.canCreateInstance(valCls)) + values.add(valCls); + else + throw new IgniteException("Class is unknown for the load test. Make sure you " + + "specified its full name [clsName=" + cacheTypeMetadata.getKeyType() + ']'); + } + } catch (ClassNotFoundException e) { + BenchmarkUtils.println(e.getMessage()); + BenchmarkUtils.println("This can be a BinaryObject. Ignoring exception."); + + if (!cacheSqlDescriptors.containsKey(cacheName)) + cacheSqlDescriptors.put(cacheName, new ArrayList()); } } } - if (keys.isEmpty() || values.isEmpty()) - continue; - keysCacheClasses.put(cacheName, keys.toArray(new Class[] {})); valuesCacheClasses.put(cacheName, values.toArray(new Class[] {})); @@ -857,26 +870,54 @@ public class IgniteCacheRandomOperationBenchmark extends IgniteAbstractBenchmark private void doSqlQuery(IgniteCache cache) throws Exception { List descriptors = cacheSqlDescriptors.get(cache.getName()); - if (descriptors != null && !descriptors.isEmpty()) { - SqlCacheDescriptor randomDesc = descriptors.get(nextRandom(descriptors.size())); + if (descriptors != null) { + Query sq = null; - int id = nextRandom(args.range()); + if (queries.isEmpty()) { + if (!descriptors.isEmpty()) { + SqlCacheDescriptor randomDesc = descriptors.get(nextRandom(descriptors.size())); - Query sq; - if (queries.isEmpty()) - sq = nextBoolean() ? randomDesc.getSqlQuery(id) : randomDesc.getSqlFieldsQuery(id); - else - sq = new SqlFieldsQuery(queries.get(nextRandom(queries.size()))); + int id = nextRandom(args.range()); - try (QueryCursor cursor = cache.query(sq)) { - for (Object obj : cursor) { - // No-op. + sq = nextBoolean() ? randomDesc.getSqlQuery(id) : randomDesc.getSqlFieldsQuery(id); } } + else { + String sql = rendomizeSql(); + + BenchmarkUtils.println(sql); + + sq = new SqlFieldsQuery(sql); + } + + if (sq != null) + try (QueryCursor cursor = cache.query(sq)) { + for (Object obj : cursor) { + // No-op. + } + } } } /** + * @return SQL string. + */ + private String rendomizeSql() { + String sql = queries.get(nextRandom(queries.size())); + + int count = StringUtils.countOccurrencesOf(sql, "%s"); + + Integer[] sub = new Integer[count]; + + for (int i=0; i