Open lwglgy opened 3 years ago
Is this on a real machine or on a vm ? Also can you just use new IOUringEventLoopGroup(1)
and new NioEventLoopGroup(1)
?
Hi Norman, We tried again with *EventLoopGroup(1), it works! io_uring is about 5 times faster than nio and epoll in terms of packet rate. But meanwhile we found that the io_uring server costs 1300% cpu while nio/epoll costs just 100%. We then found it's caused by io-wq threads. So I used a very big ioSqeAsyncThreshold like 50000000 to do the test again, this time io_uring cost just 100% too, the packet rate is similar with (even a little bit worse than) the nio/epoll one
Given that IOSQE_ASYNC can have a very unexpected behaviour eg issueing an unbounded number of threads to async complete requests (if not in some recent-ish kernel patch IIRC) maybe would be better to let the number of handled fds before using IOSQE_ASYNC unbounded by default, limiting only if necessary, wdyt @normanmaurer ?
We used the official test program, but the results we got were almost no difference between iouring and nio. We use the official benchmark program, our test host has 32 cores, 200G RAM and the kernel version is 5.13.0
The following are our test codes. `
import io.netty.bootstrap.ServerBootstrap; import io.netty.channel.*; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.nio.NioServerSocketChannel;
public class EchoNioServer { private static final int PORT = Integer.parseInt(System.getProperty("port", "8088"));
}
import io.netty.bootstrap.ServerBootstrap; import io.netty.channel.*; import io.netty.channel.socket.SocketChannel; import io.netty.incubator.channel.uring.IOUringEventLoopGroup; import io.netty.incubator.channel.uring.IOUringServerSocketChannel;
// This is using io_uring public class EchoIOUringServer { private static final int PORT = Integer.parseInt(System.getProperty("port", "8081"));
}
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInboundHandlerAdapter;
@ChannelHandler.Sharable public class EchoServerHandler extends ChannelInboundHandlerAdapter {
}
`
Above is our test procedure, which is from the benchmark on the official website, but there is almost no difference in the results we measured.