Skip to content
Permalink
Browse files
Move threads configuration.
Run fewer threads on function and queries.
Refactor common elements.
  • Loading branch information
pivotal-jbarrett committed Apr 23, 2019
1 parent 538a02f commit 19442d4ec5f8970e86386edb76add84f767eb502
Showing 11 changed files with 134 additions and 124 deletions.
@@ -65,7 +65,6 @@ task benchmark(type: Test) {
}

exclude "**/*IndexedQueryBenchmark.class"
exclude "**/*Function*Benchmark.class"

forkEvery 1

@@ -0,0 +1,49 @@
/*
* 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.topology.ClientServerTopology.Roles.CLIENT;
import static org.apache.geode.benchmark.topology.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.topology.ClientServerTopology;
import org.apache.geode.perftest.PerformanceTest;
import org.apache.geode.perftest.TestConfig;

abstract class AbstractPartitionedFunctionBenchmark implements PerformanceTest {
private long keyRange = 1000000;

public final void setKeyRange(long keyRange) {
this.keyRange = keyRange;
}

public final long getKeyRange() {
return keyRange;
}

@Override
public TestConfig configure() {
TestConfig config = GeodeBenchmark.createConfig();
config.threads(Runtime.getRuntime().availableProcessors() * 4);
ClientServerTopology.configure(config);
config.before(new CreatePartitionedRegion(), SERVER);
config.before(new CreateClientProxyRegion(), CLIENT);
config.before(new PrePopulateRegion(keyRange), SERVER);
return config;
}
}
@@ -0,0 +1,49 @@
/*
* 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.topology.ClientServerTopology.Roles.CLIENT;
import static org.apache.geode.benchmark.topology.ClientServerTopology.Roles.SERVER;

import org.apache.geode.benchmark.tasks.CreateClientProxyRegion;
import org.apache.geode.benchmark.tasks.CreateReplicatedRegion;
import org.apache.geode.benchmark.tasks.PrePopulateRegion;
import org.apache.geode.benchmark.topology.ClientServerTopology;
import org.apache.geode.perftest.PerformanceTest;
import org.apache.geode.perftest.TestConfig;

abstract class AbstractReplicatedFunctionBenchmark implements PerformanceTest {
private long keyRange = 1000000;

public final void setKeyRange(long keyRange) {
this.keyRange = keyRange;
}

public final long getKeyRange() {
return keyRange;
}

@Override
public TestConfig configure() {
TestConfig config = GeodeBenchmark.createConfig();
config.threads(Runtime.getRuntime().availableProcessors() * 4);
ClientServerTopology.configure(config);
config.before(new CreateReplicatedRegion(), SERVER);
config.before(new CreateClientProxyRegion(), CLIENT);
config.before(new PrePopulateRegion(keyRange), SERVER);
return config;
}
}
@@ -12,25 +12,36 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/

package org.apache.geode.benchmark.tests;

import static java.util.concurrent.TimeUnit.MINUTES;

import org.apache.geode.perftest.TestConfig;

public class GeodeBenchmark {

/**
* Warm up time for the benchmark running on the default runner
*/
public static final int WARM_UP_TIME = 60;
private static final long WARM_UP_TIME = MINUTES.toSeconds(1);

/**
* Total duration for which the benchmark will run on the default runner
*/
public static final int BENCHMARK_DURATION = 240;
private static final long BENCHMARK_DURATION = MINUTES.toSeconds(5);

/**
* Number of threads to run benchmark.
*/
private static final int THREADS = Runtime.getRuntime().availableProcessors() * 16;


public static TestConfig createConfig() {
TestConfig testConfig = new TestConfig();
testConfig.warmupSeconds(WARM_UP_TIME);
testConfig.durationSeconds(BENCHMARK_DURATION);
testConfig.threads(THREADS);
return testConfig;
}

@@ -15,29 +15,16 @@
package org.apache.geode.benchmark.tests;

import static org.apache.geode.benchmark.topology.ClientServerTopology.Roles.CLIENT;
import static org.apache.geode.benchmark.topology.ClientServerTopology.Roles.SERVER;

import org.junit.jupiter.api.Test;

import org.apache.geode.benchmark.tasks.CreateClientProxyRegion;
import org.apache.geode.benchmark.tasks.CreatePartitionedRegion;
import org.apache.geode.benchmark.tasks.ExecuteFunction;
import org.apache.geode.benchmark.tasks.PrePopulateRegion;
import org.apache.geode.benchmark.topology.ClientServerTopology;
import org.apache.geode.perftest.PerformanceTest;
import org.apache.geode.perftest.TestConfig;
import org.apache.geode.perftest.TestRunners;

