且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

HTTP管道和使用SPDY进行HTTP多路复用之间的区别

更新时间:2022-03-04 07:04:42

这不是不正确的,但有一个重要的方面它省略了。 HTTP要求您在继续执行任何其他请求之前提供整个响应。您在图表中显示的内容是正确的,因为使用SPDY,我们最终可以打破行首要求并在响应可用时提供响应。但是,我们也不必等待任何请求完全完成。

It's not incorrect, but there is an important aspect it omits. HTTP requires that you deliver the entire response before any other request can proceed. What you're showing in the diagram is correct in the sense that with SPDY we can finally break the "head of line" requirement and deliver the responses as they become available. However, we also don't have to wait for any request to complete entirely.

想象一下两个请求,大小都是几个kb:每个请求都有多个数据包,称之为 [r1p1,r1p2] [r2p1,r2p2] 。 HTTP要求pN以准确的顺序到达。另一方面,SPDY允许我们进行以下操作: [r2p1,r1p1,r1p2,r2p2]

Imagine two requests, both several kb's in size: each request will have multiple packets, call them [r1p1, r1p2] and [r2p1, r2p2]. HTTP requires that pN's arrive in exact order. SPDY, on the other hand allows us the following: [r2p1, r1p1, r1p2, r2p2].

值得一提的是,使用SPDY,我们可以使用请求优先级来提示服务器哪些请求应该优先,即使它稍后到达网络(半打之中)其他很棒的功能)。

It's also worth mentioning that with SPDY we can use request priorities to hint the server which requests should take precedence, even if it arrives later on the wire (amongst half a dozen other great features).