TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Timeliness without datagrams using QUIC

224 点作者 wofo11 个月前

28 条评论

tliltocatl11 个月前
Most of TCP woes comes from high-bandwith latency-sensitive stuff like HFT and video, but TCP isn&#x27;t particularly good for low-bandwidth high-latency networks either (e. g. NB-IoT with 10 seconds worst case RTT):<p>- TCP will waste roundtrips on handshakes. And then some extra on MTU discovery.<p>- TCP will keep trying to transmit data even if it&#x27;s no longer useful (same issue as with real-time multimedia).<p>- If you move into a location with worse coverage, your latency increases, but TCP will assume packet loss due to congestion and reduce bandwidth. And in general, loss-based congestion control just doesn&#x27;t work at this point.<p>- Load balancers and middleboxes (and HTTP servers, but that&#x27;s another story) may disconnect you randomly because hey, you haven&#x27;t responded for four seconds, you are probably no longer there anyway, right?<p>- You can&#x27;t interpret the data you&#x27;ve got until you have all of it - because TCP will split packets with no regards to data structure. Which is twice as sad when all of your data would actually fit in 1200 bytes.
评论 #40767063 未加载
评论 #40773017 未加载
评论 #40771860 未加载
评论 #40767197 未加载
promiseofbeans11 个月前
We use straight UDP datagrams for streaming high-frequency sensor data. One of our R&amp;D people built a new system that uses quic and solves most of our problems with out-of-order delivery. We still use datagrams over UDP for everything because we have to support some 3rd party sensors out of the box without adapters, and UDP is all they can do.
评论 #40766467 未加载
评论 #40766529 未加载
评论 #40770051 未加载
评论 #40772755 未加载
评论 #40771343 未加载
adunk11 个月前
This may seem like a minor nit, but I think there is a problem with using the term &quot;unreliable&quot; to describe UDP. The more commonly used term, and IMHO better term, is &quot;best-effort&quot; [1]. UDP makes its best effort to deliver the datagrams, but the datagrams may be dropped anyway. But it does not make UDP inherently unreliable.<p>[1] <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Best-effort_delivery" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Best-effort_delivery</a>
评论 #40766562 未加载
评论 #40766717 未加载
评论 #40766746 未加载
评论 #40779513 未加载
评论 #40766800 未加载
评论 #40767092 未加载
评论 #40767301 未加载
评论 #40768024 未加载
PhilipRoman11 个月前
IMO stream abstractions make it too convenient to write fragile programs which are slow to recover from disconnections (if they do at all) and generally place too many restrictions on the transport layer. Congestion control is definitely needed but everything else seems questionable.<p>In a datagram-first world we would have no issue bonding any number of data links with very high efficiency or seamlessly roaming across network boundaries without dropping connections. Many types of applications can handle out-of-order frames with zero overhead and would work much faster if written for the UDP model.
评论 #40767977 未加载
评论 #40767080 未加载
评论 #40766539 未加载
nyc_pizzadev11 个月前
One thing not mentioned often is that a lot of networks will drop UDP packets first when encountering congestion. The thinking is that those packets will not re-transmit, so it’s an effective means to shed excess traffic. Given we now have protocols that aggressively re-transmit on UDP, I wonder how that has changed things. I do seem to remember QUIC having re-transmit issues (vs HTTP1&#x2F;2) years ago because of this.
dang11 个月前
I&#x27;ve attempted to replace the clickbait title* using terms from the article itself, but if someone can suggest a more representative phrase from the article, we can change it again.<p>(* in keeping with the HN&#x27;s title guideline: &quot;<i>Please use the original title, unless it is misleading or linkbait</i>&quot; - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;newsguidelines.html">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;newsguidelines.html</a>)
TuringNYC11 个月前
&gt;&gt; The common wisdom is: &gt;&gt; &gt;&gt; use TCP if you want reliable delivery &gt;&gt; &gt;&gt; use UDP if you want unreliable delivery &gt;&gt; What the *(&amp; does that mean? Who wants unreliability?<p>I dont agree with the premise of this article, UDP isnt for unreliability, it provides a tradeoff which trades speed and efficiency and provides best-efforts instead of guarantees.<p>It makes sense depending on your application. For example, if I have a real-time multi-player video game, and things fall behind, the items which fell behind no longer matter because the state of the game changed. Same thing for a high-speed trading application -- I only care about the most recent market data in some circumstances, not what happened 100ms ago.
评论 #40767122 未加载
评论 #40767114 未加载
blueflow11 个月前
What should be based on datagrams:<p>- Local discovery (DHCP, slaac, UPnP, mDNS, tinc, bittorrent)<p>- Broadcasts (Local network streaming)<p>- Package encapsulation (wireguard, IPSec, OpenVPN, vlan)
评论 #40766743 未加载
评论 #40766264 未加载
评论 #40766396 未加载
评论 #40766484 未加载
mjw_byrne11 个月前
Silly clickbait title, which the author even admits up front.<p>UDP and TCP have different behaviour and different tradeoffs, you have to understand them before choosing one for your use case. That&#x27;s basically it. No need for &quot;Never do X&quot; gatekeeping.
评论 #40766696 未加载
评论 #40767694 未加载
cenriqueortiz11 个月前
Nahhh. While most of the applications&#x2F;cases will be using session-based connections, there are uses for using datagrams directly — don’t be afraid. Yes, you will have to take care of many more details yourself. And as a side line, it is a great way of learning the low level aspects of networking.
评论 #40767011 未加载
ggm11 个月前
Quic is implemented over UDP. It&#x27;s literally running over datagrams.
评论 #40766356 未加载
thomashabets211 个月前
&gt; The bytes within each stream are ordered, reliable, and can be any size; it’s nice and convenient. Each stream could be a video frame […] But you can tell the QUIC stack to focus on delivering important streams first. The low priority streams will be starved, and can be closed to avoid wasting bandwidth.<p>Is the author saying that with QUIC I can send a &quot;score update&quot; for my game (periodic update) on a short-lived stream, and prevent retransmissions? I&#x27;ll send an <i>updated</i> &quot;score update&quot; in a few seconds, so if the first one got lost, then I don&#x27;t want it to waste bandwidth retransmitting. Especially I don&#x27;t want it retransmitted <i>after</i> I&#x27;ve sent a newer update.
评论 #40766642 未加载
forrestthewoods11 个月前
It mentions that the video game industry uses UDP but then fails to further address that use case. So, should competitive shooter video games switch to QUIC? Is that even supported across all the various gaming platforms?
评论 #40766269 未加载
评论 #40766473 未加载
评论 #40766321 未加载
dicroce11 个月前
I wonder if this guy thinks video GOPs should all be hundreds of frames long because P frames are so much smaller than I frames and since in his world we NEVER use an unreliable network you might as well.
gary_011 个月前
I wonder if the DiffServ[0] bits in IPv6 could be another way to prevent bufferbloat from affecting real-time datagrams? Or are they like IPv4&#x27;s ToS[1] bits, which I think were never implemented widely (or properly) enough for any software to bother with?<p>[0] <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Differentiated_services" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Differentiated_services</a><p>[1] <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Type_of_service" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Type_of_service</a>
评论 #40772566 未加载
ozim11 个月前
Great in depth article from what seems really a person who knows that stuff.
bitcharmer11 个月前
This is a narrow way of looking at UDP applications. The whole HFT, low-latency fintech world is built on top of datagrams. Using TCP would be pure the worst choice possible.
评论 #40769761 未加载
kierank11 个月前
Imagine Ethernet was designed like this and you had to implement mandatory congestion control and other cruft. The layer of the stack that has knowledge of the content should be implementing the congestion control.
评论 #40774204 未加载
asdefghyk11 个月前
Maybe ... never use on a congested network.<p>or Never use on a network where congestion is above a certain level<p>or Never us on a network where this parameter is above a certain level - like network latency<p>or only use on a LAN not a WAN ....?
评论 #40766383 未加载
评论 #40766320 未加载
dragonfax11 个月前
I&#x27;ve seen UDP used for great effect in video streaming. Especially timely video streaming such as cloud gaming. When waiting a late packet is no longer useful.
评论 #40771359 未加载
Anon_Admirer11 个月前
Hope this one gets captured by quackernews - can’t wait to see its description.
nabla911 个月前
The choice is not UDP vs TCP.<p>UDP adds minimum over raw sockets so that you don&#x27;t need root privileges. Other protocols are build on top of UDP.<p>It&#x27;s better to use existing not-TCP protocols instead of UDP when the need arises instead of making your own. Especially for streaming.
ta124311 个月前
Used high numbers of UDP packets over intercontinental internet links for mission critical applications for 15 years. 20mbit of UDP carrying RTP. Loss on a given flow is quite rare, and the application helps (via duplication, or retransmits)<p>As time has progressed increased from nothing to fec to dual-streaming and offset-streaming to RIST and SRT depending on the criticality.<p>On the other hand I&#x27;ve seen people try to use TCP (with rtmp) and fail miserably. Never* use TCP.<p>Or you know, use the right tool for the right job.
JackSlateur11 个月前
Network is nothing but datagrams.
20k11 个月前
I feel like this article misses why people avoid TCP like the plague, and why people use UDP for many applications<p>1. Routers do all kinds of terrible things with TCP, causing high latency, and poor performance. Routers do not do this to nearly the same extent with UDP<p>2. Operating systems have a tendency to buffer for high lengths of time, resulting in very poor performance due to high latency. TCP is often seriously unusable for deployment on a random clients default setup. Getting caught out by Nagle is a classic mistake, its one of the first things to look for in a project suffering from tcp issues<p>3. TCP is stream based, which I don&#x27;t think has ever been what I want. You have to reimplement your own protocol on top of TCP anyway to introduce message frames<p>4. The model of network failures that TCP works well for is a bit naive, network failures tend to cluster together making the reliability guarantees not that useful a lot of the time. Failures don&#x27;t tend to be statistically independent, and your connection will drop requiring you to start again anyway<p>5. TCP&#x27;s backoff model on packet failures is both incredibly aggressive, and mismatched for a flaky physical layer. Even a tiny % of packet loss can make your performance unusable, to the point where the concept of using TCP is completely unworkable<p>Its also worth noting that people use &quot;unreliable&quot; to mean UDP for its promptness guarantees, because reliable = TCP, and unreliable = UDP<p>QUIC and TCP actively don&#x27;t meet the needs of certain applications - its worth examining a use case that&#x27;s kind of glossed over in the article: Videogames<p>I think this article misses the point strongly here by ignoring this kind of use case, because in many domains you have a performance and fault model that are simply not well matched by a protocol like TCP or QUIC. None of the features on the protocol list are things that you especially need or even can implement for videogames (you really want to encrypt player positions?). In a game, your update rate might be 1KB&#x2F;s - absolutely tiny. If more than N packets get dropped - under TCP <i>or</i> UDP (or quic) - because games are a hard realtime system you&#x27;re screwed, and there&#x27;s nothing you can do about it no matter what protocol you&#x27;re using. If you use QUIC, the server will attempt to send the packet again which.... is completely pointless, and now you&#x27;re stuck waiting for potentially a whole queue of packets to send if your network hiccups for a second, with presumably whatever congestion control QUIC implements, so your game lags even more once your network recovers. Ick! Should we have a separate queue for every packet?<p>Videogame networking protocols are built to tolerate the loss of a certain number of packets within a certain timeframe (eg 1 every 200ms), and this system has to be extremely tightly integrated into the game architecture to maintain your hard realtime guarantees. Adding quic is just overhead, because the reliability that QUIC provides, and the reliability that games need, are not the same kind of reliability<p>Congestion in a videogame with low bandwidths is <i>extremely</i> unlikely. The issue is that network protocols have no way to know if a dropped packet is because of congestion, or because of a flaky underlying connection. Videogames assume a priori that you do not have congestion (otherwise your game is unplayable), so all recoverable networking failures are 1 off transient network failures of less than a handful of packets by definition. When you drop a packet in a videogame, the server may <i>increase</i> its update rate to catch you up via time dilation, rather than in a protocol like TCP&#x2F;QUIC which will reduce its update rate. A well designed game built on UDP tolerates a slightly flakey connection. If you use TCP or QUIC, you&#x27;ll run into problems. QUIC isn&#x27;t terrible, but its not good for this kind of application, and we shouldn&#x27;t pretend its fine<p>For more information about a good game networking system, see this video: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=odSBJ49rzDo" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=odSBJ49rzDo</a>, and it goes over pretty in detail why you shouldn&#x27;t use something like QUIC
评论 #40768056 未加载
评论 #40778669 未加载
评论 #40773245 未加载
dale_glass11 个月前
IMO one of the worst mistakes made in IP development was not having made a standard protocol for the one thing that pretty much everyone seems to want:<p>A reliable, unlimited-length, message-based protocol.<p>With TCP there&#x27;s a million users that throw out the stream aspect and implement messages on top of it. And with UDP people implement reliability and the ability to transmit &gt;1 MTU.<p>So much time wasted reinventing the wheel.
评论 #40767103 未加载
评论 #40766703 未加载
评论 #40766804 未加载
评论 #40766826 未加载
评论 #40766739 未加载
评论 #40766751 未加载
评论 #40767256 未加载
评论 #40767368 未加载
评论 #40773282 未加载
评论 #40766698 未加载
评论 #40767716 未加载
评论 #40766939 未加载
评论 #40767707 未加载
karmakaze11 个月前
TL;DR - use QUIC <i>(should have just looked at the domain name)</i>
FpUser11 个月前
I use UDP for my desktop game like software with clients all over the world to propagate anonymized state. It needs no encryption as the transmitted data has zero value to any third party. It needs no reliability since dropped packets would be handled by predictive filter with practical reliability that is way more than needed.<p>So why the F.. would I bother with anything else?
评论 #40767190 未加载
评论 #40766442 未加载