From cdfe3d3976cac55f2f63ad394e609f4f0546c75a Mon Sep 17 00:00:00 2001 From: Hellblazer Date: Fri, 17 May 2024 18:36:22 -0700 Subject: [PATCH] TCP_NODELAY=true --- .../java/com/salesforce/apollo/demesnes/DemesneSmoke.java | 2 ++ .../java/com/salesforce/apollo/archipelago/Enclave.java | 3 +++ .../java/com/salesforce/apollo/archipelago/MtlsClient.java | 2 ++ .../main/java/com/salesforce/apollo/archipelago/Portal.java | 2 ++ .../salesforce/apollo/archipelago/DemultiplexerTest.java | 2 ++ .../java/com/salesforce/apollo/archipelago/EnclaveTest.java | 2 ++ .../com/salesforce/apollo/model/ProcessContainerDomain.java | 4 ++++ .../com/salesforce/apollo/model/demesnes/DemesneImpl.java | 3 +++ .../com/salesforce/apollo/model/demesnes/DemesneTest.java | 6 +++++- 9 files changed, 25 insertions(+), 1 deletion(-) diff --git a/isolates/src/test/java/com/salesforce/apollo/demesnes/DemesneSmoke.java b/isolates/src/test/java/com/salesforce/apollo/demesnes/DemesneSmoke.java index 766258630..4c13cd545 100644 --- a/isolates/src/test/java/com/salesforce/apollo/demesnes/DemesneSmoke.java +++ b/isolates/src/test/java/com/salesforce/apollo/demesnes/DemesneSmoke.java @@ -43,6 +43,7 @@ import io.grpc.netty.NettyChannelBuilder; import io.grpc.netty.NettyServerBuilder; import io.grpc.stub.StreamObserver; +import io.netty.channel.ChannelOption; import io.netty.channel.EventLoopGroup; import io.netty.channel.unix.DomainSocketAddress; import io.netty.channel.unix.ServerDomainSocketChannel; @@ -192,6 +193,7 @@ public void register(SubContext context) { private ManagedChannel handler(DomainSocketAddress address) { return NettyChannelBuilder.forAddress(address) .executor(executor) + .withOption(ChannelOption.TCP_NODELAY, true) .eventLoopGroup(eventLoopGroup) .channelType(clientChannelType) .keepAliveTime(1, TimeUnit.SECONDS) diff --git a/memberships/src/main/java/com/salesforce/apollo/archipelago/Enclave.java b/memberships/src/main/java/com/salesforce/apollo/archipelago/Enclave.java index 20e65095b..5ae364d6c 100644 --- a/memberships/src/main/java/com/salesforce/apollo/archipelago/Enclave.java +++ b/memberships/src/main/java/com/salesforce/apollo/archipelago/Enclave.java @@ -20,6 +20,7 @@ import io.grpc.netty.DomainSocketNegotiatorHandler.DomainSocketNegotiator; import io.grpc.netty.NettyChannelBuilder; import io.grpc.netty.NettyServerBuilder; +import io.netty.channel.ChannelOption; import io.netty.channel.EventLoopGroup; import io.netty.channel.unix.DomainSocketAddress; import org.slf4j.Logger; @@ -85,6 +86,7 @@ public RouterImpl router(ServerConnectionCache.Builder cacheBuilder, Supplier
  • responseListener, Metadata headers) { } }; final var builder = NettyChannelBuilder.forAddress(bridge) + .withOption(ChannelOption.TCP_NODELAY, true) .executor(executor) .eventLoopGroup(eventLoopGroup) .channelType(channelType) diff --git a/memberships/src/main/java/com/salesforce/apollo/archipelago/MtlsClient.java b/memberships/src/main/java/com/salesforce/apollo/archipelago/MtlsClient.java index fa5342968..58db9ec8e 100644 --- a/memberships/src/main/java/com/salesforce/apollo/archipelago/MtlsClient.java +++ b/memberships/src/main/java/com/salesforce/apollo/archipelago/MtlsClient.java @@ -15,6 +15,7 @@ import io.grpc.ManagedChannel; import io.grpc.Status; import io.grpc.netty.NettyChannelBuilder; +import io.netty.channel.ChannelOption; import io.netty.handler.ssl.ClientAuth; import java.net.SocketAddress; @@ -33,6 +34,7 @@ public MtlsClient(SocketAddress address, ClientAuth clientAuth, String alias, Cl Limiter limiter = new GrpcClientLimiterBuilder().blockOnLimit(false).build(); channel = NettyChannelBuilder.forAddress(address) .executor(executor) + .withOption(ChannelOption.TCP_NODELAY, true) .sslContext(supplier.forClient(clientAuth, alias, validator, MtlsServer.TL_SV1_3)) .intercept(new ConcurrencyLimitClientInterceptor(limiter, () -> Status.RESOURCE_EXHAUSTED.withDescription( diff --git a/memberships/src/main/java/com/salesforce/apollo/archipelago/Portal.java b/memberships/src/main/java/com/salesforce/apollo/archipelago/Portal.java index 74f0eccf8..f0a04955a 100644 --- a/memberships/src/main/java/com/salesforce/apollo/archipelago/Portal.java +++ b/memberships/src/main/java/com/salesforce/apollo/archipelago/Portal.java @@ -15,6 +15,7 @@ import io.grpc.netty.DomainSocketNegotiatorHandler.DomainSocketNegotiator; import io.grpc.netty.NettyChannelBuilder; import io.grpc.netty.NettyServerBuilder; +import io.netty.channel.ChannelOption; import io.netty.channel.EventLoopGroup; import io.netty.channel.unix.DomainSocketAddress; @@ -86,6 +87,7 @@ public void start(Listener responseListener, Metadata headers) { }; return NettyChannelBuilder.forAddress(address) .executor(executor) + .withOption(ChannelOption.TCP_NODELAY, true) .eventLoopGroup(eventLoopGroup) .channelType(channelType) .keepAliveTime(keepAlive.toNanos(), TimeUnit.NANOSECONDS) diff --git a/memberships/src/test/java/com/salesforce/apollo/archipelago/DemultiplexerTest.java b/memberships/src/test/java/com/salesforce/apollo/archipelago/DemultiplexerTest.java index c659a9777..34b5bc66d 100644 --- a/memberships/src/test/java/com/salesforce/apollo/archipelago/DemultiplexerTest.java +++ b/memberships/src/test/java/com/salesforce/apollo/archipelago/DemultiplexerTest.java @@ -25,6 +25,7 @@ import io.grpc.netty.NettyChannelBuilder; import io.grpc.netty.NettyServerBuilder; import io.grpc.stub.StreamObserver; +import io.netty.channel.ChannelOption; import io.netty.channel.EventLoopGroup; import io.netty.channel.unix.DomainSocketAddress; import org.junit.jupiter.api.AfterEach; @@ -114,6 +115,7 @@ public void smokin() throws Exception { private ManagedChannel handler(DomainSocketAddress address) { return NettyChannelBuilder.forAddress(address) + .withOption(ChannelOption.TCP_NODELAY, true) .executor(executor) .eventLoopGroup(eventLoopGroup) .channelType(channelType) diff --git a/memberships/src/test/java/com/salesforce/apollo/archipelago/EnclaveTest.java b/memberships/src/test/java/com/salesforce/apollo/archipelago/EnclaveTest.java index 68e7dd904..55e8c78f2 100644 --- a/memberships/src/test/java/com/salesforce/apollo/archipelago/EnclaveTest.java +++ b/memberships/src/test/java/com/salesforce/apollo/archipelago/EnclaveTest.java @@ -23,6 +23,7 @@ import io.grpc.netty.NettyChannelBuilder; import io.grpc.netty.NettyServerBuilder; import io.grpc.stub.StreamObserver; +import io.netty.channel.ChannelOption; import io.netty.channel.EventLoopGroup; import io.netty.channel.unix.DomainSocketAddress; import org.joou.ULong; @@ -148,6 +149,7 @@ public void smokin() throws Exception { private ManagedChannel handler(DomainSocketAddress address) { return NettyChannelBuilder.forAddress(address) + .withOption(ChannelOption.TCP_NODELAY, true) .executor(executor) .eventLoopGroup(eventLoopGroup) .channelType(channelType) diff --git a/model/src/main/java/com/salesforce/apollo/model/ProcessContainerDomain.java b/model/src/main/java/com/salesforce/apollo/model/ProcessContainerDomain.java index 2052db4f5..6a8f61c83 100644 --- a/model/src/main/java/com/salesforce/apollo/model/ProcessContainerDomain.java +++ b/model/src/main/java/com/salesforce/apollo/model/ProcessContainerDomain.java @@ -30,6 +30,7 @@ import io.grpc.netty.DomainSocketNegotiatorHandler; import io.grpc.netty.NettyChannelBuilder; import io.grpc.netty.NettyServerBuilder; +import io.netty.channel.ChannelOption; import io.netty.channel.EventLoopGroup; import io.netty.channel.unix.DomainSocketAddress; import org.joou.ULong; @@ -84,6 +85,7 @@ public ProcessContainerDomain(Digest group, ControlledIdentifierMember member, P .protocolNegotiator( new DomainSocketNegotiatorHandler.DomainSocketNegotiator( IMPL)) + .withChildOption(ChannelOption.TCP_NODELAY, true) .channelType(IMPL.getServerDomainSocketChannelClass()) .workerEventLoopGroup(portalEventLoopGroup) .bossEventLoopGroup(portalEventLoopGroup) @@ -94,6 +96,7 @@ public ProcessContainerDomain(Digest group, ControlledIdentifierMember member, P outerContextService = NettyServerBuilder.forAddress(outerContextEndpoint) .protocolNegotiator( new DomainSocketNegotiatorHandler.DomainSocketNegotiator(IMPL)) + .withChildOption(ChannelOption.TCP_NODELAY, true) .channelType(IMPL.getServerDomainSocketChannelClass()) .addService(new DemesneKERLServer(dht, null)) .addService(outerContextService()) @@ -207,6 +210,7 @@ protected void stopServices() { private ManagedChannel handler(DomainSocketAddress address) { return NettyChannelBuilder.forAddress(address) + .withOption(ChannelOption.TCP_NODELAY, true) .executor(executor) .eventLoopGroup(clientEventLoopGroup) .channelType(channelType) diff --git a/model/src/main/java/com/salesforce/apollo/model/demesnes/DemesneImpl.java b/model/src/main/java/com/salesforce/apollo/model/demesnes/DemesneImpl.java index ab13a60c5..9e15d8ebe 100644 --- a/model/src/main/java/com/salesforce/apollo/model/demesnes/DemesneImpl.java +++ b/model/src/main/java/com/salesforce/apollo/model/demesnes/DemesneImpl.java @@ -38,6 +38,7 @@ import io.grpc.ManagedChannel; import io.grpc.netty.NettyChannelBuilder; import io.netty.channel.Channel; +import io.netty.channel.ChannelOption; import io.netty.channel.EventLoopGroup; import io.netty.channel.unix.DomainSocketAddress; import org.slf4j.Logger; @@ -189,6 +190,7 @@ private CachingKERL kerlFrom(File address) { ManagedChannel channel = null; try { channel = NettyChannelBuilder.forAddress(serverAddress) + .withOption(ChannelOption.TCP_NODELAY, true) .executor(executor) .intercept(clientInterceptor(kerlContext)) .eventLoopGroup(eventLoopGroup) @@ -210,6 +212,7 @@ private CachingKERL kerlFrom(File address) { private OuterContextClient outerFrom(File address) { return new OuterContextClient(NettyChannelBuilder.forAddress(new DomainSocketAddress(address)) + .withOption(ChannelOption.TCP_NODELAY, true) .executor(executor) .intercept(clientInterceptor(context.getId())) .eventLoopGroup(eventLoopGroup) diff --git a/model/src/test/java/com/salesforce/apollo/model/demesnes/DemesneTest.java b/model/src/test/java/com/salesforce/apollo/model/demesnes/DemesneTest.java index aa24c12b9..bd31b9010 100644 --- a/model/src/test/java/com/salesforce/apollo/model/demesnes/DemesneTest.java +++ b/model/src/test/java/com/salesforce/apollo/model/demesnes/DemesneTest.java @@ -45,6 +45,7 @@ import io.grpc.netty.NettyChannelBuilder; import io.grpc.netty.NettyServerBuilder; import io.grpc.stub.StreamObserver; +import io.netty.channel.ChannelOption; import io.netty.channel.EventLoopGroup; import io.netty.channel.unix.DomainSocketAddress; import io.netty.channel.unix.ServerDomainSocketChannel; @@ -149,7 +150,9 @@ public void portal() throws Exception { .bossEventLoopGroup( IMPL.getEventLoopGroup()) .intercept( - new DomainSocketServerInterceptor()), + new DomainSocketServerInterceptor()) + .withChildOption( + ChannelOption.TCP_NODELAY, true), s -> handler(portalEndpoint), bridge, Duration.ofMillis(1), s -> routes.get(s)); final var endpoint1 = new DomainSocketAddress(Path.of("target").resolve(UUID.randomUUID().toString()).toFile()); @@ -280,6 +283,7 @@ public void register(SubContext context) { private ManagedChannel handler(DomainSocketAddress address) { return NettyChannelBuilder.forAddress(address) + .withOption(ChannelOption.TCP_NODELAY, true) .executor(executor) .eventLoopGroup(eventLoopGroup) .channelType(clientChannelType)