Fast UDP I/O for Firefox in Rust
Table of Contents Motivation Overview The basics Single datagram Batch of datagrams Single large segmented datagram Replacing NSPR in Firefox Platform details Windows MacOS Linux Android Explicit congestion notifications (ECN) Summary Motivation# Around 20% of Firefox’s HTTP traffic today uses HTTP/3, which runs over QUIC, which in turn runs over UDP. This translates to substantial UDP I/O activity. Firefox uses NSPR for most of its network I/O. When it comes to UDP I/O, NSPR only offers a limited set of dated APIs, most relevant here PR_SendTo and PR_RecvFrom, wrappers around POSIX’s sendto and recvfrom. The N in NSPR stands for Netscape, giving you a hint of its age. Operating systems have evolved since. Many offer multi-message APIs like sendmmsg and…