Company
Date Published
Author
Marek Majkowski
Word count
2806
Language
English
Hacker News points
10

Summary

The Cloudflare team has developed a solution to handle graceful restarts of UDP servers without dropping any packets, a challenging problem due to the stateful nature of modern UDP protocols. The solution is called udpgrm, a lightweight daemon that uses Linux's `SO_REUSEPORT` API and eBPF programs to route incoming packets to the correct instance, preserving flow stickiness. The daemon provides a clean API using `setsockopt()` calls, careful socket-stealing logic, powerful and expressive configurable dissectors, and well-thought-out integration with systemd. udpgrm supports three dissector modes: DISSECTOR_FLOW, DISSECTOR_CBPF, and DISSECTOR_NOOP, which can be used to handle different protocols and scenarios. The solution is intended to be easy to use but solves a genuinely hard problem in the Linux Sockets API.