geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbarr...@apache.org
Subject [geode-benchmarks] branch develop updated: User can run benchmarks with alternative JVM (#89)
Date Wed, 17 Jul 2019 16:37:18 GMT
This is an automated email from the ASF dual-hosted git repository.

jbarrett 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 fcfb373  User can run benchmarks with alternative JVM (#89)
fcfb373 is described below

commit fcfb373cfc081dfead277776c509ebe69e109ba4
Author: Kamilla Aslami <kaslami@pivotal.io>
AuthorDate: Wed Jul 17 09:37:13 2019 -0700

    User can run benchmarks with alternative JVM (#89)
    
    * Use alternative JVM for benchmark/test
    * Use java.home for executing remote jvm.
    * Disable GC logging if not Java 8
    * Updated the README.md to be clearer.
    * Added ClientServerTopologyTest file
    
    Co-authored-by: Murtuza Boxwala <mboxwala@pivotal.io>
    Co-authored-by: Kamilla Aslami <kaslami@pivotal.io>
---
 README.md                                          | 10 ++-
 geode-benchmarks/build.gradle                      |  3 +
 .../geode/benchmark/parameters/JVMParameters.java  | 19 ++---
 .../benchmark/topology/ClientServerTopology.java   |  8 ++
 .../topology/ClientServerTopologyTest.java         | 89 ++++++++++++++++++++++
 .../apache/geode/perftest/jvms/JVMLauncher.java    |  2 +-
 6 files changed, 120 insertions(+), 11 deletions(-)

diff --git a/README.md b/README.md
index 83f9b67..5c36ab7 100644
--- a/README.md
+++ b/README.md
@@ -47,7 +47,15 @@ For example:
 ```
 ./gradlew benchmark -Phosts=localhost,localhost,localhost,localhost
 ```
-Optionally you can control the output directory with `-PoutputDir=/tmp/results`
+
+Options:
+
+    -Phosts      : Hosts used by benchmarks on the order of client,locator,server,server
(-Phosts=localhost,localhost,localhost,localhost)
+    -PoutputDir  : Results output directory (-PoutputDir=/tmp/results)
+    -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.
+    --tests      : Specific benchmarks to run (--tests=PartitionedPutBenchmark)
+    -d           : Debug
+    -i           : Info
 
 ### Running in aws
 
diff --git a/geode-benchmarks/build.gradle b/geode-benchmarks/build.gradle
index d7816f4..ffd8ab5 100644
--- a/geode-benchmarks/build.gradle
+++ b/geode-benchmarks/build.gradle
@@ -56,6 +56,9 @@ test{
 }
 
 task benchmark(type: Test) {
+    if (project.hasProperty('testJVM') && !testJVM.trim().isEmpty()) {
+        executable = "${testJVM}/bin/java"
+    }
     outputs.upToDateWhen { false }
     testClassesDirs = project.sourceSets.main.output.classesDirs
     classpath = project.sourceSets.main.runtimeClasspath
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/parameters/JVMParameters.java
index d6bd361..5c4bdc7 100644
--- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/parameters/JVMParameters.java
+++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/parameters/JVMParameters.java
@@ -17,14 +17,6 @@ package org.apache.geode.benchmark.parameters;
 public class JVMParameters {
   public static final String[] JVM_ARGS = new String[] {
       "-XX:CMSInitiatingOccupancyFraction=60",
-      "-XX:+PrintGCDetails",
-      "-XX:+PrintGCTimeStamps",
-      "-XX:+PrintGCDateStamps",
-      "-XX:+PrintGCApplicationStoppedTime",
-      "-XX:+PrintGCApplicationConcurrentTime",
-      "-XX:+UseGCLogFileRotation",
-      "-XX:NumberOfGCLogFiles=20",
-      "-XX:GCLogFileSize=1M",
       "-XX:+UnlockDiagnosticVMOptions",
       "-XX:ParGCCardsPerStrideChunk=32768",
       "-XX:+UseNUMA",
@@ -41,7 +33,16 @@ public class JVMParameters {
       "-Dgemfire.launcher.registerSignalHandlers=true",
       "-Xmx8g",
       "-Xms8g"
-
+  };
+  public static final String[] JVM8_ARGS = new String[] {
+      "-XX:+PrintGCDetails",
+      "-XX:+PrintGCTimeStamps",
+      "-XX:+PrintGCDateStamps",
+      "-XX:+PrintGCApplicationStoppedTime",
+      "-XX:+PrintGCApplicationConcurrentTime",
+      "-XX:+UseGCLogFileRotation",
+      "-XX:NumberOfGCLogFiles=20",
+      "-XX:GCLogFileSize=1M"
   };
 
 }
diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/topology/ClientServerTopology.java
b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/topology/ClientServerTopology.java
index 95fe97d..20d20fb 100644
--- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/topology/ClientServerTopology.java
+++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/topology/ClientServerTopology.java
@@ -14,6 +14,7 @@
  */
 package org.apache.geode.benchmark.topology;
 
+import static org.apache.geode.benchmark.parameters.JVMParameters.JVM8_ARGS;
 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;
@@ -56,10 +57,17 @@ public class ClientServerTopology {
     testConfig.role(CLIENT, NUM_CLIENTS);
 
     String profilerArgument = System.getProperty("benchmark.profiler.argument");
+
     testConfig.jvmArgs(CLIENT, appendIfNotEmpty(JVM_ARGS, profilerArgument));
     testConfig.jvmArgs(LOCATOR, appendIfNotEmpty(JVM_ARGS, profilerArgument));
     testConfig.jvmArgs(SERVER, appendIfNotEmpty(JVM_ARGS, profilerArgument));
 
+    if (System.getProperty("java.runtime.version").startsWith("1.8")) {
+      testConfig.jvmArgs(CLIENT, JVM8_ARGS);
+      testConfig.jvmArgs(LOCATOR, JVM8_ARGS);
+      testConfig.jvmArgs(SERVER, JVM8_ARGS);
+    }
+
     String withSslArg = System.getProperty("withSsl");
     if (withSslArg != null && withSslArg.equals("true")) {
       logger.info("Configuring JVMs to run with SSL enabled");
diff --git a/geode-benchmarks/src/test/java/org/apache/geode/benchmark/topology/ClientServerTopologyTest.java
b/geode-benchmarks/src/test/java/org/apache/geode/benchmark/topology/ClientServerTopologyTest.java
new file mode 100644
index 0000000..fd95157
--- /dev/null
+++ b/geode-benchmarks/src/test/java/org/apache/geode/benchmark/topology/ClientServerTopologyTest.java
@@ -0,0 +1,89 @@
+/*
+ * 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.topology;
+
+
+import static org.apache.geode.benchmark.parameters.JVMParameters.JVM8_ARGS;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import org.apache.geode.perftest.TestConfig;
+
+public class ClientServerTopologyTest {
+
+
+  @BeforeEach
+  @AfterEach
+  public void clearProperties() {
+    System.clearProperty("withSsl");
+  }
+
+  @Test
+  public void configWithSsl() {
+    System.setProperty("withSsl", "true");
+    TestConfig testConfig = new TestConfig();
+    ClientServerTopology.configure(testConfig);
+    assertThat(testConfig.getJvmArgs().get("client")).contains("-DwithSsl");
+  }
+
+  @Test
+  public void configWithNoSsl() {
+    TestConfig testConfig = new TestConfig();
+    ClientServerTopology.configure(testConfig);
+    assertThat(testConfig.getJvmArgs().get("client")).doesNotContain("-DwithSsl");
+  }
+
+  @Test
+  public void configWithJava8() {
+    System.setProperty("java.runtime.version", "1.8.0_212");
+    TestConfig testConfig = new TestConfig();
+    ClientServerTopology.configure(testConfig);
+    assertThat(testConfig.getJvmArgs().get("client")).doesNotContain("-DwithSsl");
+    assertThat(testConfig.getJvmArgs().get("client")).contains(JVM8_ARGS);
+  }
+
+  @Test
+  public void configWithJava9OrHigher() {
+    System.setProperty("java.runtime.version", "9.0.1");
+    TestConfig testConfig = new TestConfig();
+    ClientServerTopology.configure(testConfig);
+    assertThat(testConfig.getJvmArgs().get("client")).doesNotContain("-DwithSsl");
+    assertThat(testConfig.getJvmArgs().get("client")).doesNotContain(JVM8_ARGS);
+  }
+
+  @Test
+  public void configWithSslAndJava8() {
+    System.setProperty("withSsl", "true");
+    System.setProperty("java.runtime.version", "1.8.0_212");
+    TestConfig testConfig = new TestConfig();
+    ClientServerTopology.configure(testConfig);
+    assertThat(testConfig.getJvmArgs().get("client")).contains("-DwithSsl");
+    assertThat(testConfig.getJvmArgs().get("client")).contains(JVM8_ARGS);
+  }
+
+  @Test
+  public void configWithSslAndJava9() {
+    System.setProperty("withSsl", "true");
+    System.setProperty("java.runtime.version", "9.0.1");
+    TestConfig testConfig = new TestConfig();
+    ClientServerTopology.configure(testConfig);
+    assertThat(testConfig.getJvmArgs().get("client")).contains("-DwithSsl");
+    assertThat(testConfig.getJvmArgs().get("client")).doesNotContain(JVM8_ARGS);
+  }
+}
diff --git a/harness/src/main/java/org/apache/geode/perftest/jvms/JVMLauncher.java b/harness/src/main/java/org/apache/geode/perftest/jvms/JVMLauncher.java
index 286f495..c0d008e 100644
--- a/harness/src/main/java/org/apache/geode/perftest/jvms/JVMLauncher.java
+++ b/harness/src/main/java/org/apache/geode/perftest/jvms/JVMLauncher.java
@@ -78,7 +78,7 @@ class JVMLauncher {
   String[] buildCommand(String rmiHost, int rmiPort, JVMMapping jvmConfig) {
 
     List<String> command = new ArrayList<String>();
-    command.add("java");
+    command.add(System.getProperty("java.home") + "/bin/java");
     command.add("-classpath");
     command.add(jvmConfig.getLibDir() + "/*");
     command.add("-D" + RemoteJVMFactory.RMI_HOST + "=" + rmiHost);


Mime
View raw message