You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2015/11/05 09:10:27 UTC

[2/3] ignite git commit: ignite-1282 - Benchmarks.

ignite-1282 - Benchmarks.


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

Branch: refs/heads/ignite-1816
Commit: f7b308f9a31f19820d95f6276321a5e8d0cab673
Parents: 230a629
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Thu Nov 5 10:46:02 2015 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Thu Nov 5 10:46:02 2015 +0300

----------------------------------------------------------------------
 .../cache/IgniteSqlQueryPutBenchmark.java       | 26 ++++++++++++++++++++
 1 file changed, 26 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/f7b308f9/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
index ea9531a..606c68f 100644
--- 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
@@ -24,12 +24,19 @@ import javax.cache.Cache;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.cache.query.SqlQuery;
 import org.apache.ignite.yardstick.cache.model.Person;
+import org.jsr166.LongAdder8;
 import org.yardstickframework.BenchmarkConfiguration;
 
 /**
  * Ignite benchmark that performs put and query operations.
  */
 public class IgniteSqlQueryPutBenchmark extends IgniteCacheAbstractBenchmark {
+    /** */
+    private LongAdder8 resCnt = new LongAdder8();
+
+    /** */
+    private LongAdder8 cnt = new LongAdder8();
+
     /** {@inheritDoc} */
     @Override public void setUp(BenchmarkConfiguration cfg) throws Exception {
         super.setUp(cfg);
@@ -52,7 +59,11 @@ public class IgniteSqlQueryPutBenchmark extends IgniteCacheAbstractBenchmark {
                 if (p.getSalary() < salary || p.getSalary() > maxSalary)
                     throw new Exception("Invalid person retrieved [min=" + salary + ", max=" + maxSalary +
                             ", person=" + p + ']');
+
+                resCnt.increment();
             }
+
+            cnt.increment();
         }
         else {
             int i = rnd.nextInt(args.range());
@@ -63,6 +74,21 @@ public class IgniteSqlQueryPutBenchmark extends IgniteCacheAbstractBenchmark {
         return true;
     }
 
+    /** {@inheritDoc} */
+    @Override public void onWarmupFinished() {
+        super.onWarmupFinished();
+
+        resCnt.reset();
+        cnt.reset();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void tearDown() throws Exception {
+        ignite().log().info("Average number of entries per query: " + (resCnt.longValue() / cnt.longValue()));
+
+        super.tearDown();
+    }
+
     /**
      * @param minSalary Min salary.
      * @param maxSalary Max salary.