You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by he...@apache.org on 2019/12/02 19:35:14 UTC

[geode-benchmarks] branch develop updated: stabilize putall tests (#118)

This is an automated email from the ASF dual-hosted git repository.

heybales pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode-benchmarks.git


The following commit(s) were added to refs/heads/develop by this push:
     new 48be42f  stabilize putall tests (#118)
48be42f is described below

commit 48be42f21416ca2f8387129b92c56a298aedfd3d
Author: Helena Bales <hb...@pivotal.io>
AuthorDate: Mon Dec 2 11:35:04 2019 -0800

    stabilize putall tests (#118)
---
 geode-benchmarks/build.gradle                        |  1 -
 .../org/apache/geode/benchmark/tasks/PutAllTask.java | 20 +++++++++++++-------
 .../benchmark/tests/PartitionedPutAllBenchmark.java  |  2 +-
 3 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/geode-benchmarks/build.gradle b/geode-benchmarks/build.gradle
index 5651d05..0abe0dc 100644
--- a/geode-benchmarks/build.gradle
+++ b/geode-benchmarks/build.gradle
@@ -66,7 +66,6 @@ task benchmark(type: Test) {
   exclude "**/*NonIndexedQueryBenchmark.class"
   exclude "**/PartitionedFunctionExecutionBenchmark.class"
   exclude "**/NoopBenchmark.class"
-  exclude "**/*AllBenchmark.class"
   exclude "**/*LongBenchmark.class"
 
   forkEvery 1
diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/PutAllTask.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/PutAllTask.java
index 234a049..50cc17b 100644
--- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/PutAllTask.java
+++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/PutAllTask.java
@@ -37,6 +37,9 @@ public class PutAllTask extends BenchmarkDriverAdapter implements Serializable {
 
   private Region<Object, Object> region;
 
+  private ThreadLocal<HashMap<Object, Object>> batches;
+
+
   public PutAllTask(LongRange keyRange, int batchSize) {
     this.keyRange = keyRange;
     this.batchSize = batchSize;
@@ -47,17 +50,20 @@ public class PutAllTask extends BenchmarkDriverAdapter implements Serializable {
     super.setUp(cfg);
     ClientCache cache = ClientCacheFactory.getAnyInstance();
     region = cache.getRegion("region");
+
+    batches = ThreadLocal.withInitial(() -> {
+      final HashMap<Object, Object> batch = new HashMap<>(batchSize);
+      for (int i = 0; i < batchSize; i++) {
+        long key = keyRange.random();
+        batch.put(key, new Portfolio(key));
+      }
+      return batch;
+    });
   }
 
   @Override
   public boolean test(Map<Object, Object> ctx) {
-    long key;
-    final HashMap<Object, Object> batch = new HashMap<>(batchSize);
-    for (int i = 0; i < batchSize; i++) {
-      key = keyRange.random();
-      batch.put(key, new Portfolio(key));
-    }
-    region.putAll(batch);
+    region.putAll(batches.get());
     return true;
   }
 }
diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PartitionedPutAllBenchmark.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PartitionedPutAllBenchmark.java
index 8a76653..79dc413 100644
--- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PartitionedPutAllBenchmark.java
+++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PartitionedPutAllBenchmark.java
@@ -39,7 +39,7 @@ public class PartitionedPutAllBenchmark implements PerformanceTest {
 
   private LongRange keyRange = new LongRange(0, 1000000);
 
-  private int batchSize = 1000;
+  private int batchSize = 100;
 
   public PartitionedPutAllBenchmark() {}