4 ms·
I think the issue is that there's a stigma around UDP, largely borne from not using it effectively. I'm not sure this is the right way to address the stigma tho
by kbolino 2y ago
I think the issue is that there's a stigma around UDP, largely borne from not using it effectively. I'm not sure this is the right way to address the stigma though.
Ultimately, TCP vs UDP per se is rarely the right question to ask. But that is often the only configuration knob available, or at least the only way to get away from TCP-based protocols and their overhead is to switch over to raw UDP as though it were an application protocol unto itself.
Such naive use of UDP contributes to the stigma. If you send a piece of data only once, there's a nontrivial chance it won't get to its destination. If you never do any verification that the other side is available, misconfiguration or infrastructure changes can lead to all your packets going to ground and the sender being completely unaware. I've seen this happen many times and of course the only solution (considered or even available in a pinch) is to ditch UDP and use TCP because at least the latter "works". You can say "well it's UDP, what did you expect?" but unfortunately while that may have been meant to spur some deeper thought, it often just leads to the person who hears it writing off UDP entirely.
Robust protocol design takes time and effort regardless of transport protocol chosen, but a lot of developers give it short shrift. Lacking care or deeper understanding, they blame UDP and eschew its use even when somebody comes along who does know how to use it effectively.
- IshKebab 2y agoWhat kind of stigma is there around UDP? I have never heard of this and I have never seen anyone use UDP expecting it to be reliable. I think the biggest mistake people make with UDP protocols is allowing traffic amplification attacks.
- kbolino 2y agoI don't think anyone expects it to be reliable, they just don't plan for packet loss properly.
- lazide 2y agoPlan? Or implement?
- kbolino 2y agoBoth? I've seen UDP and TCP treated as interchangeable. They're not, even though in many cases the APIs involved make it seem that way. Choosing datagrams and unreliable transport vs. streams and reliable transport affects the rest of the protocol design and behavior, whether the designer wants it to or not and whether the implementer considered the consequences or not.