498 points · by payne · 8y ago · 187 comments
To meet the data rate, we were sending datagrams that were 64KB in size (there was no system call at this time to send multiple datagrams in one go).
The datagrams were being fragmented into MTU sized fragments by the OS and reassembled on the remote end. However, with the data rate and the fact that there is only a 16 bit IP ID in the IP header, the fragments would often get missassembled on the receiving end and passed up to the UDP layer. Usually, the UDP checksum would detect the problem and throw the datagram out. However, since the checksum is weak and we were sending a lot of data, it would sometimes pass the datagram up to the application layer.
So, we would get corrupted data on the receiving end once in a while. It took quite a bit of time to figure this out, of course.
The solution was to implement dynamic MTU discovery along with the protocol so we could avoid the fragmentation.
The custom solution is still being used 20 years later!
Even if your packet ids are assigned poorly, on the receiving side Linux has a heuristic that takes in to account reordering to minimize the chance of reassembling bad packets. Basically if packets with the same frag id are too far apart then the whole datagram is chucked:
So, what's the point of ditching all that and reinventing HTTP over a thin wrapper (UDP) over (lossy) IP? Has there been a huge theoretical breakthrough which simply can't be applied to TCP?
In general, it is true that TCP is highly optimised, but it is only optimised for one use case: a long lived single flow over a low error rate connection to a single destination. That was the predominate type of connection back in the FTP and early web days. But is hasn't been that way for a while now. HTTP is short lived, video goes to multi destinations, HTTP/2 and multi media in general has multiple flows. Wireless only appears to be low error rate because the physical layer had to cover up it's shortcomings otherwise TCP's performance became abysmal.
TCP hasn't remained king of the mountain because its fantastic protocol that can't be improved. On the contrary - looks to be the simplest thing it's inventors could come up with. It even lacked round trip time measurement - which is something I suspect that would have killed it if an extension hadn't saved it. TCP has remained king of the mountain purely because it appears to be near impossible to replace. Now that Google has done it, I expect we will see a lot more experimentation in this area.
If you want to put security on/into IP, you suddenly need the whole key management thing, and if you want it to be automatic, you need to somehow cobble together the assignment, provisioning, allocation, publication, revocation of keys with IP addresses (or hostnames, domain names, and you just put DNS into IP).
Eventually it means either you need manual key management (thus IPsec becames a hard to manage old rusty and poorly supported concept from an old era) or you just descended into the recursive pit of all hells of circular dependencies. Sure, it can be done, we can put keys into DNS, and we can use that, but then we're back to QUIC or DTLS basically.
The thing is, how you set up (mutual) authentication is very much an application level thing. Do you want certs, an SSH key, passwords, hardware tokens, SIM based authentication, or something else? These aren't things the OS can decide, and they aren't so simple we could tell the OS what we want with a few flags.
It then seems that optimized protocols like QUIC could benefit from disabling this lower level error correction.
Is this at all possible? Do the wireless physical protocols allow for such a thing? Do the operating systems offer it as a flag?
I did a quick read on the subject and main argument for QUIC seems to be zero roundtrip session establishment - using TLS session resumption. SCTP uses a 4-way handshake.
Also found this comment from 2015: https://news.ycombinator.com/item?id=9639824, and this ietf draft: https://tools.ietf.org/html/draft-joseph-quic-comparison-qui...
Since HTTP is the use case here, it is possible to create a protocol that is optimized for it, whereas TCP cannot be optimized specifically for HTTP.
Source: I've implemented a reliable, stream oriented protocol over UDP which has been in use for many years.
ref: https://docs.microsoft.com/en-us/windows/desktop/WinSock/tcp... https://linux.die.net/man/7/raw
You can try and diddle with chunk size and message prioritization in your application to reduce HOL blocking of low latency messages behind chunks of high throughput data, but your OS will buffer everything in one big queue anyway (because TCP is a single stream and flow control applies to that entire stream as a whole).
How do you fix that? Well you can reduce socket buffer sizes on your TCP connection, and that will fix latency... but small buffer sizes mean your total throughput is limited by round trip time (because of the way the TCP receive windows and positive acknowledgment work). If you're working over a LAN, things will be fine, but over the Internet you're hosed.
Of course, the solution really is to have separate long-lived TCP connections for different kinds of flows, so you can set buffer sizes appropriately... but that's impossible for your browser (which is responsible for opening connections). It has no way to know whether a GET request triggered by an <img> tag is going to yield a 100 byte response or a 100MB response.
h2 failed because it's mux everything into 1 single tcp connection, and it only takes 1 failed tcp to block everything in line.
h2 really need to do demux. But h2 actually can technically do M:N connections, but browsers do only 1:N.
Also h2 is a failed promise. Most sites deliver web assets and page and js in different host, also ws/wss in a different host. Thus renders h2 advantages complete useless.
Just curious, what do you mean? Quickly Googling this, it looks like 1/3 websites use HTTP2 today, which is darn good for a relatively new protocol.
Sure, there's some other stuff in there, server sent goaway in particular is a great way to indicate the server intentionally closed the connection, but the primary objective is to get around congestion control -- which could have been better solved by just adjusting congestion control to pool by destination IP in clients Google could control (at least Android) and on servers Google could control (at least their servers)
But... which use cases of HTTP need us timers? It's not like gmail or other bloated web apps will load faster on my phone because of QUIC?
Anyway, that's mobile. In the datacenter all of these timers are way too high, by several orders of magnitude. 1ms is an outrageously long RTO in a datacenter fabric but 200ms is the minimum RTO allowed by the TCP RFCs.
Google(tm) HTTP/2.0 was unasked for, tried to reinvent TCP, found buggy and fundamentally broken after less than a year.
So now Google is pushing HTTP/3 to solve the bugs they made with HTTP/2, by reinventing even more of the IP-stack. What could possibly go wrong?
Can someone please tell Google that protocols are not Chrome-releases?
They need to work and stay working and supported for decades. You can’t ship a new revision every 6 month.
Edit: Correct HTTP/1.1 longdetivity.
Right?
I feel like you're conflating two very different things into "head of line blockings".
Head of line blocking in HTTP/1.1 was that HTTP/1.1 cannot transmit responses out of order, so a slow response "blocks" any responses behind it. HTTP/2 solves this by being multiplexed (effectively, it tags the requests & responses s.t. you can match out of order responses back to the appropriate request). This isn't necessarily that the network can't handle it; a request that might be easy for the server to handle (e.g., a static asset) can get caught behind one that is not (e.g., one that entails a slow DB query).
The other "head of line blocking" that I think you're getting at is just network loss or saturation. If the network can't deliver packets, I don't see how having 6 connections is going to help: you're going to have to wait for six different state machines to determine that the link is saturated, back off, etc.
Regardless, my understanding is that QUIC / HTTP/3 is still a multiplexed protocol; I would think it would behave very similarly. Nonetheless, Google's announcement of it backs up your claim[1]:
> Like HTTP/2, QUIC multiplexes multiple streams into one connection, so that a connection can serve several HTTP requests simultaneously. But HTTP/2 uses TCP as its transport, so all of its streams can be blocked when a single TCP packet is lost—a problem called head-of-line blocking. QUIC is different: Loss of a UDP packet within a QUIC connection only affects the streams contained within that packet. In other words, QUIC won’t let a problem with one request slow the others down, even on an unreliable connection.
But what here makes QUIC think that those other requests have any hope where the first didn't? To me, this approach seems like you're just spamming the link with packets and hoping for the best; those packets could just end up dropped like the other ones were. What makes QUIC think this approach will have any benefit? (It could, perhaps, if the link is just going to drop one packet and we can get right back to sending. I'm not sure that still conveys any benefit over TCP. Not saying QUIC is wrong, just that I don't see a decent reason to buy into it.)
(This whole thing makes me think there are two problems here: there's the actual network connection between two endpoints, and what its state is, how lossy it is, its PMTU, how much data we should allow in-flight between those two endpoints, etc. But then there is also logical streams, such as HTTP request/response pairs. It almost seems like to me any data about the link, such as PMTU/lossiness/window, should be shared between all TCP connections, and the individual logical streams should be otherwise cheap/easy to make.)
[1]: https://cloudplatform.googleblog.com/2018/06/Introducing-QUI...
You don't really want to drop data for streaming video either, sure, in some cases it might not make a huge difference, but if you drop i-frames, you are going to have quality issues.
I'm not sure if HTTP/3 will have a way to do selective re-sending, but that is how very versatile lossy video streams do it. I-frames can get re-sent while normal frames can be lost.
Bundling HTTP and QUIC into one protocol is a bad idea because (1) it increases complexity, (2) it creates application-specific QUIC implementations, which will become a problem later if QUIC is adopted by anything else, not to mention the security holes/feature gaps in different implementations, etc, (3) it reduces the likelihood of the operating system supporting QUIC as a first class L4(OSI) protocol, which will further doom any network application that uses any method of IPC other than an HTTP request.
Honestly, the way modern network applications operate is embarrassing. People in the future are going to look back and wonder what was wrong with us.
/s
1. An internet standard 2. Already has kernel support 3. Was not developed by one company
And, most importantly,
4. IT'S ALREADY IMPLEMENTED IN EVERY MAJOR BROWSER!
This is not something very easy to fix - not as easy as fixing Cisco devices that hijack 1.1.1.1, or upgrade enterprise-grade MITM firewalls that don't know and block TLS 1.3.
It's standard only on paper. There is only one significant user space implementation (usrsctp). It's used both by Chrome and Firefox. I don't think it has much use outside of that. And, I don't think other browsers implement data channels (which require SCTP).
Browser implementations will probably never have to interact with kernel implementations (which are not really used outside of telecoms). There is really no reason to make them talk the same protocol. It's likely better to use two different protocols tuned to those specific uses:
https://tools.ietf.org/html/draft-joseph-quic-comparison-qui...
They will probably replace SCTP with QUIC also in WebRTC:
I know little about SCPT. Why is it preferable?
This looks to me like a strict superset of what QUIC is intended to solve. And it is already supported in all major operating systems.
Google is not interested in what is implemented in every major browser. Google is interested in making sure that Chrome is the only browser of any significance on the internet and it behaves in a way that Google wants it to behave ( such as forcefully signing into Google services ).
That's why we got HTTP/2 ( which seems to be viewed as a flop at Google ) which is why we are getting HTTP/3.
Follow. The. Money.
But google is big enough to push through that problem, IMHO, as long as browsers fail back to HTTP/2 or HTTP/1.1, the widespread acceptance of SCTP would be a boon to e.g. VoIP and game developers. But alas it's too late. QUIC has been in development for six years now.
So what ? We standardize on a hack because Deep Pocket ?
Not even mentioning competitive advantage for big cloud companies ...
Not really. There are hundreds of millions of home routers deployed that all do NAT. And they all don't support NAT for SCTP. And many do NAT with hardware support, so it's probably not even fixable with a firmware upgrade, which isn't even an option for a ton of unsupported devices anyway.
So, I think encapsulating in UDP is the only realistic option if you want to gain any adoption any time soon.
Also, SCTP has the same problem that TCP has in that the network can look inside the protocol, and thus you would get protocol ossification. While Google does this for selfish reasons, I think it is a really good idea to establish a protocol that is completely opaque to telcos and should ultimately benefit the public. Telcos really don't want to be dumb pipes, and they tend to abuse any power they get, as they have demonstrated time and time again, and the only way to force this issue is by simply making it impossible for them to see or manipulate anything at all. So, while we may have to live with the UDP encapsulation forever, and as stupid as that is, this at least ensures that anyone in the future can trivially invent and deploy new protocols, as it is trivial to masquerade anything at all as QUIC. The adoption of QUIC for the web has the potential to get all ISPs to fix things so that QUIC actually works reasonably reliably over their network. And the fact that as far as the network is concerned it's just UDP packets filled with random data ensures that as long as your new protocol is UDP packets filled with random data, that will work as well, even if you use completely different mechanisms for framing or flow control or multiplexing or whatever.
But why bother when you can hack a wrapper around UDP and pretend you're long term planning for the "greater good" ?
I worry that everyone will have an incentive to "cheat" at congestion control, leading to a tragedy-of-the-commons situation of ever-more-aggressive flows, followed by eventual congestion collapse.
This effect didn't happen with in the TCP world, since most applications don't run with enough privileges to speak TCP without the kernel's involvement. But now that we're moving to a model in which applications do their own congestion control, an arms race seems inevitable.
Also, couldn't the OS still throttle back greedy applications? No reason it couldn't detect the heavy stream of UDP traffic.
In the past Bittorrent and the creation of the µTP prooved ( http://blog.bittorrent.com/2009/11/13/testing-%C2%B5tp-is-%C... ) that unmanaged protocol abuse in userspace can lead to big degradation in QOS yes. Mainly due to "unfair" congestion policy between protocols.
I suspect that's more down to NAT than anything else
The OS can throttle sends on a single machine, but it can't arbitrate across machines or do anything about incoming flows.
Isn't that the case with TCP's congestion control as well? If the server's kernel isn't backing off properly, how can the client's TCP stack mitigate that?
Or will HTTP/1 and 2 slowly decline over time?
Genuine question, not snark.
Remember that UDP itself is stateless. So you either need some explicit port mapping via UPnP (which seems like a nightmare because HTTP connections are so common), or some really smart router that understands QUIC.
QUIC is basically rebuilding the stateful connection abilities of TCP on top of UDP with optimizations.
Multiplexed streams with packets that can arrive out of order, removing the head of line blocking issue with TCP. There is also forward error-correction to reconstruct lost packets instead of retransmitting. Better packet sizing and congestion algorithms to reduce round-trips. There are also updates to include all the TLS 1.3 stuff for 0-RTT setup.
All of this reduces latency and makes connections more reliable, especially with changing networks on mobile devices. Not many downsides other than that TCP is far more open and optimized than UDP so it may take a while to effectively get this protocol out there.
In particular QUIC contains everything necessary to continue connections after the client's IP address (any one side really, but the other side has to find it) changes, which is helpful when devices change between networks without needing a Mobile IP-style bouncer.
Obviously that doesn't solve any immediate problems, in that I'm sure it would take a decade to get something like that in widespread use. But if the theory is that TCP isn't so great given what we know now, I'm wondering if it's worth making those capabilities available to other protocols.
> HTTP/3 (originally named QUIC) is an experimental transport layer[1] network protocol designed by Jim Roskind at Google,[2] initially implemented in 2012,[3] and announced publicly in 2013 as experimentation broadened
and then
> In June 2015, an Internet Draft of a specification for QUIC was submitted to the IETF for standardization
Unless you count 'developed independently by Google and then three years later submitted to IETF for standardization' as 'developed from scratch by an IETF working group', I fail to see how your assertion is backed by actual events.
For the record, SCTP has been standardized since 2000, and it was actually developed by an IETF working group.
Sorry, I would find it myself but I'm on mobile right now...
Discussion from four years ago: https://news.ycombinator.com/item?id=8465956.
Way back this was IPX/SPX vs IP/(TCP|UDP). We know who won that and what happened to the loser.
There is another aspect to this: agnostic network and 'good enough' conceptions have been historically adopted by engineering organizations to remove vendor disposition from the end user landscape and protect the end user. On this forum a lot of these historical protections are seen as passe or unimportant for reasons best not scrutinized too closely.
IMO, the idea embodied in encapsulation of application protocol traffic in stateless transport to avoid a vendors technical issues with existing application stream orientation|transport in the non-vendor real world is one of the ugliest ideas I've yet encountered.
There are a lot of good ideas floating around in the comments here that avoid vendor lock in for applications stream based transport that already exist.
So we are to believe that the people who thought that multiplexing a single TCP connection over mobile was a good idea, that moving lockstock and barrel to UDP will solve our problems?
Look, its very simple: HTTP is now a file server protocol with a chatty control channel smashed in. However instead of optimising for that we have this.
It basically seems like a massive ego trip: "we can't admit we were wrong about the multiplexing thing, lets just bash out a reliable UDP protocol"
Look, the vast majority of file transfer protocols are TCP for a reason. Loosing chunks of files is annoying, and making a custom protocol over UDP that is both fast start reliable and fast, is actually quite difficult.
Yes, UDP has the advantage that you don't have a connection, and you can just fire stuff at the destination port and it'll magically arrive. however, anyone can do that. How does HTTP3 handle noise? how does it handle spoofing?
Basically, H2 was a regression because it was designed by people who didn't appear to understand real world networks, this seems like a doubling down.
I have evaluated QUIC, as reliable stream protocols on UDP are something I have a professional interest in.
> QUIC is the next iteration of TCP
Its not designed for that.
> That it lives on top of UDP (& might ship that way) is an implementation detail due to the realities of how the Internet is built
no, its fundamental. You can't just swap out TCP with UDP and have done with it. If we ignore the Datagram vs stream aspect, we are left with implementing our own flow control, packet loss and authentication.
Which is where my comment comes in, with a TCP socket, if someone tries to inject spoofed packets, (assuming we in a non-LAN environment) those packets will be rejected long before they reach us. In UDP no such guarantees exist.
Thats not considering flow control, which is a whole 'nother issue. Its always a trade-off between efficiency, speed and reliability.
I would suggest an evaluation in which you completely omitted to notice the central feature of the protocol doesn't reflect well on your abilities, regardless of whether you claim it's a "professional interest".
Yes, yes it is. I did 20% on Quic, I've talked with the engineers on it, I've read a lot of the paper, I've written some code. It's 100% intended to replace TCP as much as SCTP & other next-gen stream-oriented protocols are. It's written on top of UDP because they're dealing with the realities of public routing on the internet.
> no, its fundamental. You can't just swap out TCP with UDP and have done with it. If we ignore the Datagram vs stream aspect, we are left with implementing our own flow control, packet loss and authentication.
This again leads me to question how much you've actually researched Quic. It does all that & more. Now it is easier to write a Quic client in user-space that misbehaves for flow control & distribute that (TCP would typically require root access). However, that's the reality of the Internet - middleboxes have ossified the ability to add new protocols. It's why SCTP & the like are non-starters even though IETF has tried to get them to work for so long.
> Which is where my comment comes in, with a TCP socket, if someone tries to inject spoofed packets, (assuming we in a non-LAN environment) those packets will be rejected long before they reach us. In UDP no such guarantees exist.
Are spoofed packets validated at every hop? It would seem like memory & CPU load at backbones would be insane to keep track of all the connections flowing across it. I'm also curious how that would be possible because a backend route switch (i.e. new BGP route) would cause all middleboxes to drop the connection. I'm not sure even ISPs try to reject TCP connections early.
As for the "protection" you lose (if there is any), you gain by your ability to hop physical networks without losing the connection (i.e. WiFi & cellular). This means there's all sorts of cool things you can do that simply weren't possible before; use both wifi & cellular at the same time to download the same file, seamless handoff of a video chat without requiring any ISP support, seamless detection & handoff of a failing internet route to a fallback connection (i.e. walking in the parking lot without having to manually switch off WiFi).
The connection itself does have a connection ID in the public header in the version negotiation packet which is then mirrored in the encrypted packet header to protect against spoofing. However, the connection ID may be omitted from the public header in future packets.
Anyway, I recommend reading the IETF docs on QUIC [1][2], if you have an open mind. If you just have the mentality of "UDP bad", then probably you will be wasting your own time reading it. There's lots of really smart networking experts who work on & design QUIC & lots of smart people in IETF looking over & providing feedback/criticism. I think it's safe to assume they've covered any obvious problems concerns.
[1] https://tools.ietf.org/html/draft-ietf-quic-transport-08#pag... [2] https://tools.ietf.org/id/draft-ietf-quic-manageability-01.h...
1. Connection management 1.1. Initial handshake allows arbitrary layer above initial handshake in same packet as body 1.2. Subsequent packets have connection identifier.
2. Encryption. The SSL bits.
3. Multiplexing and Congestion control.
So in essence the trick of QUIC is not collapsing layers, but splitting TCP into connection management and congestion control and moving SSL in the middle.
So why wasn't this proposed? I hope not because people are too "practical" to care about layering and abstraction anymore!
Is there any testing toolkit that will tell me "bzzt! you messed up header X" or any other error I might make?
For example, Snowflake[1] which is WebRTC based, and meek[2] which chunks the stream into a series of HTTP requests/responses for domain fronting. TCP is still used between nodes.
[1] https://trac.torproject.org/projects/tor/wiki/doc/Snowflake
TCP minimum header is 20 bytes.[1] QUIC "short header" (after key negotiation) looks like it can go down to 2 bytes for non-roaming connections with a 1-byte packet number, if the server allows the omit_connection_id, and 10 bytes otherwise.[2] Add the UDP header (8 bytes[3]) and you're at 10-21 bytes. So if you both supply a connection ID and a 4-byte packet number you're just barely at the same transport overhead as TCP; otherwise it's less.
(The QUIC "long header" is longer but that's a fixed cost and shouldn't matter too much for overhead.)
Or am I missing something?
[1]: https://en.wikipedia.org/wiki/Transmission_Control_Protocol#... [2]: https://tools.ietf.org/html/draft-ietf-quic-transport-08#sec... [3]: https://en.wikipedia.org/wiki/User_Datagram_Protocol#Packet_...
Will it? The TCP header is 20 bytes, the UDP header is 8 bytes. And in as far as packets are bigger, will it actually cause more traffic? For example, you have muliplexing of streams over one connection without head of line blocking, while with HTTP over TCP you need multiple TCP connections and thus multiple TLS connections for that, for example. Also, QUIC allows you to change UDP endpoints without the need to establish a new connection. I wouldn't be so sure it needs more bandwidth.
Now, arguably, building directly on IP would be better, but that is unfortunately an option that ISPs and other manufacturers and operators of middleboxes have destroyed, so I think you can't really blame QUIC for that. There really is no realistic way to evolve beyond the limitations of TCP unless you build on UDP. If QUIC succeeds and if we manage to move to IPv6 and get rid of NAT, though, I guess there might be a chance to one day see "QUIC on IP"--as far as the protocol is concerned, it should be trivial to adopt it for direct IP transport.
QUIC is supposed to send fewer packets for the same payload, at least that's what I've heard. I don't follow it closely. Assuming that's true, if you want people to believe that QUIC packets are bigger and that the increased size more than compensates for their reduced number, you'll have to supply arguments. Packet traces for a few typical connections would be good arguments. Assuming it's false, you'll need much the same kind of argument.
(FYI I've written ten RFCs and like to think I've learned the RFC processes by now.)
A deep dive impartial comparison at different usecase/workload would be great.
Also clients don't have to use QUIC.