Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import io.airlift.drift.transport.client.DriftClientConfig;
import io.airlift.drift.transport.client.MethodInvokerFactory;
import io.netty.buffer.ByteBufAllocator;
import io.netty.buffer.PooledByteBufAllocator;
import jakarta.annotation.PreDestroy;

import java.lang.annotation.Annotation;
Expand All @@ -42,7 +43,7 @@ public class DriftNettyClientModule

public DriftNettyClientModule()
{
this(ByteBufAllocator.DEFAULT);
this(PooledByteBufAllocator.DEFAULT);
}

@VisibleForTesting
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@
import io.airlift.drift.transport.netty.ssl.SslContextFactory;
import io.airlift.drift.transport.netty.ssl.SslContextFactory.SslContextParameters;
import io.netty.buffer.ByteBufAllocator;
import io.netty.buffer.PooledByteBufAllocator;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.MultiThreadIoEventLoopGroup;
import io.netty.channel.nio.NioIoHandler;
import jakarta.annotation.PreDestroy;

import java.io.Closeable;
Expand All @@ -50,7 +52,7 @@ public class DriftNettyMethodInvokerFactory<I>

public static DriftNettyMethodInvokerFactory<?> createStaticDriftNettyMethodInvokerFactory(DriftNettyClientConfig clientConfig)
{
return createStaticDriftNettyMethodInvokerFactory(clientConfig, ByteBufAllocator.DEFAULT);
return createStaticDriftNettyMethodInvokerFactory(clientConfig, PooledByteBufAllocator.DEFAULT);
}

@VisibleForTesting
Expand All @@ -63,7 +65,7 @@ public DriftNettyMethodInvokerFactory(
DriftNettyConnectionFactoryConfig factoryConfig,
Function<I, DriftNettyClientConfig> clientConfigurationProvider)
{
this(factoryConfig, clientConfigurationProvider, ByteBufAllocator.DEFAULT);
this(factoryConfig, clientConfigurationProvider, PooledByteBufAllocator.DEFAULT);
}

@VisibleForTesting
Expand All @@ -74,7 +76,7 @@ public DriftNettyMethodInvokerFactory(
{
requireNonNull(factoryConfig, "factoryConfig is null");

group = new NioEventLoopGroup(factoryConfig.getThreadCount(), daemonThreadsNamed("drift-client-%s"));
group = new MultiThreadIoEventLoopGroup(factoryConfig.getThreadCount(), daemonThreadsNamed("drift-client-%s"), NioIoHandler.newFactory());

this.clientConfigurationProvider = requireNonNull(clientConfigurationProvider, "clientConfigurationProvider is null");
this.sslContextFactory = createSslContextFactory(true, factoryConfig.getSslContextRefreshTime(), group);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@
import io.airlift.drift.transport.server.ServerTransport;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.buffer.ByteBufAllocator;
import io.netty.buffer.PooledByteBufAllocator;
import io.netty.channel.Channel;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.MultiThreadIoEventLoopGroup;
import io.netty.channel.nio.NioIoHandler;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.handler.ssl.SslContext;
import io.netty.util.concurrent.Future;
Expand Down Expand Up @@ -56,7 +58,7 @@ public class DriftNettyServerTransport

public DriftNettyServerTransport(ServerMethodInvoker methodInvoker, DriftNettyServerConfig config)
{
this(methodInvoker, config, ByteBufAllocator.DEFAULT);
this(methodInvoker, config, PooledByteBufAllocator.DEFAULT);
}

@VisibleForTesting
Expand All @@ -66,9 +68,9 @@ public DriftNettyServerTransport(ServerMethodInvoker methodInvoker, DriftNettySe
requireNonNull(config, "config is null");
this.port = config.getPort();

ioGroup = new NioEventLoopGroup(config.getIoThreadCount(), threadsNamed("drift-server-io-%s"));
ioGroup = new MultiThreadIoEventLoopGroup(config.getIoThreadCount(), threadsNamed("drift-server-io-%s"), NioIoHandler.newFactory());

workerGroup = new NioEventLoopGroup(config.getWorkerThreadCount(), threadsNamed("drift-server-worker-%s"));
workerGroup = new MultiThreadIoEventLoopGroup(config.getWorkerThreadCount(), threadsNamed("drift-server-worker-%s"), NioIoHandler.newFactory());

Optional<Supplier<SslContext>> sslContext = Optional.empty();
if (config.isSslEnabled()) {
Expand Down Expand Up @@ -101,6 +103,7 @@ public DriftNettyServerTransport(ServerMethodInvoker methodInvoker, DriftNettySe
.childHandler(serverInitializer)
.option(SO_BACKLOG, config.getAcceptBacklog())
.option(ALLOCATOR, allocator)
.childOption(ALLOCATOR, allocator)
.childOption(SO_KEEPALIVE, true)
.validate();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import io.airlift.drift.transport.server.ServerTransport;
import io.airlift.drift.transport.server.ServerTransportFactory;
import io.netty.buffer.ByteBufAllocator;
import io.netty.buffer.PooledByteBufAllocator;

import static java.util.Objects.requireNonNull;

Expand All @@ -31,7 +32,7 @@ public class DriftNettyServerTransportFactory

public DriftNettyServerTransportFactory(DriftNettyServerConfig config)
{
this(config, ByteBufAllocator.DEFAULT);
this(config, PooledByteBufAllocator.DEFAULT);
}

@Inject
Expand Down