Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

第62题(2019-10-21):为什么 HTTP1.1 不能实现多路复用(腾讯) #64

Open
qappleh opened this issue Oct 21, 2019 · 2 comments
Labels

Comments

@qappleh
Copy link
Owner

qappleh commented Oct 21, 2019

No description provided.

@qappleh qappleh changed the title 第62题(2019-10-19):为什么 HTTP1.1 不能实现多路复用(腾讯) 第62题(2019-10-21):为什么 HTTP1.1 不能实现多路复用(腾讯) Oct 21, 2019
@acgta5
Copy link

acgta5 commented Oct 21, 2019

白嫖

@qappleh
Copy link
Owner Author

qappleh commented Oct 22, 2019

HTTP1.x是序列和阻塞机制

HTTP 2.0 是多工复用TCP连接,在一个连接里,客户端和浏览器都可以同时发送多个请求或回应,而且不用按照顺序一一对应,这样就避免了"队头堵塞"。

举例来说,在一个TCP连接里面,服务器同时收到了A请求和B请求,于是先回应A请求,结果发现处理过程非常耗时,于是就发送A请求已经处理好的部分, 接着回应B请求,完成后,再发送A请求剩下的部分。

旧的http1.1是会等 A请求完全处理完后在 处理B请求,会阻塞

另:http1.1已经实现了管道机制:即 在同一个TCP连接里面,客户端可以同时发送多个请求。http 1.0并做不到,所以效率很低

@qappleh qappleh added the 腾讯 label Nov 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants