6 ms·
I just recently got my company to switch over to http2 and halved our load time across the board. It might go down as the greatest improvement in customer exper
by tashoecraft 5y ago
I just recently got my company to switch over to http2 and halved our load time across the board. It might go down as the greatest improvement in customer experience for the simplest action I’ll ever do.
- pottertheotter 5y agoWhat caused this? I don’t know much about http
- cogman10 5y agohttp2's biggest advantage is it's multiplexed over a single tcp connection. So if your site has a bunch of resources on it, then http2 will allow your clients to request all their required resources at once without establishing a bunch of TCP connections. Browsers allow for somewhere around 6 simultaneous TCP connections (which means around 6 concurrent requests with http1.1). Http2 allows for http requests at the speed of the clients upload connection (effectively unlimited).
- jart 5y agoHTTP/1.1 can do this. It's called pipelining. But browsers refuse to implement it.
- bigbonch 5y agoWould still be constrained to head-of-line blocking which HTTP/3 aims to solve.
- baybal2 5y agoHTTP/3 will not be adopted because it's a downgrade from HTTP/2 for CDN companies. HTTP/2 has indeed massively benefitted CDNs by providing more effective capacity per buck, but UDP based 3.0/QUIC will singlehandedly destroy it, and bring it to below HTTP 1.1.
- tehbeard 5y agoCould you give an eli5 as to why that's the case? Or are you just throwing out a proclamation?
- celsoazevedo 5y agoMajor CDNs seem to be adopting HTTP/3 just fine: Cloudflare: https://blog.cloudflare.com/http3-the-past-present-and-future/ https://blog.cloudflare.com/http3-the-past-present-and-futur... Akamai: https://developer.akamai.com/blog/2020/04/14/quick-introduction-http3 https://developer.akamai.com/blog/2020/04/14/quick-introduct... Fastly: https://www.fastly.com/blog/why-fastly-loves-quic-http3 https://www.fastly.com/blog/why-fastly-loves-quic-http3 Not to mention Google, which uses it a lot for regular pages and for content (eg: YouTube video). Adoption client-side also seems to be moving quickly too. I looked at the stats for 2 of my sites and HTTP/3 is now at 60-70%, with HTTP/2 having dropped to 25-30% already.
- baybal2 5y agoGood for them, when they have money to spend on servers. Budget CDNs are much less happy.
- celsoazevedo 5y agoThat might be the case, but HTTP/3 is supported by most major CDNs and browsers. It has been adopted already. Also, if this blog post from 2020 is correct, performance per buck isn't that bad with some teaks: https://www.fastly.com/blog/measuring-quic-vs-tcp-computational-efficiency https://www.fastly.com/blog/measuring-quic-vs-tcp-computatio... I assume things have evolved since 2020.
- anticensor 5y agoThe solution to that is QUIC over IP, i.e. removing UDP from the stack.
- tsimionescu 5y agoBrowsers implemented it, but had to drop support because proxies don't support this, so in practice it turned out to be a major source of bugs.
- ghusbands 5y agoIt was also a source of obscure bugs and DoS-level resource usage in servers and (non-browser) clients. Some servers managed to send multiple responses together or deadlocked the connection when the timing of requests or available responses was just right. Some servers would queue up responses in memory and so were prone to excess resource usage. Also, if you had a sent request waiting behind a slow/large response, you had to decide whether or not to send an extra request on a separate connection to get the resource sooner. And when a server closed a connection after sending a response (the spec allows it for multiple reasons), it was hard to know whether it was that the server was just not accepting more requests on that connection or whether a particular request caused it and hence whether any of the waiting request(s) should be re-sent or treated as being in error.
- 1vuio0pswjnm7 5y agoIt isn't multiplexed. You get the responses back in the same order that you request them. I actually prefer this because I use pipelining outside the browser. I do not want to have to re-ordering responses. I have never found the lack of multiplexing to make HTTP/1.1 pipelining any less useful.^1 It is still fast. HTTP/2 and HTTP/3 appear to be designed for a web of advertising, not a web where someone is using non-browser programs to efficiently request multiple files via HTTP from a single IP address. Some browsers implemented it, at least temporarily. However the important point no one mentions is that servers implemented it, permanently. I have been using HTTP/1.1 pipelining continuously since the mid 2000's. I could not even name an httpd that does not implement support for HTTP/1.1 pipellining (no doubt some HN commenter will come up with one, but it is a rare exception to the general rule). 1. I do not need compressed HTTP headers either. I like ASCII headers as they are useful record separators for catenated HTML. I have the forward proxy configured to add useful headers that provide additional information about the connection.
- theelous3 5y agoI don't get this explanation. Over one tcp connection, these "unlimited" requests are interleaved, blocking each other for periods of time. With multiple tcp connections I can have parallelism. It seems like for larger requests, you would suffer performance loss with http2? What am I missing here. Must be something.
- cogman10 5y agoWell, let's start from the bottom. For most computers and systems, there is only a signal network interface (and if not, there's usually just a single route from A to B.) So, when you say "I can have parallelism" you have to realize that even without a multiplexed TCP connection, the operating system is playing the same game. It is interleaving and blocking bits to the NIC even with multiple TCP connections. The parallelism you see with multiple TCP connections comes from the fact that the NIC is not (generally) saturated sending and receiving bits. So with that out of the way, where's the benefits? One is eliminating the TCP slow start [1]. TCP was designed generally with the notion that you'd only ever have 1 connection between 2 computers. As a result, it has baked into the protocol network congestion sensing protocols. More connections == more congestion control == slower requests. It also, however, means that the first request of every connection will be penalized as the connection warms up. A single connection pays that penalty once. Another is the latency problem. In order for a connection to be used, you need to send the data from the client to the server and then receive a response from the server. During that time, your connection is bound up (ignore http pipelining, it never worked well). You cannot add more bits down that connection, you have to wait for the server to process and send back response. If that round trip time takes 200ms, that's 200ms of sitting around doing nothing. During that time, over a 100Mbps connection your client could have sent 2.5MB worth of requests to the server. Because http request are typically very small (usually in the bytes), that's a lot of potential requests. This leads to the servers more than likely being able to saturate the connection which is what you want if you are trying to maximize performance. > It seems like for larger requests, you would suffer performance loss with http2? A little tricky, it depends on what you are measuring. A large request will block other requests going through while it is streaming. In that scenario, you'd still be saturating the network line but the perceived concurrency would be down. So, from a requests/sec standpoint, that could end up being lower. But from a data-throughput standpoint, you'll be better off still than http1 due to the better network congestion handling of a single TCP connection. (The ole latency v throughput problem). This is where we enter HTTP3, which bucks TCP as the primary request carrier for UDP messages instead. HTTP3 allows for much lower connection establishment costs (so making multiple QUIC connections isn't as expensive) but also contains protocol changes for errors which keeps an bad packet from blocking all the inbound packets (TCP will freeze the stream while it goes back up the connection to get the correct packet). [1] https://blog.stackpath.com/tcp-slow-start/ https://blog.stackpath.com/tcp-slow-start/