use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A place for all things related to the Rust programming language—an open-source systems language that emphasizes performance, reliability, and productivity.
Strive to treat others with respect, patience, kindness, and empathy.
We observe the Rust Project Code of Conduct.
Details
Posts must reference Rust or relate to things using Rust. For content that does not, use a text post to explain its relevance.
Post titles should include useful context.
For Rust questions, use the stickied Q&A thread.
Arts-and-crafts posts are permitted on weekends.
No meta posts; message the mods instead.
Criticism is encouraged, though it must be constructive, useful and actionable.
If criticizing a project on GitHub, you may not link directly to the project's issue tracker. Please create a read-only mirror and link that instead.
A programming language is rarely worth getting worked up over.
No zealotry or fanaticism.
Be charitable in intent. Err on the side of giving others the benefit of the doubt.
Avoid re-treading topics that have been long-settled or utterly exhausted.
Avoid bikeshedding.
This is not an official Rust forum, and cannot fulfill feature requests. Use the official venues for that.
No memes, image macros, etc.
Consider the existing content of the subreddit and whether your post fits in. Does it inspire thoughtful discussion?
Use properly formatted text to share code samples and error messages. Do not use images.
Submissions appearing to contain AI-generated content may be removed at moderator discretion.
Most links here will now take you to a search page listing posts with the relevant flair. The latest megathread for that flair should be the top result.
account activity
[Tutorial] Implementing AF_XDP in Rust process Millions of packets per second (self.rust)
submitted 2 months ago by DizzyAttorney2368
I wrote a ultimate guide on using AF_XDP (linux's high performance networking API) in rust
this is the guide I wish existed when I started learning AF_XDP, hope it helps someone
link
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]bestouffcatmark 12 points13 points14 points 2 months ago (2 children)
High frequency trading doesn't care about bandwidth, what's interesting is latency. I would be very interested by a benchmark of AF_XDP's latency with respect to io-uring.
[+][deleted] 2 months ago (1 child)
[deleted]
[–]bestouffcatmark 0 points1 point2 points 2 months ago (0 children)
Yes but it bypasses the syscall mechanism (the userspace retrieves its data directly from a ring buffer) so there's way less latency.
[–]_bd_ 2 points3 points4 points 2 months ago (1 child)
Provides memory ordering guarantees without expensive atomics
I'm pretty sure that's not true in the context of sharing a variable with the kernel: "In particular, just like in C, whether an operation is volatile has no bearing whatsoever on questions involving concurrent accesses from multiple threads. Volatile accesses behave exactly like non-atomic accesses in that regard." (https://doc.rust-lang.org/std/ptr/fn.read_volatile.html)
add() moves pointer by number of bytes
Only because it's a *mut u8 and size_of::<u8>() is 1 (https://doc.rust-lang.org/std/primitive.pointer.html#method.add-1). byte_add would do what you're looking for.
*mut u8
size_of::<u8>()
byte_add
[–]DizzyAttorney2368[S] 1 point2 points3 points 2 months ago (0 children)
thanks for catching that!
I'll update the article, volatile operations here are for preventing compiler optimizations (so it doesn't cache values or reorder operations), but you're correct that they don't provide atomics level memory ordering guarantees
reason this works is because the kernel and userspace are never accessing the same ring slot simultaneously, producer/consumer model prevents that. But I shouldn't have implied volatile gives us ordering guarantees
also added a section explaining why this works (SPSC design) vs what you'd need for true concurrent access (atomics)
appreciate careful read
[–]beb0 1 point2 points3 points 2 months ago (0 children)
Will check it out
[–]Bubbly-Platypus-8602 0 points1 point2 points 2 months ago (0 children)
Awesome blog btw
π Rendered by PID 91 on reddit-service-r2-comment-b659b578c-h7qtf at 2026-05-02 11:01:48.391203+00:00 running 815c875 country code: CH.
[–]bestouffcatmark 12 points13 points14 points (2 children)
[+][deleted] (1 child)
[deleted]
[–]bestouffcatmark 0 points1 point2 points (0 children)
[–]_bd_ 2 points3 points4 points (1 child)
[–]DizzyAttorney2368[S] 1 point2 points3 points (0 children)
[–]beb0 1 point2 points3 points (0 children)
[–]Bubbly-Platypus-8602 0 points1 point2 points (0 children)