question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Discussion] Support readv() on Linux

See original GitHub issue

I 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:

  1. Make a custom ByteBuf type akin to CompositeByteBuf, which cannot grow in side (i.e. there are a fixed number of nio buffers).
  2. 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.
  3. 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:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
normanmaurercommented, Oct 29, 2019
0reactions
carl-mastrangelocommented, Mar 14, 2020

@normanmaurer it can be closed.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found