Skip to content

Commit

Permalink
Upgrading netty to latest, adding io_uring support, adjusting defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
dlarge committed Nov 21, 2024
1 parent fb57980 commit 8347ab5
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 28 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ count of the open connections may be limited by `storage-driver-limit-concurrenc
| storage-net-tcpNoDelay | Flag | true |
| storage-net-timeoutMilliSec | Integer >= 0 | 1000000 | The socket timeout
| storage-net-ioRatio | 0 < Integer < 100 | 50 | Internal [Netty's I/O ratio parameter](https://github.com/netty/netty/issues/1154#issuecomment-14870909). It's recommended to make it higher for large request/response payload (>1MB)
| storage-net-transport | Enum | nio | The I/O transport to use (see the [details](http://netty.io/wiki/native-transports.html)). By default tries to use "nio" (the most compatible). For Linux try to use "epoll", for MacOS/BSD use "kqueue" (requires rebuilding).
| storage-net-transport | Enum | nio | The I/O transport to use (see the [details](http://netty.io/wiki/native-transports.html)). By default tries to use "nio" (the most compatible). For Linux try to use "epoll" or "iouring", for MacOS/BSD use "kqueue" (requires rebuilding).
| storage-net-ssl-ciphers | List of strings | null | The list of ciphers to use if SSL is enabled. First cipher in the list that matches is applied. Make sure to match used ciphers and protocols.
| storage-net-ssl-enabled | Flag | false | The flag to enable the load through SSL/TLS. Currently only HTTPS implementation is available. Have no effect if configured storage type is filesystem.
| storage-net-ssl-protocols | List of strings | TLSv1, TLSv1.1, TLSv1.2, SSLv3 | The list of secure protocols to use if SSL is enabled
| storage-net-ssl-protocols | List of strings | TLSv1.1, TLSv1.2 | The list of secure protocols to use if SSL is enabled
| storage-net-ssl-provider | String | OPENSSL | The SSL provider. May be "OPENSSL" (better performance) or "JDK" (fallback)

## 2. Node Balancing
Expand Down
10 changes: 6 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ repositories {

description = "Mongoose is a high-load storage performance testing tool"
group = "com.github.emc-mongoose"
version = "4.2.20"
version = "4.2.21"
sourceCompatibility = 11
targetCompatibility = 11

Expand All @@ -40,9 +40,10 @@ ext {
log4j : "2.19.0",
mongooseBase : "4.3.3",
mongooseStorageDriverCoop: "4.2.21",
netty : "4.1.25.Final",
netty : "4.1.115.Final",
nettyConnectionPool: "1.2.1",
nettyTcNative : "2.0.12.Final",
nettyTcNative : "2.0.69.Final",
nettyIoUring : "0.0.25.Final",
scala : "2.12.6",
slf4j : "1.7.25",
]
Expand Down Expand Up @@ -94,7 +95,8 @@ dependencies {
"io.netty:netty-transport-native-epoll:${depVersion.netty}:linux-x86_64",
"io.netty:netty-transport-native-kqueue:${depVersion.netty}:osx-x86_64",
"io.netty:netty-transport-native-unix-common:${depVersion.netty}",
"io.netty:netty-tcnative-boringssl-static:${depVersion.nettyTcNative}",
"io.netty:netty-tcnative-boringssl-static:${depVersion.nettyTcNative}:linux-x86_64",
"io.netty.incubator:netty-incubator-transport-native-io_uring:${depVersion.nettyIoUring}:linux-x86_64",
"org.javassist:javassist:${depVersion.javassist}",
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@ public interface NettyStorageDriver<I extends Item, O extends Operation<I>>
extends StorageDriver<I, O> {

enum Transport {
NIO, EPOLL, KQUEUE
NIO, EPOLL, KQUEUE, IOURING
}

Map<Transport, String> IO_EXECUTOR_IMPLS = new HashMap<Transport, String>() {
{
put(Transport.NIO, "io.netty.channel.nio.NioEventLoopGroup");
put(Transport.EPOLL, "io.netty.channel.epoll.EpollEventLoopGroup");
put(Transport.KQUEUE, "io.netty.channel.kqueue.KQueueEventLoopGroup");
put(Transport.IOURING, "io.netty.incubator.channel.uring.IOUringEventLoopGroup");
}
};

Expand All @@ -33,6 +34,7 @@ enum Transport {
put(Transport.NIO, "io.netty.channel.socket.nio.NioSocketChannel");
put(Transport.EPOLL, "io.netty.channel.epoll.EpollSocketChannel");
put(Transport.KQUEUE, "io.netty.channel.kqueue.KQueueSocketChannel");
put(Transport.IOURING, "io.netty.incubator.channel.uring.IOUringSocketChannel");
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import com.github.akurilov.netty.connection.pool.MultiNodeConnPoolImpl;
import com.github.akurilov.netty.connection.pool.NonBlockingConnPool;
import io.netty.bootstrap.Bootstrap;
import io.netty.buffer.PooledByteBufAllocator;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener;
Expand All @@ -45,21 +46,17 @@
import io.netty.handler.ssl.SslProvider;
import io.netty.handler.ssl.util.InsecureTrustManagerFactory;
import io.netty.handler.timeout.IdleStateHandler;
import io.netty.util.AttributeKey;

import java.io.IOException;
import java.net.ConnectException;
import java.net.InetSocketAddress;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import org.apache.logging.log4j.CloseableThreadContext;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.ThreadContext;

import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLException;

/** Created by kurila on 30.09.16. */
Expand Down Expand Up @@ -102,23 +99,14 @@ protected NettyStorageDriverBase(
final var provider = SslProvider.valueOf(providerName);
Loggers.MSG.info("{}: SSL/TLS provider: {}", stepId, providerName);
try {
final var supportedCiphers = Arrays.asList(SSLContext
.getDefault()
.getServerSocketFactory()
.getSupportedCipherSuites());
final var ciphers = (userCiphers == null) ? supportedCiphers : userCiphers;
Loggers.MSG.info("{}: SSL/TLS cipher suites: {}", stepId, ciphers);
sslCtx = SslContextBuilder
.forClient()
.trustManager(InsecureTrustManagerFactory.INSTANCE)
.sslProvider(provider)
.protocols(protocols.toArray(new String[]{}))
.ciphers(ciphers)
.ciphers(userCiphers)
.build();
} catch (final NoSuchAlgorithmException e) {
throw new IllegalConfigurationException(
"Failed to get the list of the supported SSL/TLS cipher suites", e
);
Loggers.MSG.info("{}: SSL/TLS cipher suites: {}", stepId, sslCtx.cipherSuites());
} catch (final SSLException e) {
throw new IllegalConfigurationException("Failed to build the SSL context", e);
}
Expand Down Expand Up @@ -163,6 +151,7 @@ protected NettyStorageDriverBase(
} else {
transportKey = Transport.valueOf(transportConfig.toUpperCase());
}
Loggers.MSG.info("{}: netty transport: {}", toString(), transportKey);

try {

Expand Down Expand Up @@ -193,13 +182,13 @@ protected NettyStorageDriverBase(
}

bootstrap = new Bootstrap().group(ioExecutor).channel(socketChannelCls);
// bootstrap.option(ChannelOption.ALLOCATOR, ByteBufAllocator)
bootstrap.option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT);
// bootstrap.option(ChannelOption.ALLOW_HALF_CLOSURE)
// bootstrap.option(ChannelOption.RCVBUF_ALLOCATOR, )
// bootstrap.option(ChannelOption.MESSAGE_SIZE_ESTIMATOR)
// bootstrap.option(ChannelOption.AUTO_READ)
bootstrap.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, netConfig.intVal("timeoutMilliSec"));
bootstrap.option(ChannelOption.WRITE_SPIN_COUNT, 1);
bootstrap.option(ChannelOption.WRITE_SPIN_COUNT, 32);
int size = netConfig.intVal("rcvBuf");
if (size > 0) {
bootstrap.option(ChannelOption.SO_RCVBUF, size);
Expand Down
6 changes: 2 additions & 4 deletions src/main/resources/config/defaults-storage-net.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,14 @@ storage:
sndBuf: 0
tcpNoDelay: true
timeoutMilliSec: 0
ioRatio: 50
ioRatio: 80
transport: epoll
ssl:
ciphers: null
enabled: false
protocols:
- TLSv1
- TLSv1.1
- TLSv1.2
- SSLv3
- TLSv1.1
provider: OPENSSL
node:
addrs:
Expand Down

0 comments on commit 8347ab5

Please sign in to comment.