Motivation:
we should throw a jvm runtime exception for io_uring creation failure to avoid a NullPointerException
Modifications:
-error handling for creation ring fd and mmap io_uring ring buffer
-some cleanups
Result:
better error handling
Motivation
SQE handling can be simplified in terms of code and operations
performed
Modifications
- Zero SQE array up front - no need to set never-used fields each time
- Fill SQ array up front with corresponding indicies - no need to set
each time since they are 1-1 with SQE array entries
- Keep local head and tail vars and don't track separate sqe array
head/tail
- Allocate memory for timespec directly (no need for ByteBuffer)
- Avoid some unnecessary casts / type conversions (no need to convert
uints to longs)
Result
Fewer operations, less code
Motivation
If we make eventfd blocking then read can take the place of poll+read
Modification
Make eventfd blocking, use READ instead of POLLIN, allocating a static
64bit buffer to read into
Result
Fewer kernel roundtrips for event loop wakeups
easier to test.
Motivation:
We should move the IovArray related code to an extra class so its easier
to test
Modifications:
- Move into extra class
- Add dedicated test
Result:
Cleanup
use it for clearing the IovArrays
Motivation:
IOUringSubmissionQueue may call submit() internally when there is no
space left in the buffer. Once this is done we can reuse for example
IovArrays etc. Because of this its useful to be able to specify a
callback that is executed after submission
Modifications:
- Allow to specify a Runnable that is called once submission was
complete
- Use this callback to clear the IovArrays
Result:
IovArrays are automatically cleared on each submit call.
Motivation:
We should only keep on reading if the fd is still open, otherwise we
will produce a confusing exception
Modifications:
check if fd is still open before schedule the read.
Result:
Dont produce a confusing excepion when the fd was closed during a read
loop.
Motivation:
We need to be careful that we only execute the close(...) once the write
operation completes as otherwise we may close the underlying socket too
fast and also the writes
Modifications:
Keep track of if we need to delay the close or not and if so execute it
once the write completes
Result:
No more test failures
Motivation:
It is possible that io_uring_enter(...) fails with EINTR. In this case
we should just retry the operation
Modifications:
Retry when EINTR was detected
Result:
More correct use of io_uring_enter(...)
Motivation:
At the moment our CI can not build and run the native bits for the iouring transport so we should just not compile this at the moment. The java classes itself should still be compiled tho
Modifications:
Add explicit profile to compile native bits of iouring
Result:
CI passes with iouring transport
Motivation:
incorrect for loop we could end up with an AssertionError (this is
sometimes triggered during testsuite run)
Modifications:
Fix for loop that calls IovArray.clear()
Result:
No more AssertionError
Motivation:
How we did manage the memory of writev was quite wasteful and could
produce a lot of memory overhead. We can just keep it simple by using
an array of IovArrays. Once these are full we can just submit and clear these as at this
point the kernel did take over a copy and its safe to reuse
Modifications:
Use an array of IovArrays and submit once it is full.
Result:
Less memory overhead and less code duplication
IOURING_OP_WRITEV
Motivation:
The bug related to IOSQE_ASYNC and IORING_OP_WRITEV was fixed so no need
to have the workaround
Modifications:
Remove workaround
Result:
Use IOSQE_ASYNC all the time
writes
Motivation:
We need to carefully manage state in terms of writing to guard against
rentrancy problems that could lead to corrupt state in the
ChannelOutboundBuffer
Modifications:
Only reset the flag once removeBytes(...) was called
Result:
No more reentrancy bug related to writes.
Motivation:
There is currently a bug in the kernel that let WRITEV sometimes fail
when IOSEQ_ASYNC is enabled
Modifications:
Don't use IOSEQ_ASYNC for WRITEV for now
Result:
Tests pass
Motivation:
We should better use JNI to lookup constants so we are sure we not mess
things up
Modifications:
Use JNI calls to lookup constants once
Result:
Less error prone code
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
Motivation:
We should submit multiple IO ops at once to reduce the syscall overhead.
Modifications:
- Submit multiple IO ops in batches
- Adjust default ringsize
Result:
Much better performance
Motivation:
We should only reset the RecvByteBufAllocator.Handle when a new "read
loop" starts. Otherwise the handle will not be able to correctly limit
reads.
Modifications:
- Move reset(...) call into pollIn(...)
- Remove all @Ignore
Result:
The whole testsuite passes
Motivation:
Due a bug SO_BACKLOG was not supported via ChannelOption when using io_uring. Be
Modification:
- Add SO_BACKLOG to the supported ChannelOptions.
- Merge IOUringServerChannelConfig into IOUringServerSocketChannelConfig
Result:
SO_BACKLOG is supported
Motivation:
we should move the initAddress to LinuxSocket JNI as it is only used there
Modifications:
- cleanup
- move initAddress to linux socket JNI
Result:
it's cleaner
Motivation:
To ensure we use the correct values when passing values from Java to C and the other way around it is better to use JNI to lookup the values.
Modifications:
Add NativeStaticallyRefererencedJniMethods and use it (just as we do in kqueue / epoll)
Results:
More robust code
Motivation:
We need to cache the localAddress after the connect was complete
Modifications:
- Call socket.localAddress() after the connect was complete
- Enable test again
Result:
Correctly set localAddress after connect was successful
Motivation:
We did have a bug in how we calculated the values for the timespec which lead to incorrect wakeups. Beside this we also missed to always call runAllTasks() which is needed to fetch the ready to be executed scheduled tasks.
Modifications:
- Fix timespec setup
- Always call runAllTasks()
- Add extra testcase
- Remove @Ignore from previous failing test
Result:
Timeouts work as expected