Skip to content

Commit

Permalink
Avoid using Jetty ALPN
Browse files Browse the repository at this point in the history
We still want Netty to test that it continues working with Jetty ALPN,
but otherwise we don't want to use it.

Fixes grpc#2266
  • Loading branch information
ejona86 committed Sep 13, 2018
1 parent 6cf849a commit 84c62a2
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 29 deletions.
10 changes: 1 addition & 9 deletions benchmarks/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ dependencies {
libraries.netty_epoll,
libraries.math
compileOnly libraries.javax_annotation
runtime libraries.conscrypt
}

compileJava {
Expand All @@ -53,19 +54,13 @@ def vmArgs = [
task qps_client(type: CreateStartScripts) {
mainClassName = "io.grpc.benchmarks.qps.AsyncClient"
applicationName = "qps_client"
defaultJvmOpts = [
"-javaagent:" + configurations.alpnagent.asPath
].plus(vmArgs)
outputDir = new File(project.buildDir, 'tmp')
classpath = jar.outputs.files + project.configurations.runtime
}

task openloop_client(type: CreateStartScripts) {
mainClassName = "io.grpc.benchmarks.qps.OpenLoopClient"
applicationName = "openloop_client"
defaultJvmOpts = [
"-javaagent:" + configurations.alpnagent.asPath
].plus(vmArgs)
outputDir = new File(project.buildDir, 'tmp')
classpath = jar.outputs.files + project.configurations.runtime
}
Expand All @@ -80,9 +75,6 @@ task qps_server(type: CreateStartScripts) {
task benchmark_worker(type: CreateStartScripts) {
mainClassName = "io.grpc.benchmarks.driver.LoadWorker"
applicationName = "benchmark_worker"
defaultJvmOpts = [
"-javaagent:" + configurations.alpnagent.asPath
].plus(vmArgs)
outputDir = new File(project.buildDir, 'tmp')
classpath = jar.outputs.files + project.configurations.runtime
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import io.grpc.benchmarks.proto.Control.ServerArgs;
import io.grpc.benchmarks.proto.Control.ServerArgs.ArgtypeCase;
import io.grpc.benchmarks.proto.WorkerServiceGrpc;
import io.grpc.internal.testing.TestUtils;
import io.grpc.netty.NettyServerBuilder;
import io.grpc.stub.StreamObserver;
import io.netty.channel.nio.NioEventLoopGroup;
Expand Down Expand Up @@ -105,6 +106,10 @@ public static void main(String[] args) throws Exception {
+ "\n Port to start load servers on. Defaults to any available port");
System.exit(1);
}

// Let Netty or OkHttp use Conscrypt if it is available.
TestUtils.installConscryptIfAvailable();

LoadWorker loadWorker = new LoadWorker(driverPort, serverPort);
loadWorker.start();
loadWorker.driverServer.awaitTermination();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import io.grpc.benchmarks.proto.Messages.Payload;
import io.grpc.benchmarks.proto.Messages.SimpleRequest;
import io.grpc.benchmarks.proto.Messages.SimpleResponse;
import io.grpc.internal.testing.TestUtils;
import io.grpc.stub.StreamObserver;
import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -303,6 +304,8 @@ private static void shutdown(List<ManagedChannel> channels) {
* checkstyle complains if there is no javadoc comment here.
*/
public static void main(String... args) throws Exception {
// Let Netty or OkHttp use Conscrypt if it is available.
TestUtils.installConscryptIfAvailable();
ClientConfiguration.Builder configBuilder = ClientConfiguration.newBuilder(
ADDRESS, CHANNELS, OUTSTANDING_RPCS, CLIENT_PAYLOAD, SERVER_PAYLOAD,
TLS, TESTCA, TRANSPORT, DURATION, WARMUP_DURATION, DIRECTEXECUTOR,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ public class AsyncServer {
* checkstyle complains if there is no javadoc comment here.
*/
public static void main(String... args) throws Exception {
// Let Netty or OkHttp use Conscrypt if it is available.
TestUtils.installConscryptIfAvailable();
new AsyncServer().run(args);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import io.grpc.benchmarks.proto.BenchmarkServiceGrpc;
import io.grpc.benchmarks.proto.Messages.SimpleRequest;
import io.grpc.benchmarks.proto.Messages.SimpleResponse;
import io.grpc.internal.testing.TestUtils;
import io.grpc.stub.StreamObserver;
import java.util.Random;
import java.util.concurrent.Callable;
Expand All @@ -63,6 +64,8 @@ public OpenLoopClient(ClientConfiguration config) {
* Comment for checkstyle.
*/
public static void main(String... args) throws Exception {
// Let Netty or OkHttp use Conscrypt if it is available.
TestUtils.installConscryptIfAvailable();
ClientConfiguration.Builder configBuilder = ClientConfiguration.newBuilder(
ADDRESS, TARGET_QPS, CLIENT_PAYLOAD, SERVER_PAYLOAD, TLS,
TESTCA, TRANSPORT, DURATION, SAVE_HISTOGRAM, FLOW_CONTROL_WINDOW);
Expand Down
6 changes: 0 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -244,10 +244,7 @@ subprojects {
]
}

// Define a separate configuration for managing the dependency on Jetty ALPN agent.
configurations {
alpnagent

compile {
// Detect Maven Enforcer's dependencyConvergence failures. We only
// care for artifacts used as libraries by others.
Expand All @@ -267,9 +264,6 @@ subprojects {
libraries.mockito,
libraries.truth

// Configuration for modules that use Jetty ALPN agent
alpnagent libraries.jetty_alpn_agent

jmh 'org.openjdk.jmh:jmh-core:1.19',
'org.openjdk.jmh:jmh-generator-bytecode:1.19'
}
Expand Down
16 changes: 2 additions & 14 deletions interop-testing/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ dependencies {
}
compileOnly libraries.javax_annotation
runtime libraries.opencensus_impl,
libraries.netty_tcnative
libraries.netty_tcnative,
libraries.conscrypt // for OkHttp
testCompile project(':grpc-context').sourceSets.test.output
}

Expand All @@ -43,27 +44,14 @@ compileJava {
it.options.compilerArgs += ["-Xep:BetaApi:OFF"]
}

test {
// For the automated tests, use Jetty ALPN.
jvmArgs "-javaagent:" + configurations.alpnagent.asPath
}

// For the generated scripts, use Netty tcnative (i.e. OpenSSL).
// Note that OkHttp currently only supports ALPN, so OpenSSL version >= 1.0.2 is required.

task test_client(type: CreateStartScripts) {
mainClassName = "io.grpc.testing.integration.TestServiceClient"
applicationName = "test-client"
defaultJvmOpts = [
"-javaagent:JAVAAGENT_APP_HOME" + configurations.alpnagent.singleFile.name
]
outputDir = new File(project.buildDir, 'tmp')
classpath = jar.outputs.files + configurations.runtime
dependencies { runtime configurations.alpnagent }
doLast {
unixScript.text = unixScript.text.replace('JAVAAGENT_APP_HOME', '\$APP_HOME/lib/')
windowsScript.text = windowsScript.text.replace('JAVAAGENT_APP_HOME', '%APP_HOME%\\lib\\')
}
}

task test_server(type: CreateStartScripts) {
Expand Down
6 changes: 6 additions & 0 deletions netty/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
description = "gRPC: Netty"

configurations {
alpnagent
}

dependencies {
compile project(':grpc-core'),
libraries.netty,
Expand All @@ -11,6 +16,7 @@ dependencies {
testRuntime libraries.netty_tcnative,
libraries.conscrypt
signature "org.codehaus.mojo.signature:java17:1.0@signature"
alpnagent libraries.jetty_alpn_agent
}

[compileJava, compileTestJava].each() {
Expand Down

0 comments on commit 84c62a2

Please sign in to comment.