public class PartitionedFunctionExecutionBenchmark implements PerformanceTest {
private long keyRange = 1000000;
public class PartitionedFunctionExecutionBenchmark extends AbstractPartitionedFunctionBenchmark {
private long functionIDRange = 1000;

public PartitionedFunctionExecutionBenchmark() {}

public void setKeyRange(long keyRange) {
this.keyRange = keyRange;
}

public void setFunctionIDRange(long functionIDRange) {
this.functionIDRange = functionIDRange;
}
@@ -49,12 +36,8 @@ public void run() throws Exception {

@Override
public TestConfig configure() {
TestConfig config = GeodeBenchmark.createConfig();
ClientServerTopology.configure(config);
config.before(new CreatePartitionedRegion(), SERVER);
config.before(new CreateClientProxyRegion(), CLIENT);
config.before(new PrePopulateRegion(keyRange), SERVER);
config.workload(new ExecuteFunction(keyRange, functionIDRange), CLIENT);
TestConfig config = super.configure();
config.workload(new ExecuteFunction(getKeyRange(), functionIDRange), CLIENT);
return config;
}
}
@@ -15,29 +15,17 @@
package org.apache.geode.benchmark.tests;

import static org.apache.geode.benchmark.topology.ClientServerTopology.Roles.CLIENT;
import static org.apache.geode.benchmark.topology.ClientServerTopology.Roles.SERVER;

import org.junit.jupiter.api.Test;

import org.apache.geode.benchmark.tasks.CreateClientProxyRegion;
import org.apache.geode.benchmark.tasks.CreatePartitionedRegion;
import org.apache.geode.benchmark.tasks.ExecuteParameterizedFunction;
import org.apache.geode.benchmark.tasks.PrePopulateRegion;
import org.apache.geode.benchmark.topology.ClientServerTopology;
import org.apache.geode.perftest.PerformanceTest;
import org.apache.geode.perftest.TestConfig;
import org.apache.geode.perftest.TestRunners;

public class PartitionedFunctionExecutionWithArgumentsBenchmark implements PerformanceTest {
private long keyRange = 1000000;
public class PartitionedFunctionExecutionWithArgumentsBenchmark
extends AbstractPartitionedFunctionBenchmark {
private long functionIDRange = 1000;

public PartitionedFunctionExecutionWithArgumentsBenchmark() {}

public void setKeyRange(long keyRange) {
this.keyRange = keyRange;
}

public void setFunctionIDRange(long functionIDRange) {
this.functionIDRange = functionIDRange;
}
@@ -50,12 +38,8 @@ public void run() throws Exception {

@Override
public TestConfig configure() {
TestConfig config = GeodeBenchmark.createConfig();
ClientServerTopology.configure(config);
config.before(new CreatePartitionedRegion(), SERVER);
config.before(new CreateClientProxyRegion(), CLIENT);
config.before(new PrePopulateRegion(keyRange), SERVER);
config.workload(new ExecuteParameterizedFunction(keyRange, functionIDRange), CLIENT);
TestConfig config = super.configure();
config.workload(new ExecuteParameterizedFunction(getKeyRange(), functionIDRange), CLIENT);
return config;

}
@@ -15,29 +15,17 @@
package org.apache.geode.benchmark.tests;

import static org.apache.geode.benchmark.topology.ClientServerTopology.Roles.CLIENT;
import static org.apache.geode.benchmark.topology.ClientServerTopology.Roles.SERVER;

import org.junit.jupiter.api.Test;

import org.apache.geode.benchmark.tasks.CreateClientProxyRegion;
import org.apache.geode.benchmark.tasks.CreatePartitionedRegion;
import org.apache.geode.benchmark.tasks.ExecuteFilteredFunction;
import org.apache.geode.benchmark.tasks.PrePopulateRegion;
import org.apache.geode.benchmark.topology.ClientServerTopology;
import org.apache.geode.perftest.PerformanceTest;
import org.apache.geode.perftest.TestConfig;
import org.apache.geode.perftest.TestRunners;

public class PartitionedFunctionExecutionWithFiltersBenchmark implements PerformanceTest {
private long keyRange = 1000000;
public class PartitionedFunctionExecutionWithFiltersBenchmark
extends AbstractPartitionedFunctionBenchmark {
private long filterKeyRange = 1000;

public PartitionedFunctionExecutionWithFiltersBenchmark() {}

public void setKeyRange(long keyRange) {
this.keyRange = keyRange;
}

public void setFilterKeyRange(long filterKeyRange) {
this.filterKeyRange = filterKeyRange;
}
@@ -49,12 +37,8 @@ public void run() throws Exception {

@Override
public TestConfig configure() {
TestConfig config = GeodeBenchmark.createConfig();
ClientServerTopology.configure(config);
config.before(new CreatePartitionedRegion(), SERVER);
config.before(new CreateClientProxyRegion(), CLIENT);
config.before(new PrePopulateRegion(keyRange), SERVER);
config.workload(new ExecuteFilteredFunction(keyRange, filterKeyRange), CLIENT);
TestConfig config = super.configure();
config.workload(new ExecuteFilteredFunction(getKeyRange(), filterKeyRange), CLIENT);
return config;
}
}
@@ -15,29 +15,16 @@
package org.apache.geode.benchmark.tests;

import static org.apache.geode.benchmark.topology.ClientServerTopology.Roles.CLIENT;
import static org.apache.geode.benchmark.topology.ClientServerTopology.Roles.SERVER;

import org.junit.jupiter.api.Test;

import org.apache.geode.benchmark.tasks.CreateClientProxyRegion;
import org.apache.geode.benchmark.tasks.CreateReplicatedRegion;
import org.apache.geode.benchmark.tasks.ExecuteFunction;
import org.apache.geode.benchmark.tasks.PrePopulateRegion;
import org.apache.geode.benchmark.topology.ClientServerTopology;
import org.apache.geode.perftest.PerformanceTest;
import org.apache.geode.perftest.TestConfig;
import org.apache.geode.perftest.TestRunners;

public class ReplicatedFunctionExecutionBenchmark implements PerformanceTest {
private long keyRange = 1000000;
public class ReplicatedFunctionExecutionBenchmark extends AbstractReplicatedFunctionBenchmark {
private long functionIDRange = 1000;

public ReplicatedFunctionExecutionBenchmark() {}

public void setKeyRange(long keyRange) {
this.keyRange = keyRange;
}

public void setFunctionIDRange(long functionIDRange) {
this.functionIDRange = functionIDRange;
}
@@ -49,12 +36,8 @@ public void run() throws Exception {

@Override
public TestConfig configure() {
TestConfig config = GeodeBenchmark.createConfig();
ClientServerTopology.configure(config);
config.before(new CreateReplicatedRegion(), SERVER);
config.before(new CreateClientProxyRegion(), CLIENT);
config.before(new PrePopulateRegion(keyRange), SERVER);
config.workload(new ExecuteFunction(keyRange, functionIDRange), CLIENT);
TestConfig config = super.configure();
config.workload(new ExecuteFunction(getKeyRange(), functionIDRange), CLIENT);
return config;
}
}
@@ -15,29 +15,17 @@
package org.apache.geode.benchmark.tests;

import static org.apache.geode.benchmark.topology.ClientServerTopology.Roles.CLIENT;
import static org.apache.geode.benchmark.topology.ClientServerTopology.Roles.SERVER;

import org.junit.jupiter.api.Test;

import org.apache.geode.benchmark.tasks.CreateClientProxyRegion;
import org.apache.geode.benchmark.tasks.CreateReplicatedRegion;
import org.apache.geode.benchmark.tasks.ExecuteParameterizedFunction;
import org.apache.geode.benchmark.tasks.PrePopulateRegion;
import org.apache.geode.benchmark.topology.ClientServerTopology;
import org.apache.geode.perftest.PerformanceTest;
import org.apache.geode.perftest.TestConfig;
import org.apache.geode.perftest.TestRunners;

public class ReplicatedFunctionExecutionWithArgumentsBenchmark implements PerformanceTest {
private long keyRange = 1000000;
public class ReplicatedFunctionExecutionWithArgumentsBenchmark
extends AbstractReplicatedFunctionBenchmark {
private long functionIDRange = 1000;

public ReplicatedFunctionExecutionWithArgumentsBenchmark() {}

public void setKeyRange(long keyRange) {
this.keyRange = keyRange;
}

public void setFunctionIDRange(long functionIDRange) {
this.functionIDRange = functionIDRange;
}
@@ -49,12 +37,8 @@ public void run() throws Exception {

@Override
public TestConfig configure() {
TestConfig config = GeodeBenchmark.createConfig();
ClientServerTopology.configure(config);
config.before(new CreateReplicatedRegion(), SERVER);
config.before(new CreateClientProxyRegion(), CLIENT);
config.before(new PrePopulateRegion(keyRange), SERVER);
config.workload(new ExecuteParameterizedFunction(keyRange, functionIDRange), CLIENT);
TestConfig config = super.configure();
config.workload(new ExecuteParameterizedFunction(getKeyRange(), functionIDRange), CLIENT);
return config;
}
}

0 comments on commit 19442d4

Please sign in to comment.