找回密码
 立即注册
HTTPtheTCP阻塞 | 软件工程 2022-04-28 209 0star收藏 版权: . 保留作者信息 . 禁止商业使用 . 禁止修改作品
前面两讲,我们一起学习了HTTP/2,你也应该看到HTTP/2做出的很多努力,比如头压缩、二进制分帧、虚拟“流”和多路复用,性能和HTTP/1相比,有方面有了很大提升,“基本”解决了“堵头”的“大问题”。
HTTP/2“行头阻塞”
等等,你可能会问:为什么它“基本上”而不是“完全”解决了?
这是因为虽然 HTTP/2 使用了“帧”、“流”和“复用”,没有“队列头阻塞”,但是这些方法都是在应用层,在底层,也就是在TCP 协议或“线头阻塞”发生。
这里发生了什么?
让我们从协议栈的角度来仔细看看。在HTTP/2中,多个“request-response”被分解成流,交给TCP后,TCP会被拆分成更小的数据包,依次发送(其实在TCP中应该叫segment,也就是“分割”)。
在网络良好的情况下,包裹可以快速送达目的地。但是如果网络质量比较差,比如用手机上网,就可能会丢包。为了保证可靠传输,TCP有一种特殊的“丢包重传”机制。丢失的数据包必须等待重传确认。即使收到了其他数据包,也只能放在缓冲区中。不出去,只有
可以“匆忙”。

(For example, we have made great efforts to improve the performance of "http / 1 / 2" and "http / 2" compared with "http / 1" and "http / 2".Http / 2 "line header blocking"Wait, you may ask: Why did it solve "basically" rather than "completely"?This is because although http / 2 uses "frame", "stream" and "multiplexing" without "queue header blocking", these methods occur at the application layer, at the bottom, that is, in the TCP protocol or "thread header blocking".What happened here?Let's take a closer look from the perspective of protocol stack. In http / 2, multiple "request responses" are decomposed into streams. After they are handed over to TCP, TCP will be split into smaller packets and sent in turn (in fact, it should be called segment in TCP, that is, "split").When the network is good, the package can be delivered to the destination quickly. However, if the network quality is poor, such as surfing the Internet with mobile phones, packets may be lost. In order to ensure reliable transmission, TCP has a special "packet loss retransmission" mechanism. Lost packets must wait for retransmission confirmation. Even if other packets are received, they can only be placed in the buffer. No, onlyYou can "rush".)

[下载]09033113763.rar




上一篇:HTML5 从入门到精通.pdf
下一篇:我应该迁移到HTTP 2吗?.pdf