What kind of buffer are you using?
Linux AIO requires Native Buffers, aligned to 512.
So, the writes you make have to be aligned to 512.
All the buffers on Java are already using the malloc version that aligns to 512. However releasing a native buffer in Java sucks, as the major portion will be outside of the JRE space, so GC will take longer usually than needed to release the native buffer. Because that I either reuse the buffers as most as I can or I use the native methods to allocate and release native buffers. (i.e doing my own control).
Also: another thing I discovered is that libaio will have thread context control. If you make all the writes using a single thread you will get a higher throughput. (Believe it or not!). (Even if you use a SingleThreadExecutor to make all your writes).
Now I use AsynchronousFileImpl.newBuffer(5120) to create my buffer
But the size to write is src.remaining which is less than 512.
Got the same -22 error.
Dose the size need to be x512 too? If so, how about I only wanna write 32b and close the file?
What does AsynchronousFileImpl.clearBuffer do?
size = x512 works.
But how about I only wanna write less than 512b?