Skip to content
Open
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
4 changes: 2 additions & 2 deletions benchmarks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
</dependency>

<dependency>
<groupId>io.netty.incubator</groupId>
<artifactId>netty-incubator-transport-native-io_uring</artifactId>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-io_uring</artifactId>
<classifier>linux-x86_64</classifier>
</dependency>

Expand Down
17 changes: 9 additions & 8 deletions benchmarks/src/com/aerospike/benchmarks/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,11 @@
import com.aerospike.client.util.Util;

import io.netty.channel.EventLoopGroup;
import io.netty.channel.epoll.EpollEventLoopGroup;
import io.netty.channel.kqueue.KQueueEventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.incubator.channel.uring.IOUringEventLoopGroup;
import io.netty.channel.MultiThreadIoEventLoopGroup;
import io.netty.channel.epoll.EpollIoHandler;
import io.netty.channel.kqueue.KQueueIoHandler;
import io.netty.channel.nio.NioIoHandler;
import io.netty.channel.uring.IoUringIoHandler;

public class Main implements Log.Callback {

Expand Down Expand Up @@ -1176,25 +1177,25 @@ public void runBenchmarks() throws Exception {
}

case NETTY_NIO: {
EventLoopGroup group = new NioEventLoopGroup(this.eventLoopSize);
EventLoopGroup group = new MultiThreadIoEventLoopGroup(this.eventLoopSize, NioIoHandler.newFactory());
eventLoops = new NettyEventLoops(eventPolicy, group, this.eventLoopType);
break;
}

case NETTY_EPOLL: {
EventLoopGroup group = new EpollEventLoopGroup(this.eventLoopSize);
EventLoopGroup group = new MultiThreadIoEventLoopGroup(this.eventLoopSize, EpollIoHandler.newFactory());
eventLoops = new NettyEventLoops(eventPolicy, group, this.eventLoopType);
break;
}

case NETTY_KQUEUE: {
EventLoopGroup group = new KQueueEventLoopGroup(this.eventLoopSize);
EventLoopGroup group = new MultiThreadIoEventLoopGroup(this.eventLoopSize, KQueueIoHandler.newFactory());
eventLoops = new NettyEventLoops(eventPolicy, group, this.eventLoopType);
break;
}

case NETTY_IOURING: {
EventLoopGroup group = new IOUringEventLoopGroup(this.eventLoopSize);
EventLoopGroup group = new MultiThreadIoEventLoopGroup(this.eventLoopSize, IoUringIoHandler.newFactory());
eventLoops = new NettyEventLoops(eventPolicy, group, this.eventLoopType);
break;
}
Expand Down
4 changes: 2 additions & 2 deletions client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
</dependency>

<dependency>
<groupId>io.netty.incubator</groupId>
<artifactId>netty-incubator-transport-native-io_uring</artifactId>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-io_uring</artifactId>
<classifier>linux-x86_64</classifier>
<scope>provided</scope>
<optional>true</optional>
Expand Down
4 changes: 2 additions & 2 deletions client/src/com/aerospike/client/async/NettyCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.handler.ssl.SslHandler;
import io.netty.handler.ssl.SslHandshakeCompletionEvent;
import io.netty.incubator.channel.uring.IOUringSocketChannel;
import io.netty.channel.uring.IoUringSocketChannel;

/**
* Asynchronous command handler using netty.
Expand Down Expand Up @@ -379,7 +379,7 @@ static final void initBootstrap(Bootstrap b, Cluster cluster, NettyEventLoop eve
break;

case NETTY_IOURING:
b.channel(IOUringSocketChannel.class);
b.channel(IoUringSocketChannel.class);
break;
}

Expand Down
60 changes: 21 additions & 39 deletions client/src/com/aerospike/client/async/NettyEventLoops.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,17 @@
import com.aerospike.client.AerospikeException;

import io.netty.channel.EventLoopGroup;
import io.netty.channel.epoll.EpollEventLoopGroup;
import io.netty.channel.IoEventLoopGroup;
import io.netty.channel.epoll.EpollIoHandler;
import io.netty.channel.epoll.EpollSocketChannel;
import io.netty.channel.kqueue.KQueueEventLoopGroup;
import io.netty.channel.kqueue.KQueueIoHandler;
import io.netty.channel.kqueue.KQueueSocketChannel;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.local.LocalIoHandler;
import io.netty.channel.nio.NioIoHandler;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.incubator.channel.uring.IOUringEventLoopGroup;
import io.netty.incubator.channel.uring.IOUringSocketChannel;
import io.netty.channel.uring.IoUringIoHandler;
import io.netty.channel.uring.IoUringSocketChannel;
import io.netty.util.concurrent.EventExecutor;

/**
Expand Down Expand Up @@ -99,41 +101,21 @@ public void run() {
}

private static EventLoopType getEventLoopType(EventLoopGroup group) {
// Wrap each instanceof comparison in a try/catch block because these classes reference
// libraries that are optional and might not be specified in the build file (pom.xml).
// This is preferable to using a "getClass().getSimpleName()" switch statement because
// that requires exact classname equality and does not handle custom classes that might
// inherit from these classes.
try {
if (group instanceof NioEventLoopGroup) {
return EventLoopType.NETTY_NIO;
}
}
catch (NoClassDefFoundError e) {
}

try {
if (group instanceof EpollEventLoopGroup) {
return EventLoopType.NETTY_EPOLL;
}
}
catch (NoClassDefFoundError e) {
}

try {
if (group instanceof KQueueEventLoopGroup) {
return EventLoopType.NETTY_KQUEUE;
}
}
catch (NoClassDefFoundError e) {
}

try {
if (group instanceof IOUringEventLoopGroup) {
return EventLoopType.NETTY_IOURING;
if (group instanceof IoEventLoopGroup g) {
if (g.isIoType(EpollIoHandler.class)) {
return EventLoopType.NETTY_EPOLL;
} else if (g.isIoType(KQueueIoHandler.class)) {
return EventLoopType.NETTY_KQUEUE;
} else if (g.isIoType(IoUringIoHandler.class)) {
return EventLoopType.NETTY_IOURING;
} else if (g.isIoType(NioIoHandler.class)) {
return EventLoopType.NETTY_NIO;
} else if (g.isIoType(LocalIoHandler.class)) {
return EventLoopType.DIRECT_NIO;
}
}
}
catch (NoClassDefFoundError e) {
}catch (NoClassDefFoundError e) {
}

throw new AerospikeException("Unexpected EventLoopGroup");
Expand All @@ -155,7 +137,7 @@ public Class<? extends SocketChannel> getSocketChannelClass() {
return KQueueSocketChannel.class;

case NETTY_IOURING:
return IOUringSocketChannel.class;
return IoUringSocketChannel.class;
}
}

Expand Down
4 changes: 2 additions & 2 deletions examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
</dependency>

<dependency>
<groupId>io.netty.incubator</groupId>
<artifactId>netty-incubator-transport-native-io_uring</artifactId>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-io_uring</artifactId>
<classifier>linux-x86_64</classifier>
</dependency>

Expand Down
17 changes: 9 additions & 8 deletions examples/src/com/aerospike/examples/AsyncExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@
import com.aerospike.client.util.Util;

import io.netty.channel.EventLoopGroup;
import io.netty.channel.epoll.EpollEventLoopGroup;
import io.netty.channel.kqueue.KQueueEventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.incubator.channel.uring.IOUringEventLoopGroup;
import io.netty.channel.MultiThreadIoEventLoopGroup;
import io.netty.channel.epoll.EpollIoHandler;
import io.netty.channel.kqueue.KQueueIoHandler;
import io.netty.channel.nio.NioIoHandler;
import io.netty.channel.uring.IoUringIoHandler;

public abstract class AsyncExample {
/**
Expand All @@ -57,25 +58,25 @@ public static void runExamples(Console console, Parameters params, List<String>
}

case NETTY_NIO: {
EventLoopGroup group = new NioEventLoopGroup(1);
EventLoopGroup group = new MultiThreadIoEventLoopGroup(1, NioIoHandler.newFactory());
eventLoops = new NettyEventLoops(eventPolicy, group, params.eventLoopType);
break;
}

case NETTY_EPOLL: {
EventLoopGroup group = new EpollEventLoopGroup(1);
EventLoopGroup group = new MultiThreadIoEventLoopGroup(1, EpollIoHandler.newFactory());
eventLoops = new NettyEventLoops(eventPolicy, group, params.eventLoopType);
break;
}

case NETTY_KQUEUE: {
EventLoopGroup group = new KQueueEventLoopGroup(1);
EventLoopGroup group = new MultiThreadIoEventLoopGroup(1, KQueueIoHandler.newFactory());
eventLoops = new NettyEventLoops(eventPolicy, group, params.eventLoopType);
break;
}

case NETTY_IOURING: {
EventLoopGroup group = new IOUringEventLoopGroup(1);
EventLoopGroup group = new MultiThreadIoEventLoopGroup(1, IoUringIoHandler.newFactory());
eventLoops = new NettyEventLoops(eventPolicy, group, params.eventLoopType);
break;
}
Expand Down
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<maven-surefire-plugin.version>2.18.1</maven-surefire-plugin.version>
<maven-javadoc-plugin.version>3.2.0</maven-javadoc-plugin.version>

<netty.version>4.1.119.Final</netty.version>
<netty.version>4.2.2.Final</netty.version>
<luaj-jse.version>3.0.1</luaj-jse.version>
<jbcrypt.version>0.4</jbcrypt.version>
<commons-cli.version>1.9.0</commons-cli.version>
Expand Down Expand Up @@ -77,10 +77,10 @@
</dependency>

<dependency>
<groupId>io.netty.incubator</groupId>
<artifactId>netty-incubator-transport-native-io_uring</artifactId>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-io_uring</artifactId>
<classifier>linux-x86_64</classifier>
<version>0.0.26.Final</version>
<version>${netty.version}</version>
</dependency>

<dependency>
Expand Down
4 changes: 2 additions & 2 deletions test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
</dependency>

<dependency>
<groupId>io.netty.incubator</groupId>
<artifactId>netty-incubator-transport-native-io_uring</artifactId>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-io_uring</artifactId>
<classifier>linux-x86_64</classifier>
</dependency>

Expand Down
17 changes: 9 additions & 8 deletions test/src/com/aerospike/test/SuiteAsync.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@
import com.aerospike.test.async.TestAsyncUDF;
import com.aerospike.test.util.Args;

import io.netty.channel.MultiThreadIoEventLoopGroup;
import io.netty.channel.epoll.EpollIoHandler;
import io.netty.channel.kqueue.KQueueIoHandler;
import io.netty.channel.nio.NioIoHandler;
import io.netty.channel.uring.IoUringIoHandler;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.epoll.EpollEventLoopGroup;
import io.netty.channel.kqueue.KQueueEventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.incubator.channel.uring.IOUringEventLoopGroup;

@RunWith(Suite.class)
@Suite.SuiteClasses({
Expand Down Expand Up @@ -78,25 +79,25 @@ public static void init() {
}

case NETTY_NIO: {
EventLoopGroup group = new NioEventLoopGroup(1);
EventLoopGroup group = new MultiThreadIoEventLoopGroup(1, NioIoHandler.newFactory());
eventLoops = new NettyEventLoops(eventPolicy, group, args.eventLoopType);
break;
}

case NETTY_EPOLL: {
EventLoopGroup group = new EpollEventLoopGroup(1);
EventLoopGroup group = new MultiThreadIoEventLoopGroup(1, EpollIoHandler.newFactory());
eventLoops = new NettyEventLoops(eventPolicy, group, args.eventLoopType);
break;
}

case NETTY_KQUEUE: {
EventLoopGroup group = new KQueueEventLoopGroup(1);
EventLoopGroup group = new MultiThreadIoEventLoopGroup(1, KQueueIoHandler.newFactory());
eventLoops = new NettyEventLoops(eventPolicy, group, args.eventLoopType);
break;
}

case NETTY_IOURING: {
EventLoopGroup group = new IOUringEventLoopGroup(1);
EventLoopGroup group = new MultiThreadIoEventLoopGroup(1, IoUringIoHandler.newFactory());
eventLoops = new NettyEventLoops(eventPolicy, group, args.eventLoopType);
break;
}
Expand Down