Skip to content

Commit 8347ab5

Browse files
committed
Upgrading netty to latest, adding io_uring support, adjusting defaults
1 parent fb57980 commit 8347ab5

File tree

5 files changed

+19
-28
lines changed

5 files changed

+19
-28
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ count of the open connections may be limited by `storage-driver-limit-concurrenc
3131
| storage-net-tcpNoDelay | Flag | true |
3232
| storage-net-timeoutMilliSec | Integer >= 0 | 1000000 | The socket timeout
3333
| 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)
34-
| 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).
34+
| 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).
3535
| 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.
3636
| 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.
37-
| storage-net-ssl-protocols | List of strings | TLSv1, TLSv1.1, TLSv1.2, SSLv3 | The list of secure protocols to use if SSL is enabled
37+
| storage-net-ssl-protocols | List of strings | TLSv1.1, TLSv1.2 | The list of secure protocols to use if SSL is enabled
3838
| storage-net-ssl-provider | String | OPENSSL | The SSL provider. May be "OPENSSL" (better performance) or "JDK" (fallback)
3939

4040
## 2. Node Balancing

build.gradle

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ repositories {
2525

2626
description = "Mongoose is a high-load storage performance testing tool"
2727
group = "com.github.emc-mongoose"
28-
version = "4.2.20"
28+
version = "4.2.21"
2929
sourceCompatibility = 11
3030
targetCompatibility = 11
3131

@@ -40,9 +40,10 @@ ext {
4040
log4j : "2.19.0",
4141
mongooseBase : "4.3.3",
4242
mongooseStorageDriverCoop: "4.2.21",
43-
netty : "4.1.25.Final",
43+
netty : "4.1.115.Final",
4444
nettyConnectionPool: "1.2.1",
45-
nettyTcNative : "2.0.12.Final",
45+
nettyTcNative : "2.0.69.Final",
46+
nettyIoUring : "0.0.25.Final",
4647
scala : "2.12.6",
4748
slf4j : "1.7.25",
4849
]
@@ -94,7 +95,8 @@ dependencies {
9495
"io.netty:netty-transport-native-epoll:${depVersion.netty}:linux-x86_64",
9596
"io.netty:netty-transport-native-kqueue:${depVersion.netty}:osx-x86_64",
9697
"io.netty:netty-transport-native-unix-common:${depVersion.netty}",
97-
"io.netty:netty-tcnative-boringssl-static:${depVersion.nettyTcNative}",
98+
"io.netty:netty-tcnative-boringssl-static:${depVersion.nettyTcNative}:linux-x86_64",
99+
"io.netty.incubator:netty-incubator-transport-native-io_uring:${depVersion.nettyIoUring}:linux-x86_64",
98100
"org.javassist:javassist:${depVersion.javassist}",
99101
)
100102

src/main/java/com/emc/mongoose/storage/driver/coop/netty/NettyStorageDriver.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,15 @@ public interface NettyStorageDriver<I extends Item, O extends Operation<I>>
1717
extends StorageDriver<I, O> {
1818

1919
enum Transport {
20-
NIO, EPOLL, KQUEUE
20+
NIO, EPOLL, KQUEUE, IOURING
2121
}
2222

2323
Map<Transport, String> IO_EXECUTOR_IMPLS = new HashMap<Transport, String>() {
2424
{
2525
put(Transport.NIO, "io.netty.channel.nio.NioEventLoopGroup");
2626
put(Transport.EPOLL, "io.netty.channel.epoll.EpollEventLoopGroup");
2727
put(Transport.KQUEUE, "io.netty.channel.kqueue.KQueueEventLoopGroup");
28+
put(Transport.IOURING, "io.netty.incubator.channel.uring.IOUringEventLoopGroup");
2829
}
2930
};
3031

@@ -33,6 +34,7 @@ enum Transport {
3334
put(Transport.NIO, "io.netty.channel.socket.nio.NioSocketChannel");
3435
put(Transport.EPOLL, "io.netty.channel.epoll.EpollSocketChannel");
3536
put(Transport.KQUEUE, "io.netty.channel.kqueue.KQueueSocketChannel");
37+
put(Transport.IOURING, "io.netty.incubator.channel.uring.IOUringSocketChannel");
3638
}
3739
};
3840

src/main/java/com/emc/mongoose/storage/driver/coop/netty/NettyStorageDriverBase.java

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import com.github.akurilov.netty.connection.pool.MultiNodeConnPoolImpl;
3030
import com.github.akurilov.netty.connection.pool.NonBlockingConnPool;
3131
import io.netty.bootstrap.Bootstrap;
32+
import io.netty.buffer.PooledByteBufAllocator;
3233
import io.netty.channel.Channel;
3334
import io.netty.channel.ChannelFuture;
3435
import io.netty.channel.ChannelFutureListener;
@@ -45,21 +46,17 @@
4546
import io.netty.handler.ssl.SslProvider;
4647
import io.netty.handler.ssl.util.InsecureTrustManagerFactory;
4748
import io.netty.handler.timeout.IdleStateHandler;
48-
import io.netty.util.AttributeKey;
4949

5050
import java.io.IOException;
5151
import java.net.ConnectException;
5252
import java.net.InetSocketAddress;
53-
import java.security.NoSuchAlgorithmException;
54-
import java.util.Arrays;
5553
import java.util.List;
5654
import java.util.concurrent.ThreadFactory;
5755
import java.util.concurrent.TimeUnit;
5856
import org.apache.logging.log4j.CloseableThreadContext;
5957
import org.apache.logging.log4j.Level;
6058
import org.apache.logging.log4j.ThreadContext;
6159

62-
import javax.net.ssl.SSLContext;
6360
import javax.net.ssl.SSLException;
6461

6562
/** Created by kurila on 30.09.16. */
@@ -102,23 +99,14 @@ protected NettyStorageDriverBase(
10299
final var provider = SslProvider.valueOf(providerName);
103100
Loggers.MSG.info("{}: SSL/TLS provider: {}", stepId, providerName);
104101
try {
105-
final var supportedCiphers = Arrays.asList(SSLContext
106-
.getDefault()
107-
.getServerSocketFactory()
108-
.getSupportedCipherSuites());
109-
final var ciphers = (userCiphers == null) ? supportedCiphers : userCiphers;
110-
Loggers.MSG.info("{}: SSL/TLS cipher suites: {}", stepId, ciphers);
111102
sslCtx = SslContextBuilder
112103
.forClient()
113104
.trustManager(InsecureTrustManagerFactory.INSTANCE)
114105
.sslProvider(provider)
115106
.protocols(protocols.toArray(new String[]{}))
116-
.ciphers(ciphers)
107+
.ciphers(userCiphers)
117108
.build();
118-
} catch (final NoSuchAlgorithmException e) {
119-
throw new IllegalConfigurationException(
120-
"Failed to get the list of the supported SSL/TLS cipher suites", e
121-
);
109+
Loggers.MSG.info("{}: SSL/TLS cipher suites: {}", stepId, sslCtx.cipherSuites());
122110
} catch (final SSLException e) {
123111
throw new IllegalConfigurationException("Failed to build the SSL context", e);
124112
}
@@ -163,6 +151,7 @@ protected NettyStorageDriverBase(
163151
} else {
164152
transportKey = Transport.valueOf(transportConfig.toUpperCase());
165153
}
154+
Loggers.MSG.info("{}: netty transport: {}", toString(), transportKey);
166155

167156
try {
168157

@@ -193,13 +182,13 @@ protected NettyStorageDriverBase(
193182
}
194183

195184
bootstrap = new Bootstrap().group(ioExecutor).channel(socketChannelCls);
196-
// bootstrap.option(ChannelOption.ALLOCATOR, ByteBufAllocator)
185+
bootstrap.option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT);
197186
// bootstrap.option(ChannelOption.ALLOW_HALF_CLOSURE)
198187
// bootstrap.option(ChannelOption.RCVBUF_ALLOCATOR, )
199188
// bootstrap.option(ChannelOption.MESSAGE_SIZE_ESTIMATOR)
200189
// bootstrap.option(ChannelOption.AUTO_READ)
201190
bootstrap.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, netConfig.intVal("timeoutMilliSec"));
202-
bootstrap.option(ChannelOption.WRITE_SPIN_COUNT, 1);
191+
bootstrap.option(ChannelOption.WRITE_SPIN_COUNT, 32);
203192
int size = netConfig.intVal("rcvBuf");
204193
if (size > 0) {
205194
bootstrap.option(ChannelOption.SO_RCVBUF, size);

src/main/resources/config/defaults-storage-net.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,14 @@ storage:
1212
sndBuf: 0
1313
tcpNoDelay: true
1414
timeoutMilliSec: 0
15-
ioRatio: 50
15+
ioRatio: 80
1616
transport: epoll
1717
ssl:
1818
ciphers: null
1919
enabled: false
2020
protocols:
21-
- TLSv1
22-
- TLSv1.1
2321
- TLSv1.2
24-
- SSLv3
22+
- TLSv1.1
2523
provider: OPENSSL
2624
node:
2725
addrs:

0 commit comments

Comments
 (0)