sozu-proxy / sozu

Sōzu HTTP reverse proxy, configurable at runtime, fast and safe, built in Rust. It is awesome!
https://www.sozu.io/
GNU Affero General Public License v3.0
3.12k stars 194 forks source link

UDP load balancing #654

Open Geal opened 4 years ago

Geal commented 4 years ago

There's an interest in supporting UDP load balancing in so, so here's an issue to explore that topic. There are some protocols relying on UDP that could benefit from load balancing, such as DNS, syslog, MQTT, and more recently, Quic. Unfortunately, UDP has no concept of session or stream like TCP:

There's also no concept of a listen socket like TCP: the UDP socket that receives client traffic will receive all of their packets, they're not separated on different sockets with each their own buffer. On the backend side though, it would be possible to have one socket per "session".

What's apparent, from looking at various protocols (and the discussion at https://github.com/haproxy/haproxy/issues/62 ) is that generic UDP load balancing, where we do not know anything about the higher level protocol, is not very useful, while e could provide a lot of value if we can recognize protocols that are one way, or request-response, or multiplexed, etc.

For that, we would need to support those higher level protocols, ie being able to recognize packet contents and find a field to use for routing (whether from client to backend or the other way).

Examples of routing information:

Geal commented 4 years ago

There's another issue around handling "sessions" across different workers, and across upgrades: there is no guarantee that 2 packets from one client will arrive to the same worker, so session information should be shared between workers (and there's a risk of data races here, where another worker receives the second UDP packet before receiving the session information)