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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

HTTP/1 should die; HTTP/2 can do everything HTTP/1 could, only faster

38 点作者 pgjones超过 6 年前

13 条评论

skywhopper超过 6 年前
Actually, no. HTTP/2 cannot be easily read or written by a human with a telnet or s_client connection without some additional tools. It also can't be supported by a lot of old software without some additional layer of indirection. This may or may not be important to you, but it is a thing that HTTP/2 cannot do.
评论 #18998215 未加载
评论 #18998177 未加载
评论 #18998950 未加载
mankyd超过 6 年前
One important difference: HTTP&#x2F;2 requires* encryption. This makes getting up and running for local development and small deployments more difficult.<p>* <a href="https:&#x2F;&#x2F;http2.github.io&#x2F;faq&#x2F;#does-http2-require-encryption" rel="nofollow">https:&#x2F;&#x2F;http2.github.io&#x2F;faq&#x2F;#does-http2-require-encryption</a> &quot;[...] currently no browser supports HTTP&#x2F;2 unencrypted.&quot;
评论 #18998329 未加载
评论 #18997995 未加载
jabart超过 6 年前
Yes and no, because it is complicated. This is a fairly naive example of HTTP&#x2F;2 to illustrate a point, while most websites I am called in on to optimize the load time are not built like this. This example only shaved off around 60ms for 20 requests, if your website has 20 requests to load, you have ads or you have a resource problem.<p>HTTP&#x2F;2 spec says it should not share a connection across a host&#x2F;port combo, any content you have loaded on a CDN, or a your own cdn.mydomain.com will be a separate connection. The reason CDNs are faster is because they are closer(lower latency) or it is common and already cached in your browser.<p>HTTP&#x2F;2 still suffers from latency and TCP Window sizes, so no your 8mb website will still be slow after you enable HTTP&#x2F;2, you still have to push 8mb out to the client. If you have a site loading over 80 resources, concat and minify that first before asking your server admin to turn on HTTP&#x2F;2.<p>HTTP&#x2F;1 clients gets around some network latency issues by issuing more than one TCP socket, just like SFTP clients using more than one thread. Because it is hard to overload a single socket when your latency for your ACK packets is 200ms+. If this wasn&#x27;t true, Google would not be spending the time on a UDP based version of HTTP. HTTP&#x2F;2<p>Overall, lower you content size, lower the number of requests it takes to load your initial website, THEN turn on HTTP&#x2F;2.
评论 #18998158 未加载
评论 #18998140 未加载
rqs超过 6 年前
I rather believe HTTP&#x2F;2 will die when HTTP&#x2F;3 is available.<p>After all HTTP&#x2F;1 is very simple to implement and already widely used and optimized. It is usable for most of cases. Plus, maybe in the future, CDN can serve HTTP&#x2F;2 to client while use HTTP&#x2F;1 to read the source.<p>And currently web browsers still need to send Upgrade request in HTTP&#x2F;1 to know whether or not a unknown HTTP server supports HTTP&#x2F;2. I guess this will still be true after HTTP&#x2F;3 comes out (alt-svc).
评论 #18998373 未加载
bpicolo超过 6 年前
Aha, this article is by the creator of Quart[0]! I&#x27;m a big fan - one of my favorite new python packages. It&#x27;s essentially a super zippy, flask-compatible asyncio python server. I switched a flask app over recently and saw an immediate 10-20x throughput gain (the app is entirely io-bound). pgjones was a pleasure to work with when I had a few issues and had to contribute a few compat fixes as well. Thanks for the awesome package!<p>[0]: <a href="https:&#x2F;&#x2F;gitlab.com&#x2F;pgjones&#x2F;quart&#x2F;" rel="nofollow">https:&#x2F;&#x2F;gitlab.com&#x2F;pgjones&#x2F;quart&#x2F;</a>
评论 #18997929 未加载
rando231超过 6 年前
This can&#x27;t be true, can it?<p>I was under the impression that HTTP&#x2F;2 used a persistent connection w&#x2F; multiplexing. This seems like it would be very nice in a web-browser to front-end situation, but what about for internal service calls? Seems like persistent connection between services would mess w&#x2F; common load balancing schemes.
评论 #18998561 未加载
altmind超过 6 年前
Time will show what unknown challenges and problems http&#x2F;2 carries. So far, the protocol is studied mostly by google(and less by cloudflare), there is limited research by independent parties.<p>From the article, i see that the author heavily relies on the chrome devtools to demonstrate the performance benefit, relying on chrome connection statuses.<p>My spdy and http&#x2F;2 tests in 2016 did not show much imrovment in perceived load speed for our e-commerce site. optimizing delivery(for us - caching the pre-rendered javascript components and pre-loading some ajax) yield better results. ymmv.
atemerev超过 6 年前
So, Websockets over HTTP&#x2F;2 are only available in latest Firefox (or experimentally in Chrome, if you manually turn on a flag for it). Almost no servers support HTTP&#x2F;2 Websockets, too.<p>Sorry, it is a little too early to switch.
peterwwillis超过 6 年前
If you want HTTP&#x2F;2 to succeed, you&#x27;re going to have to start making little wins. Find a tiny, easy market and get them to use it. Then find a giant customer (Google never counts) and get them to use it. If it seems more complicated, nobody&#x27;s going to pick it up unless they have to.<p>The alternative is to create big sexy splash pages, create a lots of hype, and lie to people about how <i>easy</i> it is to implement. When they&#x27;re finally caught up in the complexity of implementation, it&#x27;ll be too late to back out.
commandlinefan超过 6 年前
Same can be said about IPv6 - and could have been said about IPv6 20 years ago. Still waiting...
评论 #19002647 未加载
antoinevg超过 6 年前
Speed. It is not everything.
xena超过 6 年前
Except websockets.
评论 #18998944 未加载
est超过 6 年前
but can h2 do websocket?
评论 #18997868 未加载
评论 #18997869 未加载