Skip to content
Permalink
Browse files
stabilize putall tests (#118)
  • Loading branch information
nonbinaryprogrammer committed Dec 2, 2019
1 parent 3d02d10 commit 48be42f21416ca2f8387129b92c56a298aedfd3d
Showing 3 changed files with 14 additions and 9 deletions.
@@ -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
@@ -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 void setUp(BenchmarkConfiguration cfg) throws Exception {
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;
}
}
@@ -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() {}

0 comments on commit 48be42f

Please sign in to comment.