Skip to content

Commit

Permalink
GEODE-6172: Configure geode properties for benchmarks
Browse files Browse the repository at this point in the history
* Rename and move parameters and util packages
* create Geode properties to pass to servers and locators

Signed-off-by: Dan Smith <dsmith@pivotal.io>
Signed-off-by: Helena A. Bales <hbales@pivotal.io>
  • Loading branch information
upthewaterspout committed Dec 12, 2018
1 parent f95e4f6 commit 0aa0594
Show file tree
Hide file tree
Showing 10 changed files with 82 additions and 28 deletions.
@@ -0,0 +1,57 @@
/*
* 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;

import java.util.Properties;

import org.apache.geode.distributed.ConfigurationProperties;

public class GeodeProperties {

public static Properties serverProperties() {
Properties properties = new Properties();

properties.setProperty(ConfigurationProperties.CONSERVE_SOCKETS, "false");
properties.setProperty(ConfigurationProperties.ENABLE_TIME_STATISTICS, "true");
properties.setProperty(ConfigurationProperties.LOCATOR_WAIT_TIME, "120");
properties.setProperty(ConfigurationProperties.LOG_DISK_SPACE_LIMIT, "100");
properties.setProperty(ConfigurationProperties.LOG_FILE_SIZE_LIMIT, "10");
properties.setProperty(ConfigurationProperties.LOG_LEVEL, "config");
properties.setProperty(ConfigurationProperties.REMOVE_UNRESPONSIVE_CLIENT, "true");
properties.setProperty(ConfigurationProperties.STATISTIC_SAMPLING_ENABLED, "true");
properties.setProperty(ConfigurationProperties.ARCHIVE_DISK_SPACE_LIMIT, "150");
properties.setProperty(ConfigurationProperties.ARCHIVE_FILE_SIZE_LIMIT, "10");
properties.setProperty(ConfigurationProperties.DISTRIBUTED_SYSTEM_ID, "0");
properties.setProperty(ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION, "false");
properties.setProperty(ConfigurationProperties.USE_CLUSTER_CONFIGURATION, "false");
return properties;
}

public static Properties locatorProperties() {
// Locator properties are the same as the server properties right now
return serverProperties();
}

public static Properties clientProperties() {
Properties properties = new Properties();
properties.setProperty(ConfigurationProperties.ENABLE_TIME_STATISTICS, "true");
properties.setProperty(ConfigurationProperties.LOG_LEVEL, "config");
properties.setProperty(ConfigurationProperties.STATISTIC_SAMPLING_ENABLED, "true");
return properties;

}


}
Expand Up @@ -12,7 +12,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package org.apache.geode.benchmark.tests.parameters;
package org.apache.geode.benchmark.parameters;

public class JVMParameters {
public static final String[] JVM_ARGS = new String[] {
Expand Down
Expand Up @@ -20,6 +20,7 @@
import java.io.File;
import java.net.InetAddress;

import org.apache.geode.benchmark.parameters.GeodeProperties;
import org.apache.geode.cache.client.ClientCache;
import org.apache.geode.cache.client.ClientCacheFactory;
import org.apache.geode.distributed.ConfigurationProperties;
Expand All @@ -43,9 +44,8 @@ public void run(TestContext context) throws Exception {

String statsFile = new File(context.getOutputDir(), "stats.gfs").getAbsolutePath();

ClientCache clientCache = new ClientCacheFactory()
ClientCache clientCache = new ClientCacheFactory(GeodeProperties.clientProperties())
.addPoolLocator(locator.getHostAddress(), locatorPort)
.set(ConfigurationProperties.STATISTIC_SAMPLING_ENABLED, "true")
.set(ConfigurationProperties.STATISTIC_ARCHIVE_FILE, statsFile)
.create();

Expand Down
Expand Up @@ -21,6 +21,7 @@
import java.net.InetAddress;
import java.util.Properties;

import org.apache.geode.benchmark.parameters.GeodeProperties;
import org.apache.geode.distributed.ConfigurationProperties;
import org.apache.geode.distributed.Locator;
import org.apache.geode.perftest.Task;
Expand All @@ -38,13 +39,10 @@ public StartLocator(int locatorPort) {

@Override
public void run(TestContext context) throws Exception {
Properties properties = new Properties();
Properties properties = GeodeProperties.locatorProperties();

String statsFile = new File(context.getOutputDir(), "stats.gfs").getAbsolutePath();
properties.setProperty(ConfigurationProperties.STATISTIC_SAMPLING_ENABLED, "true");
properties.setProperty(ConfigurationProperties.STATISTIC_ARCHIVE_FILE, statsFile);
properties.setProperty(ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION, "false");
properties.setProperty(ConfigurationProperties.USE_CLUSTER_CONFIGURATION, "false");

properties.setProperty(ConfigurationProperties.NAME, "locator-" + InetAddress.getLocalHost());
Locator.startLocatorAndDS(locatorPort, null, properties);
Expand Down
Expand Up @@ -20,6 +20,7 @@
import java.io.File;
import java.net.InetAddress;

import org.apache.geode.benchmark.parameters.GeodeProperties;
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.CacheFactory;
import org.apache.geode.cache.server.CacheServer;
Expand All @@ -43,16 +44,14 @@ public void run(TestContext context) throws Exception {

String locatorString = LocatorUtil.getLocatorString(context, locatorPort);
String statsFile = new File(context.getOutputDir(), "stats.gfs").getAbsolutePath();
Cache cache = new CacheFactory()
Cache cache = new CacheFactory(GeodeProperties.serverProperties())
.set(ConfigurationProperties.LOCATORS, locatorString)
.set(ConfigurationProperties.NAME,
"server-" + context.getJvmID() + "-" + InetAddress.getLocalHost())
.set(ConfigurationProperties.STATISTIC_SAMPLING_ENABLED, "true")
.set(ConfigurationProperties.STATISTIC_ARCHIVE_FILE, statsFile)
.set(ConfigurationProperties.USE_CLUSTER_CONFIGURATION, "false")
.create();

CacheServer cacheServer = ((Cache) cache).addCacheServer();
CacheServer cacheServer = cache.addCacheServer();
cacheServer.setPort(0);
cacheServer.start();
context.setAttribute("SERVER_CACHE", cache);
Expand Down
Expand Up @@ -18,16 +18,16 @@
package org.apache.geode.benchmark.tests;


import static org.apache.geode.benchmark.tests.util.ClientServerTopology.Roles.CLIENT;
import static org.apache.geode.benchmark.tests.util.ClientServerTopology.Roles.SERVER;
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.GetTask;
import org.apache.geode.benchmark.tasks.PrePopulateRegion;
import org.apache.geode.benchmark.tests.util.ClientServerTopology;
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;
Expand Down
Expand Up @@ -17,16 +17,16 @@

package org.apache.geode.benchmark.tests;

import static org.apache.geode.benchmark.tests.util.ClientServerTopology.Roles.CLIENT;
import static org.apache.geode.benchmark.tests.util.ClientServerTopology.Roles.SERVER;
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.PrePopulateRegion;
import org.apache.geode.benchmark.tasks.PutTask;
import org.apache.geode.benchmark.tests.util.ClientServerTopology;
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;
Expand Down
Expand Up @@ -18,16 +18,16 @@
package org.apache.geode.benchmark.tests;


import static org.apache.geode.benchmark.tests.util.ClientServerTopology.Roles.CLIENT;
import static org.apache.geode.benchmark.tests.util.ClientServerTopology.Roles.SERVER;
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.GetTask;
import org.apache.geode.benchmark.tasks.PrePopulateRegion;
import org.apache.geode.benchmark.tests.util.ClientServerTopology;
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;
Expand Down
Expand Up @@ -17,16 +17,16 @@

package org.apache.geode.benchmark.tests;

import static org.apache.geode.benchmark.tests.util.ClientServerTopology.Roles.CLIENT;
import static org.apache.geode.benchmark.tests.util.ClientServerTopology.Roles.SERVER;
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.PrePopulateRegion;
import org.apache.geode.benchmark.tasks.PutTask;
import org.apache.geode.benchmark.tests.util.ClientServerTopology;
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;
Expand Down
Expand Up @@ -12,12 +12,12 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package org.apache.geode.benchmark.tests.util;
package org.apache.geode.benchmark.topology;

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 static org.apache.geode.benchmark.parameters.JVMParameters.JVM_ARGS;
import static org.apache.geode.benchmark.topology.ClientServerTopology.Roles.CLIENT;
import static org.apache.geode.benchmark.topology.ClientServerTopology.Roles.LOCATOR;
import static org.apache.geode.benchmark.topology.ClientServerTopology.Roles.SERVER;

import org.apache.geode.benchmark.tasks.StartClient;
import org.apache.geode.benchmark.tasks.StartLocator;
Expand Down

0 comments on commit 0aa0594

Please sign in to comment.