Feature - Netty native transport for `io_uring`

- add `TransportMode.IO_URING`
- add incubator uring dependency

Signed-off-by: Sam Gammon <sam@elide.ventures>
pull/5170/head
Sam Gammon 2 years ago
parent 2177bca289
commit f9a7361102
No known key found for this signature in database
GPG Key ID: 1D5903AF4582BCF4

@ -40,6 +40,13 @@
<artifactId>netty-transport-native-epoll</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.netty.incubator</groupId>
<artifactId>netty-incubator-transport-native-io_uring</artifactId>
<scope>provided</scope>
<version>0.0.21.Final</version>
<classifier>linux-x86_64</classifier>
</dependency>
<dependency>
<groupId>io.netty</groupId>

@ -38,4 +38,9 @@ public enum TransportMode {
*/
KQUEUE,
/**
* Use `io_uring` transport. Requires <b>netty-transport-io_uring</b> lib in classpath.
*/
IO_URING,
}

@ -27,6 +27,9 @@ import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioDatagramChannel;
import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.incubator.channel.uring.IOUringDatagramChannel;
import io.netty.incubator.channel.uring.IOUringEventLoopGroup;
import io.netty.incubator.channel.uring.IOUringSocketChannel;
import io.netty.resolver.AddressResolver;
import io.netty.resolver.AddressResolverGroup;
import io.netty.resolver.DefaultAddressResolverGroup;
@ -154,11 +157,16 @@ public class ServiceManager {
}
this.socketChannelClass = KQueueSocketChannel.class;
if (PlatformDependent.isAndroid()) {
this.resolverGroup = DefaultAddressResolverGroup.INSTANCE;
} else {
this.resolverGroup = cfg.getAddressResolverGroupFactory().create(KQueueDatagramChannel.class, DnsServerAddressStreamProviders.platformDefault());
} else if (cfg.getTransportMode() == TransportMode.IO_URING) {
if (cfg.getEventLoopGroup() == null) {
this.group = new IOUringEventLoopGroup(cfg.getNettyThreads(), new DefaultThreadFactory("redisson-netty"));
} else {
this.group = cfg.getEventLoopGroup();
}
this.socketChannelClass = IOUringSocketChannel.class;
this.resolverGroup = cfg.getAddressResolverGroupFactory().create(IOUringDatagramChannel.class, DnsServerAddressStreamProviders.platformDefault());
} else {
if (cfg.getEventLoopGroup() == null) {
this.group = new NioEventLoopGroup(cfg.getNettyThreads(), new DefaultThreadFactory("redisson-netty"));

Loading…
Cancel
Save