[Discussion] Support readv() on Linux
See original GitHub issueI would like to get some feedback on some work I plan on doing for Netty that enable using the readv
syscall. Today, there is a RecvByteBufAllocator
which is attached to the channel that is used to support reading in data. It allocates a single buffer, keeping track of how much data to allocate. I am considering making the following changes:
- Make a custom ByteBuf type akin to CompositeByteBuf, which cannot grow in side (i.e. there are a fixed number of nio buffers).
- If the RecvByteBufAllocator returns such a type, the readv() syscall can be used. For Nio sockets this means being able to use ScatteringByteChannel, and using a
readv()
JNI wrapper for Epoll. I don’t know enough about Kqueue to support this, but in the future it could be added. - Modify RecvByteBufAllocator to not use
guess()
somehow. The guess() function is use to strongly limit how much data can be read at a time, but this is harder to express in a vector read. Guess makes sense when coming from a world of single buffer reads, as it’s easy to slice the destination down to size. But a vectored read is not so clear. I don’t know exactly how this can work (hence this issue), but I am thinking some how returning a negative number for guess() mean disabling it.
@normanmaurer @njhill thoughts?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:7 (6 by maintainers)
Top Results From Across the Web
4. Advanced File I/O - Linux System Programming [Book]
The readv( ) function reads count segments from the file descriptor fd into the buffers described by iov : #include <sys/uio.h> ssize_t readv...
Read more >readv(2) - Linux manual page - man7.org
The writev() system call writes iovcnt buffers of data described by iov to the file associated with the file descriptor fd ("gather output")....
Read more >Linux Tutorial: POSIX Threads
POSIX thread (pthread) libraries · Thread operations include thread creation, termination, synchronization (joins,blocking), scheduling, data management and ...
Read more >Community support - Ubuntu
Find community support · Ask Ubuntu and Ubuntu Forums are great sources of answers to common questions about installing, troubleshooting and optimising Ubuntu....
Read more >A 10-minute guide to the Linux ABI - Opensource.com
Familiarize yourself with the concept of an ABI, why ABI stability matters, and what is included in Linux's stable ABI.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@carl-mastrangelo couldn’t you do something like https://github.com/netty/netty/pull/9509 ?
@normanmaurer it can be closed.