Skip to content
Permalink
Browse files
Adds more command line configuration options. (#112)
* Support for selection GC from CMS, G1, Shenandoah, or Z.
* Support for specifying JMV heap size.

* Refactors JVM argument configuration.
* Improved new GC logging
  • Loading branch information
pivotal-jbarrett committed Sep 30, 2019
1 parent 1af2fe7 commit d85f08ef45d80f2b5b23adfc5677d3ee36360b52
Showing 24 changed files with 728 additions and 118 deletions.
@@ -53,6 +53,8 @@ Options:
-PtestJVM : Path to an alternative JVM for running the client, locator, and servers. If not specified JAVA_HOME will be used. Note all compilation tasks will still use JAVA_HOME.
-PwithSsl : Flag to run geode with SSL. A self-signed certificate will be generated at runtime.
-PwithSecurityManager : Flag to start Geode with the example implementation of SecurityManager
-PwithGc : Select which GC to use. Valid values CMS (default), G1, Z.
-PwithHeap : Specify how large a heap the benchmark VMs should use, default "8g". Accepts any `-Xmx` value, like "32g".
--tests : Specific benchmarks to run (--tests=PartitionedPutBenchmark)
-d : Debug
-i : Info
@@ -24,7 +24,7 @@ buildscript {
}


plugins { id "org.nosphere.apache.rat" version "0.3.1" }
plugins { id "org.nosphere.apache.rat" version "0.5.2" }

apply plugin: 'com.bmuschko.docker-remote-api'

@@ -36,17 +36,19 @@ repositories {
}

dependencies {
compile(group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: project.'junit-jupiter-engine.version')
compile(group: 'org.junit-pioneer', name: 'junit-pioneer', version: project.'junit-pioneer.version')
compile(group: 'org.apache.geode', name: 'geode-core', version: geodeVersion)
compile(group: 'org.slf4j', name: 'slf4j-simple', version: project.'slf4j-simple.version')
compile(project(':harness'))
implementation(group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: project.'junit-jupiter-engine.version')
implementation(group: 'org.junit-pioneer', name: 'junit-pioneer', version: project.'junit-pioneer.version')
implementation(group: 'org.slf4j', name: 'slf4j-simple', version: project.'slf4j-simple.version')
implementation(project(':harness'))

implementation(group: 'org.apache.geode', name: 'geode-core', version: geodeVersion)

// Required for missing dependency on geode-core.
runtime(group: 'org.eclipse.jetty', name: 'jetty-webapp', version: '9.4.12.v20180830')
runtime(group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.12.0')

testCompile(group: 'org.mockito', name: 'mockito-all', version: project.'mockito-all.version')
testCompile(group: 'org.assertj', name: 'assertj-core', version: project.'assertj-core.version')
testImplementation(group: 'org.mockito', name: 'mockito-all', version: project.'mockito-all.version')
testImplementation(group: 'org.assertj', name: 'assertj-core', version: project.'assertj-core.version')
}

test{ useJUnitPlatform() }
@@ -69,6 +71,12 @@ task benchmark(type: Test) {
systemProperty 'TEST_HOSTS', project.findProperty('hosts')
systemProperty 'TEST_METADATA', project.findProperty('metadata')
systemProperty 'OUTPUT_DIR', outputDir
if (project.hasProperty('withGc')) {
systemProperty 'withGc', project.findProperty('withGc')
}
if (project.hasProperty('withHeap')) {
systemProperty 'withHeap', project.findProperty('withHeap')
}
systemProperty 'withSsl', project.hasProperty('withSsl')
systemProperty 'withSecurityManager', project.hasProperty('withSecurityManager')
systemProperty 'benchmark.profiler.argument', project.findProperty('benchmark.profiler.argument')
@@ -0,0 +1,20 @@
/*
* 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 enum GcImplementation {
CMS, G1, Z, Shenandoah;
}
@@ -0,0 +1,48 @@
/*
* 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 static org.apache.geode.benchmark.parameters.JavaVersion.v11;
import static org.apache.geode.benchmark.parameters.Utils.configureAll;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.apache.geode.perftest.TestConfig;

public class GcLoggingParameters {
private static final Logger logger = LoggerFactory.getLogger(GcLoggingParameters.class);

public static void configure(final TestConfig testConfig) {
final JavaVersion javaVersion = JavaVersion.current();
logger.info("Configuring GC logging parameters for Java {}.", javaVersion);
if (javaVersion.atLeast(v11)) {
configureAll(testConfig, "-Xlog:gc*:OUTPUT_DIR/gc.log");
} else {
configureAll(testConfig,
"-XX:+PrintGCDetails",
"-XX:+PrintGCTimeStamps",
"-XX:+PrintGCDateStamps",
"-XX:+PrintGCApplicationStoppedTime",
"-XX:+PrintGCApplicationConcurrentTime",
"-XX:+UseGCLogFileRotation",
"-XX:NumberOfGCLogFiles=20",
"-XX:GCLogFileSize=1M",
"-Xloggc:OUTPUT_DIR/gc.log");
}
}

}
@@ -0,0 +1,87 @@
/*
* 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 static org.apache.geode.benchmark.parameters.JavaVersion.v11;
import static org.apache.geode.benchmark.parameters.Utils.configureAll;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.apache.geode.perftest.TestConfig;

public class GcParameters {
private static final Logger logger = LoggerFactory.getLogger(GcParameters.class);

public static void configure(final TestConfig testConfig) {
final GcImplementation gcImplementation =
GcImplementation.valueOf(System.getProperty("withGc", "CMS"));
logger.info("Configuring {} GC.", gcImplementation);
switch (gcImplementation) {
case CMS:
configureCms(testConfig);
break;
case G1:
configureG1(testConfig);
break;
case Z:
configureZ(testConfig);
break;
case Shenandoah:
configureShenandoah(testConfig);
break;
}
}

private static void configureShenandoah(final TestConfig testConfig) {
configureAll(testConfig,
"-XX:+UnlockExperimentalVMOptions",
"-XX:+UseShenandoahGC",
"-XX:+AlwaysPreTouch",
"-XX:+UseNUMA");
}

private static void configureZ(final TestConfig testConfig) {
final JavaVersion javaVersion = JavaVersion.current();
if (javaVersion.olderThan(v11)) {
throw new IllegalArgumentException("ZGC requires Java 11 or newer");
}
configureAll(testConfig,
"-XX:+UnlockExperimentalVMOptions",
"-XX:+UseZGC");
}

private static void configureG1(final TestConfig testConfig) {
configureAll(testConfig,
"-XX:+UseG1GC",
"-XX:+UseNUMA",
"-XX:+ScavengeBeforeFullGC");
}

private static void configureCms(final TestConfig testConfig) {
configureAll(testConfig,
"-XX:+UseConcMarkSweepGC",
"-XX:+UseCMSInitiatingOccupancyOnly",
"-XX:+CMSClassUnloadingEnabled",
"-XX:+CMSScavengeBeforeRemark",
"-XX:CMSInitiatingOccupancyFraction=60",
"-XX:+UseNUMA",
"-XX:+ScavengeBeforeFullGC",
"-XX:+UnlockDiagnosticVMOptions",
"-XX:ParGCCardsPerStrideChunk=32768");
}

}
@@ -0,0 +1,34 @@
/*
* 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 static org.apache.geode.benchmark.parameters.Utils.configureAll;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.apache.geode.perftest.TestConfig;

public class HeapParameters {
private static final Logger logger = LoggerFactory.getLogger(HeapParameters.class);

public static void configure(final TestConfig testConfig) {
final String heap = System.getProperty("withHeap", "8g");
logger.info("Configuring heap parameters {}.", heap);
configureAll(testConfig, "-Xmx" + heap, "-Xms" + heap);
}

}

This file was deleted.

@@ -0,0 +1,45 @@
/*
* 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 enum JavaVersion {
v8, v11, v12, v13;

public static JavaVersion current() {
return valueOfVersion(System.getProperty("java.runtime.version"));
}

private static JavaVersion valueOfVersion(final String javaVersion) {
if (javaVersion.startsWith("1.8")) {
return v8;
} else if (javaVersion.startsWith("11.")) {
return v11;
} else if (javaVersion.startsWith("12.")) {
return v12;
} else if (javaVersion.matches("^13\\b.*")) {
return v13;
}
throw new IllegalStateException("Unknown version " + javaVersion);
}

public boolean atLeast(final JavaVersion other) {
return this.compareTo(other) >= 0;
}

public boolean olderThan(final JavaVersion other) {
return this.compareTo(other) < 0;
}
}
@@ -0,0 +1,40 @@
/*
* 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 static org.apache.geode.benchmark.parameters.Utils.configureAll;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.apache.geode.perftest.TestConfig;

public class JvmParameters {
private static final Logger logger = LoggerFactory.getLogger(JvmParameters.class);

public static void configure(final TestConfig testConfig) {
logger.info("Configuring JVM parameters.");

configureAll(testConfig,
"-server",
"-Djava.awt.headless=true",
"-Dsun.rmi.dgc.server.gcInterval=9223372036854775806",
"-Dgemfire.OSProcess.ENABLE_OUTPUT_REDIRECTION=true",
"-Dgemfire.launcher.registerSignalHandlers=true",
"-XX:+DisableExplicitGC");
}

}

0 comments on commit d85f08e

Please sign in to comment.