This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch sni in repository https://gitbox.apache.org/repos/asf/geode-benchmarks.git
The following commit(s) were added to refs/heads/sni by this push: new 6239e47 SNI toplogy enforces TLS on 6239e47 is described below commit 6239e47b879e83b7e07cdc19ccdc36f9203933df Author: Bill Burcham <bburc...@pivotal.io> AuthorDate: Tue May 19 16:40:04 2020 -0700 SNI toplogy enforces TLS on --- README.md | 11 +++--- .../benchmark/parameters/GcLoggingParameters.java | 6 ++-- .../geode/benchmark/parameters/GcParameters.java | 10 +++--- .../geode/benchmark/parameters/HeapParameters.java | 4 +-- .../geode/benchmark/parameters/JvmParameters.java | 4 +-- .../benchmark/parameters/ProfilerParameters.java | 4 +-- .../apache/geode/benchmark/parameters/Utils.java | 23 ++++++++---- .../topology/ClientServerTopologyWithSNIProxy.java | 4 +-- .../org/apache/geode/benchmark/topology/Ports.java | 14 ++++++++ .../RoleKinds.java} | 21 ++--------- .../org/apache/geode/benchmark/topology/Roles.java | 28 ++++++++++++++- .../ClientServerTopologyWithSNIProxyTest.java} | 42 ++++++++++++++-------- .../apache/geode/perftest/jvms/JVMLauncher.java | 2 +- 13 files changed, 111 insertions(+), 62 deletions(-) diff --git a/README.md b/README.md index 69e6efb..6d34820 100644 --- a/README.md +++ b/README.md @@ -159,9 +159,12 @@ We're limited to just that test because topology is not orthogonal to test&mdash Also we have to provide `-DwithSsl=true` for an SNI test even though no SNI test could work without TLS. ### TODO for SNI -* verify `StartSniProxy` runs on proxy node -* set up SNI in `StartClient` task via `setPoolSocketFactory` -* don't require operator to supply `-DwithSSL=true` when running SNI tests—have a `-Dsni` instead -* make topology orthogonal to tests so all tests can run with SNI +* ~~verify `StartSniProxy` runs on proxy node~~ +* don't require operator to supply `-PwithSSL`/`-DwithSSL=true` when running SNI tests +* set `hostname-for-clients` in locator and server startup +* create three keystores: one each server and locator, and one truststore with all three certs +* set up SNI in `StartClient` task via `setPoolSocketFactory` +* make topology orthogonal to tests so all tests can run with SNI; have a `-Psni`/`-Dsni` flag * `./run_tests.sh` often seems to hang after benchmarks have completed, requiring operator to enter ^C to un-stick it +* make `rsync:` Git "scheme" work in `run_tests.sh` script for benchmark repo (not just for geode repo) diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/parameters/GcLoggingParameters.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/parameters/GcLoggingParameters.java index b3728ca..e19482e 100644 --- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/parameters/GcLoggingParameters.java +++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/parameters/GcLoggingParameters.java @@ -16,7 +16,7 @@ package org.apache.geode.benchmark.parameters; import static org.apache.geode.benchmark.parameters.JavaVersion.v11; -import static org.apache.geode.benchmark.parameters.Utils.configureJavaRoles; +import static org.apache.geode.benchmark.parameters.Utils.configureGeodeProductJvms; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -30,9 +30,9 @@ public class GcLoggingParameters { final JavaVersion javaVersion = JavaVersion.current(); logger.info("Configuring GC logging parameters for Java {}.", javaVersion); if (javaVersion.atLeast(v11)) { - configureJavaRoles(testConfig, "-Xlog:gc*:OUTPUT_DIR/gc.log"); + configureGeodeProductJvms(testConfig, "-Xlog:gc*:OUTPUT_DIR/gc.log"); } else { - configureJavaRoles(testConfig, + configureGeodeProductJvms(testConfig, "-XX:+PrintGCDetails", "-XX:+PrintGCTimeStamps", "-XX:+PrintGCDateStamps", diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/parameters/GcParameters.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/parameters/GcParameters.java index 48fbd88..6239c0a 100644 --- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/parameters/GcParameters.java +++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/parameters/GcParameters.java @@ -16,7 +16,7 @@ package org.apache.geode.benchmark.parameters; import static org.apache.geode.benchmark.parameters.JavaVersion.v11; -import static org.apache.geode.benchmark.parameters.Utils.configureJavaRoles; +import static org.apache.geode.benchmark.parameters.Utils.configureGeodeProductJvms; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -47,7 +47,7 @@ public class GcParameters { } private static void configureShenandoah(final TestConfig testConfig) { - configureJavaRoles(testConfig, + configureGeodeProductJvms(testConfig, "-XX:+UnlockExperimentalVMOptions", "-XX:+UseShenandoahGC", "-XX:+AlwaysPreTouch", @@ -59,20 +59,20 @@ public class GcParameters { if (javaVersion.olderThan(v11)) { throw new IllegalArgumentException("ZGC requires Java 11 or newer"); } - configureJavaRoles(testConfig, + configureGeodeProductJvms(testConfig, "-XX:+UnlockExperimentalVMOptions", "-XX:+UseZGC"); } private static void configureG1(final TestConfig testConfig) { - configureJavaRoles(testConfig, + configureGeodeProductJvms(testConfig, "-XX:+UseG1GC", "-XX:+UseNUMA", "-XX:+ScavengeBeforeFullGC"); } private static void configureCms(final TestConfig testConfig) { - configureJavaRoles(testConfig, + configureGeodeProductJvms(testConfig, "-XX:+UseConcMarkSweepGC", "-XX:+UseCMSInitiatingOccupancyOnly", "-XX:+CMSClassUnloadingEnabled", diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/parameters/HeapParameters.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/parameters/HeapParameters.java index 85b5e40..fd58b6a 100644 --- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/parameters/HeapParameters.java +++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/parameters/HeapParameters.java @@ -15,7 +15,7 @@ package org.apache.geode.benchmark.parameters; -import static org.apache.geode.benchmark.parameters.Utils.configureJavaRoles; +import static org.apache.geode.benchmark.parameters.Utils.configureGeodeProductJvms; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -28,7 +28,7 @@ public class HeapParameters { public static void configure(final TestConfig testConfig) { final String heap = System.getProperty("withHeap", "8g"); logger.info("Configuring heap parameters {}.", heap); - configureJavaRoles(testConfig, "-Xmx" + heap, "-Xms" + heap); + configureGeodeProductJvms(testConfig, "-Xmx" + heap, "-Xms" + heap); } } 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 c75e1b1..d26a11a 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 @@ -15,7 +15,7 @@ package org.apache.geode.benchmark.parameters; -import static org.apache.geode.benchmark.parameters.Utils.configureJavaRoles; +import static org.apache.geode.benchmark.parameters.Utils.configureGeodeProductJvms; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -28,7 +28,7 @@ public class JvmParameters { public static void configure(final TestConfig testConfig) { logger.info("Configuring JVM parameters."); - configureJavaRoles(testConfig, + configureGeodeProductJvms(testConfig, "-server", "-Djava.awt.headless=true", "-Dsun.rmi.dgc.server.gcInterval=9223372036854775806", diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/parameters/ProfilerParameters.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/parameters/ProfilerParameters.java index 752ac65..6a48ba8 100644 --- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/parameters/ProfilerParameters.java +++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/parameters/ProfilerParameters.java @@ -16,7 +16,7 @@ package org.apache.geode.benchmark.parameters; import static com.google.common.base.Strings.isNullOrEmpty; -import static org.apache.geode.benchmark.parameters.Utils.configureJavaRoles; +import static org.apache.geode.benchmark.parameters.Utils.configureGeodeProductJvms; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -30,7 +30,7 @@ public class ProfilerParameters { final String profilerArgument = System.getProperty("benchmark.profiler.argument"); if (!isNullOrEmpty(profilerArgument)) { logger.info("Configuring profiler parameter. {}", profilerArgument); - configureJavaRoles(testConfig, profilerArgument); + configureGeodeProductJvms(testConfig, profilerArgument); } } diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/parameters/Utils.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/parameters/Utils.java index 5e5f4fa..b90f707 100644 --- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/parameters/Utils.java +++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/parameters/Utils.java @@ -16,14 +16,18 @@ package org.apache.geode.benchmark.parameters; import static org.apache.geode.benchmark.Config.jvmArgs; +import static org.apache.geode.benchmark.topology.RoleKinds.GEODE_PRODUCT; import static org.apache.geode.benchmark.topology.Roles.CLIENT; import static org.apache.geode.benchmark.topology.Roles.LOCATOR; -import static org.apache.geode.benchmark.topology.Roles.PROXY; import static org.apache.geode.benchmark.topology.Roles.SERVER; +import java.util.Arrays; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.apache.geode.benchmark.topology.RoleKinds; +import org.apache.geode.benchmark.topology.Roles; import org.apache.geode.perftest.TestConfig; public class Utils { @@ -33,18 +37,23 @@ public class Utils { private Utils() {} - public static void configureJavaRoles(TestConfig config, String... args) { - jvmArgs(config, LOCATOR, args); - jvmArgs(config, SERVER, args); - jvmArgs(config, CLIENT, args); - jvmArgs(config, PROXY, args); + /** + * We have many settings we want to apply to JVMs that are hosting Geode. Not all JVMs + * host Geode. This method applies the setting to only the Geode product JVMs. + * @param config + * @param args + */ + public static void configureGeodeProductJvms(final TestConfig config, final String... args) { + Arrays.stream(Roles.values()) + .filter(role -> role.roleKind == GEODE_PRODUCT) + .forEach(role -> jvmArgs(config,role,args)); } public static void addToTestConfig(TestConfig testConfig, String systemPropertyKey, String jvmArgument) { if (Boolean.getBoolean(systemPropertyKey)) { logger.info("Configuring JVMs to run with " + jvmArgument); - configureJavaRoles(testConfig, jvmArgument); + configureGeodeProductJvms(testConfig, jvmArgument); } } } diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/topology/ClientServerTopologyWithSNIProxy.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/topology/ClientServerTopologyWithSNIProxy.java index 2c29fa9..54fc76c 100644 --- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/topology/ClientServerTopologyWithSNIProxy.java +++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/topology/ClientServerTopologyWithSNIProxy.java @@ -19,7 +19,7 @@ import static org.apache.geode.benchmark.Config.before; import static org.apache.geode.benchmark.Config.jvmArgs; import static org.apache.geode.benchmark.Config.role; import static org.apache.geode.benchmark.parameters.Utils.addToTestConfig; -import static org.apache.geode.benchmark.parameters.Utils.configureJavaRoles; +import static org.apache.geode.benchmark.parameters.Utils.configureGeodeProductJvms; import static org.apache.geode.benchmark.topology.Ports.LOCATOR_PORT; import static org.apache.geode.benchmark.topology.Roles.CLIENT; import static org.apache.geode.benchmark.topology.Roles.LOCATOR; @@ -58,7 +58,7 @@ public class ClientServerTopologyWithSNIProxy { GcParameters.configure(config); ProfilerParameters.configure(config); - configureJavaRoles(config, WITH_SSL_ARGUMENT); + configureGeodeProductJvms(config, WITH_SSL_ARGUMENT); addToTestConfig(config, "withSecurityManager", WITH_SECURITY_MANAGER_ARGUMENT); // pass SNI proxy config to CLIENT role only diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/topology/Ports.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/topology/Ports.java index e415a5e..1e40182 100644 --- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/topology/Ports.java +++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/topology/Ports.java @@ -1,3 +1,17 @@ +/* + * 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; public class Ports { diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/parameters/HeapParameters.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/topology/RoleKinds.java similarity index 56% copy from geode-benchmarks/src/main/java/org/apache/geode/benchmark/parameters/HeapParameters.java copy to geode-benchmarks/src/main/java/org/apache/geode/benchmark/topology/RoleKinds.java index 85b5e40..2198278 100644 --- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/parameters/HeapParameters.java +++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/topology/RoleKinds.java @@ -12,23 +12,8 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ +package org.apache.geode.benchmark.topology; -package org.apache.geode.benchmark.parameters; - -import static org.apache.geode.benchmark.parameters.Utils.configureJavaRoles; - -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); - configureJavaRoles(testConfig, "-Xmx" + heap, "-Xms" + heap); - } - +public enum RoleKinds { + GEODE_PRODUCT, SUPPORTING; } diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/topology/Roles.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/topology/Roles.java index c6807da..3122e77 100644 --- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/topology/Roles.java +++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/topology/Roles.java @@ -1,8 +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.topology; +import static org.apache.geode.benchmark.topology.RoleKinds.GEODE_PRODUCT; +import static org.apache.geode.benchmark.topology.RoleKinds.SUPPORTING; + /** * All roles defined for the JVMs created for the benchmark */ public enum Roles { - SERVER, CLIENT, LOCATOR, PROXY; + SERVER(GEODE_PRODUCT), + CLIENT(GEODE_PRODUCT), + LOCATOR(GEODE_PRODUCT), + PROXY(SUPPORTING); + + public final RoleKinds roleKind; + + Roles(final RoleKinds roleKind) { + this.roleKind = roleKind; + } } diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/parameters/JvmParameters.java b/geode-benchmarks/src/test/java/org/apache/geode/benchmark/topology/ClientServerTopologyWithSNIProxyTest.java similarity index 50% copy from geode-benchmarks/src/main/java/org/apache/geode/benchmark/parameters/JvmParameters.java copy to geode-benchmarks/src/test/java/org/apache/geode/benchmark/topology/ClientServerTopologyWithSNIProxyTest.java index c75e1b1..51d7ee5 100644 --- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/parameters/JvmParameters.java +++ b/geode-benchmarks/src/test/java/org/apache/geode/benchmark/topology/ClientServerTopologyWithSNIProxyTest.java @@ -13,28 +13,40 @@ * the License. */ -package org.apache.geode.benchmark.parameters; +package org.apache.geode.benchmark.topology; -import static org.apache.geode.benchmark.parameters.Utils.configureJavaRoles; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import static org.apache.geode.benchmark.topology.Roles.CLIENT; +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.Properties; + +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 JvmParameters { - private static final Logger logger = LoggerFactory.getLogger(JvmParameters.class); +public class ClientServerTopologyWithSNIProxyTest { + + private Properties systemProperties; + + @BeforeEach + public void beforeEach() { + systemProperties = (Properties) System.getProperties().clone(); + } + + @AfterEach + public void afterEach() { + System.setProperties(systemProperties); + } - public static void configure(final TestConfig testConfig) { - logger.info("Configuring JVM parameters."); - configureJavaRoles(testConfig, - "-server", - "-Djava.awt.headless=true", - "-Dsun.rmi.dgc.server.gcInterval=9223372036854775806", - "-Dgemfire.OSProcess.ENABLE_OUTPUT_REDIRECTION=true", - "-Dgemfire.launcher.registerSignalHandlers=true", - "-XX:+DisableExplicitGC"); + @Test + public void configWithNoSsl() { + TestConfig testConfig = new TestConfig(); + ClientServerTopologyWithSNIProxy.configure(testConfig); + assertThat(testConfig.getJvmArgs().get(CLIENT.name())).contains("-DwithSsl=true"); } } 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 6b5cfce..13c2a44 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 @@ -91,7 +91,7 @@ class JVMLauncher { command.add("-D" + RemoteJVMFactory.JVM_ID + "=" + jvmConfig.getId()); command.add("-D" + RemoteJVMFactory.OUTPUT_DIR + "=" + jvmConfig.getOutputDir()); - if (Boolean.getBoolean("withSsl")) { + if (jvmConfig.getJvmArgs().contains("-DwithSsl=true")) { command .add("-Dgemfire." + SSL_KEYSTORE + "=" + jvmConfig.getLibDir() + "/temp-self-signed.jks"); command.add("-Dgemfire." + SSL_KEYSTORE_PASSWORD + "=123456");