Does SPDY/HTTP2 concatenates responses?

旧时模样 提交于 2019-12-05 08:13:14

HTTP/2.0 does not (AFAIK) exist yet - it's still a proposed standard. But it seems likely that it will use similar connection handling to SPDY.

SPDY doesn't concatenate them it multiplexes the requests across the same connection - from the network's point of view the effect is the same.

Yes, you don't need to merge the content files by hand, yes they will be cached independently.

SPDY3 and HTTP2 are multiplexing requests on the same physical connection. But even multiplexed, requests may be sent sequentially for each resource, causing major slowdowns due to roundtrip time waits.

Both SPDY3 and HTTP2 have a feature called "Resource Push" (also known as "SPDY Push", not to be confused with "Server Push") that allows related resources to be pushed without the client requesting them, and the Jetty project - I am a committer - is the only one to my knowledge that implements that feature.

You can watch Resource Push in action in this video: http://webtide.intalio.com/2012/10/spdy-push-demo-from-javaone-2012/.

With Resource Push, you save additional roundtrips to get all the different JS files and still benefit of the browser cache per single file. The whole point of resource concatenation is exactly to reduce the number of roundtrips necessary to get all the resources needed, and Resource Push helps to solve that problem.

HTTP/2.0 allows for multiplexing, where multiple request/response streams exchange data over the same TCP connection.

Because creating and starting TCP connections is expensive, HTTP/2.0's multiplexing will usually be faster than the semi-parallel downloading of HTTP/1.1, where a limited amount of TCP connections is (re)used by the browser to perform a given amount of requests for resources.

But your mileage may vary. Measure it.

As a sidenote, you might want to reference all your libraries separately when developing and debugging, but bundle and minify the JS/CSS into one file upon a deploy.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!