Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proto: write outgoing packets to caller-supplied memory #729

Closed
Ralith opened this issue Apr 22, 2020 · 5 comments
Closed

proto: write outgoing packets to caller-supplied memory #729

Ralith opened this issue Apr 22, 2020 · 5 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@Ralith
Copy link
Collaborator

Ralith commented Apr 22, 2020

Connection::poll_transmit allocates and immediately returns a Vec<u8>. There's no reason it couldn't instead take a &mut [MaybeUninit<u8>] or similar, giving the caller much greater flexibility to reduce allocations/copies, particularly when working with e.g. registered io_uring buffers.

@lmpn
Copy link
Contributor

lmpn commented Oct 13, 2023

This PR #1545 seems to have addressed this issue

@Ralith
Copy link
Collaborator Author

Ralith commented Oct 13, 2023

It has not; refer to the signature of Connetion::poll_transmit.

@lmpn
Copy link
Contributor

lmpn commented Oct 16, 2023

I'm giving it a try 👍

@cameronelliott
Copy link

Just surfing by, and saw this.
I'm just going to dump my two cents for what it's worth.
Please ignore if it is not relevant for you.

This type of issue is super important for io_uring, AF_XDP, DPDK, (Networking APIs to get to 100Gbits/sec++)

Actually to take Quinn or any Rust Quic stack to the next level the whole RX & TX hot paths should be allocation-free except by the consumer of the Quic stack.

It would be great to have a Rust Quic stack that allows caller-supplied buffers for both the RX & TX paths, and is allocation-free on the hot path.
(When I say RX, I mean the post-decryption RX destination, a sans-io Quic has the caller do the raw RX)

@Ralith
Copy link
Collaborator Author

Ralith commented Dec 24, 2023

This was fixed by @lmpn's generous contribution in #1697.

I mean the post-decryption RX destination

We already decrypt in-place in caller-supplied memory, and only alloc/copy on the receive path when needed to reduce memory usage. Memory allocation is not currently a bottleneck for Quinn; if you want to hit massive throughput, parallelism and encryption are your main bottlenecks. If you're interested in hitting demanding performance targets with Quinn, feel free to open a new issue to discuss any obstacles you encounter.

@Ralith Ralith closed this as completed Dec 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants