Skip to content
0:00 / 0:00

#zerocopy#fuchsia#zero-copy

Move fast and don't break things: High-performance networking in Rust — Joshua Liebow-Feeser

Rust Belt Rust Conference

4.8K subscribers • 4 videos on Hallway

YouTube
  • Recommended by 2 people: 2 in engineering communities.
  • A classic. People kept recommending it from 2020 to 2023.
  • Presented by Joshua Liebow-Feeser, Security Engineer at Google

Advanced. Deep dive for people who know the field.

18K views7 years ago2 recommendations

Systems programmingProgramming languagesRustNetworking and protocolsPerformance and optimization

Joshua Liebow-Feeser discusses building a high-performance, zero-copy networking stack in Rust for the Fuchsia operating system.

What makes Rust different is not that you can write high-performance, bare-metal code. What makes Rust different is that when you write that code, it is clean and easy to use, and you are confident in its correctness. In this talk, we discuss a new, high-performance networking stack being written in pure Rust. We discuss how Rust has allowed us to squeeze every last drop of performance out of the stack without sacrificing usability, productivity, or the confidence that our code is bug-free. We focus specifically on packet parsing and serialization, which we accomplish with zero copying, zero heap allocation, and very little unsafe code. --- Josh is a security engineer at Google working on Fuchsia, where he gets to program in Rust all day long. He also programs in Rust as a hobby, which makes him very well-rounded.

Why it's here

2 people recommend this

What people say. Highly recommended for its explanation of safe zero-copy parsing techniques and the design of the zerocopy crate.

Moments people linked to

u/jswrennin r/rust • Recommends

On “Rust: The joy of safe zero-copy parsers”

A friend of mine designed Fuchsia's zero-copy networking parsers, and gave a talk about the approach here: link to this video If you're interested in this sort of thing, we're working on bringing as much of it to `crates.io` as possible. Check out `zerocopy`, which provides a dogmatically sound* abstraction over reinterpreting bytes as data (and visa versa). Next, we will be working on getting the higher-level abstractions for structuring these parsers up on crates.io, too. These are already open source (within the Fuchsia codebase), but there's lots of work to do to have them ready for general use. If all goes well, Rust users are soon going to have a mature, safe, and efficient suite of networking…

u/jswrennin r/rust • Recommends

On “Rust Lang team design meeting update from Inside Rust Blog”

…. Many networking protocols describe packets with layouts that basically match how C would lay out a struct. For these packets, the fastest way to 'parse' them is to simply cast your pointer to the byte buffer into a pointer to a struct representing that packet. This talk by /u/joshlf_ describes using this technique in Fuchsia's networking stack: link to this video ## Why is the status quo bad? ^I ^can't ^remember ^if ^there ^was ^ever ^an ^RFC ^settling ^the ^bit ^validity ^pattern ^of ^bool, ^but ^it ^makes ^for ^a ^simple ^example. ^so ^I'm ^sticking ^with ^it. ^If ^there ^wasn't, ^just ^imagine ^that ^`bool` ^is ^defined ^as ^"#repr(u8) ^enum ^bool ^{ ^false ^= ^0, ^true ^= ^1 ^}". Pointer cas…

u/lijmlaagin r/rust • Recommends

On “I don’t understand zero copy”

You are a excellent talker. I hope you got it to do more than correctly reply to 'ping'? There is an exercise left for the audience where we are encouraged to reason about why `FromBytes` derived for enums have the restricting requirements that they must be C-like and have 2^bits variants. `FromBytes` for a given type T, any sequence of bytes with length `size_of::<T>()` is a valid T. So you restrict to discriminants only, not bother with encapsulated types we know in Rust and if you also require all values to be valid, then yes, those are your requirement. I guess it needs to be this strict because `BromBytes` is just a marker and has no moving parts to discern valid and invalid varian…
1View on Reddit