Use IOSQE_ASYNC flag when submitting

Motivation:

At least in the throughput benchmarks it has shown that IOSQE_ASYNC
gives a lot of performance improvements. Lets enable it by default for
now and maybe make it configurable in the future

Modifications:

Use IOSEQ_ASYNC

Result:

Better performance
This commit is contained in:
Norman Maurer 2020-09-04 20:22:28 +02:00
parent 55460eea2e
commit 1c42a37f67
4 changed files with 10 additions and 4 deletions

View File

@ -381,6 +381,10 @@ static jint netty_io_uring_ioringOpConnect(JNIEnv* env, jclass clazz) {
return IORING_OP_CONNECT;
}
static jint netty_io_uring_iosqeAsync(JNIEnv* env, jclass clazz) {
return IOSQE_ASYNC;
}
// JNI Method Registration Table Begin
static const JNINativeMethod statically_referenced_fixed_method_table[] = {
{ "sockNonblock", "()I", (void *) netty_io_uring_sockNonblock },
@ -395,7 +399,8 @@ static const JNINativeMethod statically_referenced_fixed_method_table[] = {
{ "ioringOpAccept", "()I", (void *) netty_io_uring_ioringOpAccept },
{ "ioringOpRead", "()I", (void *) netty_io_uring_ioringOpRead },
{ "ioringOpWrite", "()I", (void *) netty_io_uring_ioringOpWrite },
{ "ioringOpConnect", "()I", (void *) netty_io_uring_ioringOpConnect }
{ "ioringOpConnect", "()I", (void *) netty_io_uring_ioringOpConnect },
{ "iosqeAsync", "()I", (void *) netty_io_uring_iosqeAsync }
};
static const jint statically_referenced_fixed_method_table_size = sizeof(statically_referenced_fixed_method_table) / sizeof(statically_referenced_fixed_method_table[0]);

View File

@ -136,9 +136,8 @@ final class IOUringSubmissionQueue {
}
}
PlatformDependent.putByte(sqe + SQE_FLAGS_FIELD, (byte) 0);
// TODO: Make it configurable if we should use this flag or not.
PlatformDependent.putByte(sqe + SQE_FLAGS_FIELD, (byte) Native.IOSQE_ASYNC);
// pad field array -> all fields should be zero
long offsetIndex = 0;

View File

@ -77,6 +77,7 @@ final class Native {
static final int IORING_OP_POLL_REMOVE = NativeStaticallyReferencedJniMethods.ioringOpPollRemove();
static final int IORING_OP_CONNECT = NativeStaticallyReferencedJniMethods.ioringOpConnect();
static final int IORING_OP_WRITEV = NativeStaticallyReferencedJniMethods.ioringOpWritev();
static final int IOSQE_ASYNC = NativeStaticallyReferencedJniMethods.iosqeAsync();
public static RingBuffer createRingBuffer(int ringSize) {
//Todo throw Exception if it's null

View File

@ -44,4 +44,5 @@ final class NativeStaticallyReferencedJniMethods {
static native int ioringOpRead();
static native int ioringOpWrite();
static native int ioringOpConnect();
static native int iosqeAsync();
}