You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by nn...@apache.org on 2018/12/06 22:14:51 UTC
[geode-benchmarks] branch develop updated: GEODE-6084: Refactored
the benchmark code as per review. (#16)
This is an automated email from the ASF dual-hosted git repository.
nnag 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 8a03133 GEODE-6084: Refactored the benchmark code as per review. (#16)
8a03133 is described below
commit 8a03133adc1389b91a64b4693387344887166adc
Author: Nabarun Nag <na...@users.noreply.github.com>
AuthorDate: Thu Dec 6 14:14:47 2018 -0800
GEODE-6084: Refactored the benchmark code as per review. (#16)
---
.../benchmark/parameters/BenchmarkParameters.java | 62 ---------------
.../benchmark/tasks/CreateClientProxyRegion.java | 4 +-
.../benchmark/tasks/CreatePartitionedRegion.java | 4 +-
.../benchmark/tasks/CreateReplicatedRegion.java | 4 +-
.../geode/benchmark/tasks/PrePopulateRegion.java | 7 +-
.../apache/geode/benchmark/tasks/StartClient.java | 4 +-
.../apache/geode/benchmark/tasks/StartServer.java | 4 +-
.../geode/benchmark/tests/BenchmarkOperation.java | 93 ----------------------
...icatedPutBenchmark.java => GeodeBenchmark.java} | 26 +++---
.../apache/geode/benchmark/tests/GetBenchmark.java | 27 -------
.../benchmark/tests/PartitionedGetBenchmark.java | 23 +++++-
.../benchmark/tests/PartitionedPutBenchmark.java | 22 ++++-
.../apache/geode/benchmark/tests/PutBenchmark.java | 27 -------
.../benchmark/tests/ReplicatedGetBenchmark.java | 33 --------
.../{ => tests}/parameters/JVMParameters.java | 3 +-
.../benchmark/tests/util/ClientServerTopology.java | 59 ++++++++++++++
.../tests/PartitionedGetBenchmarkTest.java | 4 +-
.../tests/PartitionedPutBenchmarkTest.java | 4 +-
.../tests/ReplicatedGetBenchmarkTest.java | 34 --------
.../tests/ReplicatedPutBenchmarkTest.java | 34 --------
.../org/apache/geode/perftest/PerformanceTest.java | 2 +-
.../geode/perftest/runner/DefaultTestRunner.java | 3 +-
.../geode/perftest/TestRunnerIntegrationTest.java | 12 ++-
.../apache/geode/perftest/TestRunnerJUnitTest.java | 8 +-
24 files changed, 140 insertions(+), 363 deletions(-)
diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/parameters/BenchmarkParameters.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/parameters/BenchmarkParameters.java
deleted file mode 100644
index a3c3d3d..0000000
--- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/parameters/BenchmarkParameters.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.geode.benchmark.parameters;
-
-public class BenchmarkParameters {
-
- /**
- * All roles defined for the JVMs created for the benchmark
- */
- public class Roles {
- public static final String SERVER = "server";
- public static final String CLIENT = "client";
- public static final String LOCATOR = "locator";
- }
-
- /**
- * The port used to create the locator for the tests
- */
- public static final int LOCATOR_PORT = 10334;
-
- /**
- * Key range on which all the region operations are conducted on the default runner
- */
- public static final long KEY_RANGE = 1000;
-
- /**
- * Warm up time for the benchmark running on the default runner
- */
- public static final int WARM_UP_TIME = 60;
-
- /**
- * Total duration for which the benchmark will run on the default runner
- */
- public static final int BENCHMARK_DURATION = 240;
-
- /**
- * String key for the server cache attribute in the TestContext's attributeTree
- */
- public static final String SERVER_CACHE = "SERVER_CACHE";
-
- /**
- * String key for the client cache attribute in the TestContext's attributeTree
- */
- public static final String CLIENT_CACHE = "CLIENT_CACHE";
-
- /**
- * Key range on which all the region operations are conducted on a minimal runner
- */
- public static final long KEY_RANGE_FOR_MINIMAL_RUNNER = 5;
-}
diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/CreateClientProxyRegion.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/CreateClientProxyRegion.java
index ed724ee..5cf673c 100644
--- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/CreateClientProxyRegion.java
+++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/CreateClientProxyRegion.java
@@ -14,8 +14,6 @@
*/
package org.apache.geode.benchmark.tasks;
-import static org.apache.geode.benchmark.parameters.BenchmarkParameters.CLIENT_CACHE;
-
import org.apache.geode.cache.client.ClientCache;
import org.apache.geode.cache.client.ClientRegionShortcut;
import org.apache.geode.perftest.Task;
@@ -27,7 +25,7 @@ import org.apache.geode.perftest.TestContext;
public class CreateClientProxyRegion implements Task {
@Override
public void run(TestContext context) throws Exception {
- ClientCache clientCache = (ClientCache) context.getAttribute(CLIENT_CACHE);
+ ClientCache clientCache = (ClientCache) context.getAttribute("CLIENT_CACHE");
clientCache.createClientRegionFactory(ClientRegionShortcut.PROXY)
.create("region");
diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/CreatePartitionedRegion.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/CreatePartitionedRegion.java
index 546d030..1604dc5 100644
--- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/CreatePartitionedRegion.java
+++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/CreatePartitionedRegion.java
@@ -15,8 +15,6 @@
package org.apache.geode.benchmark.tasks;
-import static org.apache.geode.benchmark.parameters.BenchmarkParameters.SERVER_CACHE;
-
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.RegionShortcut;
import org.apache.geode.perftest.Task;
@@ -29,7 +27,7 @@ public class CreatePartitionedRegion implements Task {
@Override
public void run(TestContext context) throws Exception {
- Cache cache = (Cache) context.getAttribute(SERVER_CACHE);
+ Cache cache = (Cache) context.getAttribute("SERVER_CACHE");
cache.createRegionFactory(RegionShortcut.PARTITION).create("region");
}
}
diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/CreateReplicatedRegion.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/CreateReplicatedRegion.java
index b42eddc..51dbcd8 100644
--- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/CreateReplicatedRegion.java
+++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/CreateReplicatedRegion.java
@@ -14,8 +14,6 @@
*/
package org.apache.geode.benchmark.tasks;
-import static org.apache.geode.benchmark.parameters.BenchmarkParameters.SERVER_CACHE;
-
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.RegionShortcut;
import org.apache.geode.perftest.Task;
@@ -27,7 +25,7 @@ import org.apache.geode.perftest.TestContext;
public class CreateReplicatedRegion implements Task {
@Override
public void run(TestContext context) throws Exception {
- Cache cache = (Cache) context.getAttribute(SERVER_CACHE);
+ Cache cache = (Cache) context.getAttribute("SERVER_CACHE");
cache.createRegionFactory(RegionShortcut.REPLICATE).create("region");
}
}
diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/PrePopulateRegion.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/PrePopulateRegion.java
index 8873452..462f0b3 100644
--- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/PrePopulateRegion.java
+++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/PrePopulateRegion.java
@@ -16,9 +16,6 @@
*/
package org.apache.geode.benchmark.tasks;
-import static org.apache.geode.benchmark.parameters.BenchmarkParameters.KEY_RANGE;
-import static org.apache.geode.benchmark.parameters.BenchmarkParameters.SERVER_CACHE;
-
import java.time.Duration;
import java.time.Instant;
import java.util.concurrent.ThreadLocalRandom;
@@ -35,7 +32,7 @@ import org.apache.geode.perftest.TestContext;
import org.apache.geode.perftest.jvms.RemoteJVMFactory;
public class PrePopulateRegion implements Task {
- long keyRangeToPrepopulate = KEY_RANGE;
+ long keyRangeToPrepopulate = 10000;
private static final Logger logger = LoggerFactory.getLogger(RemoteJVMFactory.class);
public PrePopulateRegion() {}
@@ -51,7 +48,7 @@ public class PrePopulateRegion implements Task {
*/
@Override
public void run(TestContext context) {
- Cache serverCache = (Cache) context.getAttribute(SERVER_CACHE);
+ Cache serverCache = (Cache) context.getAttribute("SERVER_CACHE");
Region region = serverCache.getRegion("region");
logger.info("*******************************************");
logger.info(" Prepopulating the region ");
diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/StartClient.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/StartClient.java
index 9738578..555c4de 100644
--- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/StartClient.java
+++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/StartClient.java
@@ -17,8 +17,6 @@
package org.apache.geode.benchmark.tasks;
-import static org.apache.geode.benchmark.parameters.BenchmarkParameters.CLIENT_CACHE;
-
import java.io.File;
import java.net.InetAddress;
@@ -51,6 +49,6 @@ public class StartClient implements Task {
.set(ConfigurationProperties.STATISTIC_ARCHIVE_FILE, statsFile)
.create();
- context.setAttribute(CLIENT_CACHE, clientCache);
+ context.setAttribute("CLIENT_CACHE", clientCache);
}
}
diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/StartServer.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/StartServer.java
index 26b010f..c1efdae 100644
--- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/StartServer.java
+++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/StartServer.java
@@ -17,8 +17,6 @@
package org.apache.geode.benchmark.tasks;
-import static org.apache.geode.benchmark.parameters.BenchmarkParameters.SERVER_CACHE;
-
import java.io.File;
import java.net.InetAddress;
@@ -57,7 +55,7 @@ public class StartServer implements Task {
CacheServer cacheServer = ((Cache) cache).addCacheServer();
cacheServer.setPort(0);
cacheServer.start();
- context.setAttribute(SERVER_CACHE, cache);
+ context.setAttribute("SERVER_CACHE", cache);
}
diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/BenchmarkOperation.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/BenchmarkOperation.java
deleted file mode 100644
index d67832e..0000000
--- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/BenchmarkOperation.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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.geode.benchmark.tests;
-
-import static org.apache.geode.benchmark.parameters.BenchmarkParameters.BENCHMARK_DURATION;
-import static org.apache.geode.benchmark.parameters.BenchmarkParameters.KEY_RANGE;
-import static org.apache.geode.benchmark.parameters.BenchmarkParameters.LOCATOR_PORT;
-import static org.apache.geode.benchmark.parameters.BenchmarkParameters.Roles.CLIENT;
-import static org.apache.geode.benchmark.parameters.BenchmarkParameters.Roles.LOCATOR;
-import static org.apache.geode.benchmark.parameters.BenchmarkParameters.Roles.SERVER;
-import static org.apache.geode.benchmark.parameters.BenchmarkParameters.WARM_UP_TIME;
-import static org.apache.geode.benchmark.parameters.JVMParameters.JVM_ARGS;
-
-import org.junit.Test;
-
-import org.apache.geode.benchmark.tasks.CreateClientProxyRegion;
-import org.apache.geode.benchmark.tasks.PrePopulateRegion;
-import org.apache.geode.benchmark.tasks.StartClient;
-import org.apache.geode.benchmark.tasks.StartLocator;
-import org.apache.geode.benchmark.tasks.StartServer;
-import org.apache.geode.perftest.TestConfig;
-import org.apache.geode.perftest.TestRunners;
-
-public abstract class BenchmarkOperation {
- long keyRange = KEY_RANGE;
-
- @Test
- public void run() throws Exception {
- TestRunners.defaultRunner().runTest(this::configure);
- }
-
- /**
- * This will configure a cluster of the following
- * 1 - locator
- * 4 - servers
- * 1 - client
- * Two abstract methods are also provided to be implemented to
- * create the region as required by the benchmark.
- *
- * @param config test configurations
- */
- void configure(TestConfig config) {
-
- int locatorPort = LOCATOR_PORT;
-
-
- config.name(this.getClass().getCanonicalName());
- config.warmupSeconds(WARM_UP_TIME);
- config.durationSeconds(BENCHMARK_DURATION);
- config.role(LOCATOR, 1);
- config.role(SERVER, 2);
- config.role(CLIENT, 1);
- config.jvmArgs(SERVER, JVM_ARGS);
- config.jvmArgs(CLIENT, JVM_ARGS);
- config.jvmArgs(LOCATOR, JVM_ARGS);
- config.before(new StartLocator(locatorPort), LOCATOR);
- config.before(new StartServer(locatorPort), SERVER);
- createRegion(config);
- config.before(new StartClient(locatorPort), CLIENT);
- config.before(new CreateClientProxyRegion(), CLIENT);
- config.before(new PrePopulateRegion(keyRange), SERVER);
- benchmarkOperation(config);
-
- }
-
- /**
- * The operation whose performance is to be measured
- * by the benchmark.
- *
- * @param config test configurations
- */
- protected abstract void benchmarkOperation(TestConfig config);
-
- /**
- * Create the region to be used in the benchmark.
- *
- * @param config test configurations.
- */
- abstract void createRegion(TestConfig config);
-
-}
diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/ReplicatedPutBenchmark.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/GeodeBenchmark.java
similarity index 63%
rename from geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/ReplicatedPutBenchmark.java
rename to geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/GeodeBenchmark.java
index 5cb8a13..92df316 100644
--- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/ReplicatedPutBenchmark.java
+++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/GeodeBenchmark.java
@@ -14,20 +14,24 @@
*/
package org.apache.geode.benchmark.tests;
-import static org.apache.geode.benchmark.parameters.BenchmarkParameters.Roles.SERVER;
-
-import org.apache.geode.benchmark.tasks.CreateReplicatedRegion;
import org.apache.geode.perftest.TestConfig;
-public class ReplicatedPutBenchmark extends PutBenchmark {
- public ReplicatedPutBenchmark() {}
+public class GeodeBenchmark {
- ReplicatedPutBenchmark(long keyRange) {
- this.keyRange = keyRange;
- }
+ /**
+ * Warm up time for the benchmark running on the default runner
+ */
+ public static final int WARM_UP_TIME = 60;
+ /**
+ * Total duration for which the benchmark will run on the default runner
+ */
+ public static final int BENCHMARK_DURATION = 240;
- @Override
- void createRegion(TestConfig config) {
- config.before(new CreateReplicatedRegion(), SERVER);
+ public static TestConfig createConfig() {
+ TestConfig testConfig = new TestConfig();
+ testConfig.warmupSeconds(WARM_UP_TIME);
+ testConfig.durationSeconds(BENCHMARK_DURATION);
+ return testConfig;
}
+
}
diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/GetBenchmark.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/GetBenchmark.java
deleted file mode 100644
index 376428c..0000000
--- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/GetBenchmark.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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.geode.benchmark.tests;
-
-import static org.apache.geode.benchmark.parameters.BenchmarkParameters.Roles.CLIENT;
-
-import org.apache.geode.benchmark.tasks.GetTask;
-import org.apache.geode.perftest.TestConfig;
-
-public abstract class GetBenchmark extends BenchmarkOperation {
- @Override
- protected void benchmarkOperation(TestConfig config) {
- config.workload(new GetTask(keyRange), CLIENT);
- }
-}
diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PartitionedGetBenchmark.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PartitionedGetBenchmark.java
index 4011380..a6099f4 100644
--- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PartitionedGetBenchmark.java
+++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PartitionedGetBenchmark.java
@@ -17,15 +17,24 @@
package org.apache.geode.benchmark.tests;
-import static org.apache.geode.benchmark.parameters.BenchmarkParameters.Roles.SERVER;
+import static org.apache.geode.benchmark.tests.util.ClientServerTopology.Roles.CLIENT;
+import static org.apache.geode.benchmark.tests.util.ClientServerTopology.Roles.SERVER;
+
+import org.apache.geode.benchmark.tasks.CreateClientProxyRegion;
import org.apache.geode.benchmark.tasks.CreatePartitionedRegion;
+import org.apache.geode.benchmark.tasks.GetTask;
+import org.apache.geode.benchmark.tasks.PrePopulateRegion;
+import org.apache.geode.benchmark.tests.util.ClientServerTopology;
+import org.apache.geode.perftest.PerformanceTest;
import org.apache.geode.perftest.TestConfig;
/**
* Benchmark of gets on a partitioned region.
*/
-public class PartitionedGetBenchmark extends GetBenchmark {
+public class PartitionedGetBenchmark implements PerformanceTest {
+
+ private long keyRange = 10000;
public PartitionedGetBenchmark() {}
@@ -34,7 +43,15 @@ public class PartitionedGetBenchmark extends GetBenchmark {
}
@Override
- void createRegion(TestConfig config) {
+ public TestConfig configure() {
+ TestConfig config = GeodeBenchmark.createConfig();
+ config.name(getClass().getName());
+ ClientServerTopology.configure(config);
config.before(new CreatePartitionedRegion(), SERVER);
+ config.before(new CreateClientProxyRegion(), CLIENT);
+ config.before(new PrePopulateRegion(keyRange), SERVER);
+ config.workload(new GetTask(keyRange), CLIENT);
+ return config;
+
}
}
diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PartitionedPutBenchmark.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PartitionedPutBenchmark.java
index f29be99..0724236 100644
--- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PartitionedPutBenchmark.java
+++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PartitionedPutBenchmark.java
@@ -17,12 +17,20 @@
package org.apache.geode.benchmark.tests;
-import static org.apache.geode.benchmark.parameters.BenchmarkParameters.Roles.SERVER;
+import static org.apache.geode.benchmark.tests.util.ClientServerTopology.Roles.CLIENT;
+import static org.apache.geode.benchmark.tests.util.ClientServerTopology.Roles.SERVER;
+import org.apache.geode.benchmark.tasks.CreateClientProxyRegion;
import org.apache.geode.benchmark.tasks.CreatePartitionedRegion;
+import org.apache.geode.benchmark.tasks.PrePopulateRegion;
+import org.apache.geode.benchmark.tasks.PutTask;
+import org.apache.geode.benchmark.tests.util.ClientServerTopology;
+import org.apache.geode.perftest.PerformanceTest;
import org.apache.geode.perftest.TestConfig;
-public class PartitionedPutBenchmark extends PutBenchmark {
+public class PartitionedPutBenchmark implements PerformanceTest {
+
+ private long keyRange = 10000;
public PartitionedPutBenchmark() {}
@@ -31,7 +39,15 @@ public class PartitionedPutBenchmark extends PutBenchmark {
}
@Override
- void createRegion(TestConfig config) {
+ public TestConfig configure() {
+ TestConfig config = GeodeBenchmark.createConfig();
+ config.name(getClass().getName());
+ ClientServerTopology.configure(config);
config.before(new CreatePartitionedRegion(), SERVER);
+ config.before(new CreateClientProxyRegion(), CLIENT);
+ config.before(new PrePopulateRegion(keyRange), SERVER);
+ config.workload(new PutTask(keyRange), CLIENT);
+ return config;
+
}
}
diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PutBenchmark.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PutBenchmark.java
deleted file mode 100644
index 46dbd96..0000000
--- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/PutBenchmark.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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.geode.benchmark.tests;
-
-import static org.apache.geode.benchmark.parameters.BenchmarkParameters.Roles.CLIENT;
-
-import org.apache.geode.benchmark.tasks.PutTask;
-import org.apache.geode.perftest.TestConfig;
-
-public abstract class PutBenchmark extends BenchmarkOperation {
- @Override
- protected void benchmarkOperation(TestConfig config) {
- config.workload(new PutTask(keyRange), CLIENT);
- }
-}
diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/ReplicatedGetBenchmark.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/ReplicatedGetBenchmark.java
deleted file mode 100644
index cd72754..0000000
--- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/ReplicatedGetBenchmark.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.geode.benchmark.tests;
-
-import static org.apache.geode.benchmark.parameters.BenchmarkParameters.Roles.SERVER;
-
-import org.apache.geode.benchmark.tasks.CreateReplicatedRegion;
-import org.apache.geode.perftest.TestConfig;
-
-public class ReplicatedGetBenchmark extends GetBenchmark {
- public ReplicatedGetBenchmark() {}
-
- ReplicatedGetBenchmark(long keyRange) {
- this.keyRange = keyRange;
- }
-
- @Override
- void createRegion(TestConfig config) {
- config.before(new CreateReplicatedRegion(), SERVER);
- }
-}
diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/parameters/JVMParameters.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/parameters/JVMParameters.java
similarity index 97%
rename from geode-benchmarks/src/main/java/org/apache/geode/benchmark/parameters/JVMParameters.java
rename to geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/parameters/JVMParameters.java
index 4d39259..9ca5972 100644
--- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/parameters/JVMParameters.java
+++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/parameters/JVMParameters.java
@@ -12,10 +12,9 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-package org.apache.geode.benchmark.parameters;
+package org.apache.geode.benchmark.tests.parameters;
public class JVMParameters {
-
public static final String[] JVM_ARGS = new String[] {
"-XX:CMSInitiatingOccupancyFraction=60",
"-XX:+PrintGCDetails",
diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/util/ClientServerTopology.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/util/ClientServerTopology.java
new file mode 100644
index 0000000..e7d6690
--- /dev/null
+++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tests/util/ClientServerTopology.java
@@ -0,0 +1,59 @@
+/*
+ * 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.geode.benchmark.tests.util;
+
+import static org.apache.geode.benchmark.tests.parameters.JVMParameters.JVM_ARGS;
+import static org.apache.geode.benchmark.tests.util.ClientServerTopology.Roles.CLIENT;
+import static org.apache.geode.benchmark.tests.util.ClientServerTopology.Roles.LOCATOR;
+import static org.apache.geode.benchmark.tests.util.ClientServerTopology.Roles.SERVER;
+
+import org.apache.geode.benchmark.tasks.StartClient;
+import org.apache.geode.benchmark.tasks.StartLocator;
+import org.apache.geode.benchmark.tasks.StartServer;
+import org.apache.geode.perftest.TestConfig;
+
+public class ClientServerTopology {
+
+ /**
+ * All roles defined for the JVMs created for the benchmark
+ */
+ public static class Roles {
+ public static final String SERVER = "server";
+ public static final String CLIENT = "client";
+ public static final String LOCATOR = "locator";
+ }
+
+ /**
+ * The port used to create the locator for the tests
+ */
+ public static final int LOCATOR_PORT = 10334;
+
+ static final int NUM_LOCATORS = 1;
+ static final int NUM_SERVERS = 2;
+ static final int NUM_CLIENTS = 1;
+
+ public static void configure(TestConfig testConfig) {
+ testConfig.role(LOCATOR, NUM_LOCATORS);
+ testConfig.role(SERVER, NUM_SERVERS);
+ testConfig.role(CLIENT, NUM_CLIENTS);
+
+ testConfig.jvmArgs(CLIENT, JVM_ARGS);
+ testConfig.jvmArgs(LOCATOR, JVM_ARGS);
+
+ testConfig.before(new StartLocator(LOCATOR_PORT), LOCATOR);
+ testConfig.before(new StartServer(LOCATOR_PORT), SERVER);
+ testConfig.before(new StartClient(LOCATOR_PORT), CLIENT);
+ }
+}
diff --git a/geode-benchmarks/src/test/java/org/apache/geode/benchmark/tests/PartitionedGetBenchmarkTest.java b/geode-benchmarks/src/test/java/org/apache/geode/benchmark/tests/PartitionedGetBenchmarkTest.java
index 8fcb375..1d3f21c 100644
--- a/geode-benchmarks/src/test/java/org/apache/geode/benchmark/tests/PartitionedGetBenchmarkTest.java
+++ b/geode-benchmarks/src/test/java/org/apache/geode/benchmark/tests/PartitionedGetBenchmarkTest.java
@@ -14,8 +14,6 @@
*/
package org.apache.geode.benchmark.tests;
-import static org.apache.geode.benchmark.parameters.BenchmarkParameters.KEY_RANGE_FOR_MINIMAL_RUNNER;
-
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
@@ -29,6 +27,6 @@ public class PartitionedGetBenchmarkTest {
@Test
public void benchmarkRunsSuccessfully() throws Exception {
TestRunners.minimalRunner(folder.newFolder())
- .runTest(new PartitionedGetBenchmark(KEY_RANGE_FOR_MINIMAL_RUNNER)::configure);
+ .runTest(new PartitionedGetBenchmark(100));
}
}
diff --git a/geode-benchmarks/src/test/java/org/apache/geode/benchmark/tests/PartitionedPutBenchmarkTest.java b/geode-benchmarks/src/test/java/org/apache/geode/benchmark/tests/PartitionedPutBenchmarkTest.java
index e884176..14388be 100644
--- a/geode-benchmarks/src/test/java/org/apache/geode/benchmark/tests/PartitionedPutBenchmarkTest.java
+++ b/geode-benchmarks/src/test/java/org/apache/geode/benchmark/tests/PartitionedPutBenchmarkTest.java
@@ -17,8 +17,6 @@
package org.apache.geode.benchmark.tests;
-import static org.apache.geode.benchmark.parameters.BenchmarkParameters.KEY_RANGE_FOR_MINIMAL_RUNNER;
-
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
@@ -33,6 +31,6 @@ public class PartitionedPutBenchmarkTest {
@Test
public void benchmarkRunsSuccessfully() throws Exception {
TestRunners.minimalRunner(folder.newFolder())
- .runTest(new PartitionedPutBenchmark(KEY_RANGE_FOR_MINIMAL_RUNNER)::configure);
+ .runTest(new PartitionedPutBenchmark(100));
}
}
diff --git a/geode-benchmarks/src/test/java/org/apache/geode/benchmark/tests/ReplicatedGetBenchmarkTest.java b/geode-benchmarks/src/test/java/org/apache/geode/benchmark/tests/ReplicatedGetBenchmarkTest.java
deleted file mode 100644
index ee7f766..0000000
--- a/geode-benchmarks/src/test/java/org/apache/geode/benchmark/tests/ReplicatedGetBenchmarkTest.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.geode.benchmark.tests;
-
-import static org.apache.geode.benchmark.parameters.BenchmarkParameters.KEY_RANGE_FOR_MINIMAL_RUNNER;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-
-import org.apache.geode.perftest.TestRunners;
-
-public class ReplicatedGetBenchmarkTest {
- @Rule
- public TemporaryFolder folder = new TemporaryFolder();
-
- @Test
- public void benchmarkRunsSuccessfully() throws Exception {
- TestRunners.minimalRunner(folder.newFolder())
- .runTest(new ReplicatedGetBenchmark(KEY_RANGE_FOR_MINIMAL_RUNNER)::configure);
- }
-}
diff --git a/geode-benchmarks/src/test/java/org/apache/geode/benchmark/tests/ReplicatedPutBenchmarkTest.java b/geode-benchmarks/src/test/java/org/apache/geode/benchmark/tests/ReplicatedPutBenchmarkTest.java
deleted file mode 100644
index 20acb50..0000000
--- a/geode-benchmarks/src/test/java/org/apache/geode/benchmark/tests/ReplicatedPutBenchmarkTest.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.geode.benchmark.tests;
-
-import static org.apache.geode.benchmark.parameters.BenchmarkParameters.KEY_RANGE_FOR_MINIMAL_RUNNER;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-
-import org.apache.geode.perftest.TestRunners;
-
-public class ReplicatedPutBenchmarkTest {
- @Rule
- public TemporaryFolder folder = new TemporaryFolder();
-
- @Test
- public void benchmarkRunsSuccessfully() throws Exception {
- TestRunners.minimalRunner(folder.newFolder())
- .runTest(new ReplicatedPutBenchmark(KEY_RANGE_FOR_MINIMAL_RUNNER)::configure);
- }
-}
diff --git a/harness/src/main/java/org/apache/geode/perftest/PerformanceTest.java b/harness/src/main/java/org/apache/geode/perftest/PerformanceTest.java
index aa49728..4a97ca5 100644
--- a/harness/src/main/java/org/apache/geode/perftest/PerformanceTest.java
+++ b/harness/src/main/java/org/apache/geode/perftest/PerformanceTest.java
@@ -47,6 +47,6 @@ public interface PerformanceTest extends Serializable {
/**
* Return the configuration for the test.
*/
- void configure(TestConfig test);
+ TestConfig configure();
}
diff --git a/harness/src/main/java/org/apache/geode/perftest/runner/DefaultTestRunner.java b/harness/src/main/java/org/apache/geode/perftest/runner/DefaultTestRunner.java
index ab89ccc..895bdb0 100644
--- a/harness/src/main/java/org/apache/geode/perftest/runner/DefaultTestRunner.java
+++ b/harness/src/main/java/org/apache/geode/perftest/runner/DefaultTestRunner.java
@@ -53,8 +53,7 @@ public class DefaultTestRunner implements TestRunner {
@Override
public void runTest(PerformanceTest test) throws Exception {
- TestConfig config = new TestConfig();
- test.configure(config);
+ TestConfig config = test.configure();
runTest(config);
}
diff --git a/harness/src/test/java/org/apache/geode/perftest/TestRunnerIntegrationTest.java b/harness/src/test/java/org/apache/geode/perftest/TestRunnerIntegrationTest.java
index 942e685..d997017 100644
--- a/harness/src/test/java/org/apache/geode/perftest/TestRunnerIntegrationTest.java
+++ b/harness/src/test/java/org/apache/geode/perftest/TestRunnerIntegrationTest.java
@@ -54,20 +54,24 @@ public class TestRunnerIntegrationTest {
@Test
public void runsBeforeWorkload() throws Exception {
- runner.runTest(testConfig -> {
+ runner.runTest(() -> {
+ TestConfig testConfig = new TestConfig();
testConfig.name(SAMPLE_BENCHMARK);
testConfig.role("all", 1);
testConfig.before(context -> System.out.println("hello"), "all");
+ return testConfig;
});
}
@Test
public void generatesOutputDirectoryPerBenchmark() throws Exception {
- runner.runTest(testConfig -> {
+ runner.runTest(() -> {
+ TestConfig testConfig = new TestConfig();
testConfig.name(SAMPLE_BENCHMARK);
testConfig.role("all", 1);
testConfig.workload(new EmptyBenchmark(), "all");
+ return testConfig;
});
File expectedBenchmarkDir = new File(outputDir, SAMPLE_BENCHMARK);
@@ -86,7 +90,8 @@ public class TestRunnerIntegrationTest {
@Test
public void configuresJVMOptions() throws Exception {
- runner.runTest(testConfig -> {
+ runner.runTest(() -> {
+ TestConfig testConfig = new TestConfig();
testConfig.name(SAMPLE_BENCHMARK);
testConfig.role("all", 1);
testConfig.jvmArgs("all", "-Dprop1=true", "-Dprop2=5");
@@ -96,6 +101,7 @@ public class TestRunnerIntegrationTest {
assertEquals("Expecting system property to be set in launched JVM, but it was not present.",
5, Integer.getInteger("prop2").intValue());
}, "all");
+ return testConfig;
});
}
diff --git a/harness/src/test/java/org/apache/geode/perftest/TestRunnerJUnitTest.java b/harness/src/test/java/org/apache/geode/perftest/TestRunnerJUnitTest.java
index 8e4c45c..28c29b7 100644
--- a/harness/src/test/java/org/apache/geode/perftest/TestRunnerJUnitTest.java
+++ b/harness/src/test/java/org/apache/geode/perftest/TestRunnerJUnitTest.java
@@ -52,7 +52,8 @@ public class TestRunnerJUnitTest {
Task before = mock(Task.class);
Task after = mock(Task.class);
- PerformanceTest test = config -> {
+ PerformanceTest test = () -> {
+ TestConfig config = new TestConfig();
config.name("SampleBenchmark");
config.role("before", 1);
config.role("workload", 1);
@@ -60,6 +61,7 @@ public class TestRunnerJUnitTest {
config.before(before, "before");
config.after(after, "before");
+ return config;
};
runner.runTest(test);
@@ -81,11 +83,13 @@ public class TestRunnerJUnitTest {
Task before = mock(Task.class);
- PerformanceTest test = config -> {
+ PerformanceTest test = () -> {
+ TestConfig config = new TestConfig();
config.name("SampleBenchmark");
config.role("before", 1);
config.before(before);
+ return config;
};
Assertions.assertThatThrownBy(() -> runner.runTest(test))
.isInstanceOf(IllegalStateException.class);