大网数据广告活动
服务器运维问答

Does HTTP work on persistent or non-persistent connections?

· 52CE 我爱测

I'm reading Kurose's "Computer networking - A top-down approach" , and came to the part where they explain the differences between HTTP with Non-persistent connections vs. with persistent connections. Before diving into details, …

问题原文

原帖链接 · 89f3a1c · CC BY-SA 4.0

I'm reading Kurose's "Computer networking - A top-down approach", and came to the part where they explain the differences between HTTP with Non-persistent connections vs. with persistent connections.

Before diving into details, they say that

Although HTTP uses persistent connections in its default mode, HTTP clients and servers can be configured to use non-persistent connections instead.

from what I understand that Persistent connections are used. But then, in the Non-persistent part, they say that

In their default modes, most browsers open 5 to 10 parallel TCP connections, and each of these connections handles one request- response transaction.

On the other hand, in the persistent part they say:

Typically, the HTTP server closes a connection when it isn’t used for a certain time (a configurable timeout interval). When the server receives the back-to-back requests, it sends the objects back-to-back. The default mode of HTTP uses persistent connections with pipelining. Most recently, HTTP/2 [RFC 7540] builds on HTTP 1.1 by allowing multiple requests and replies to be interleaved in the same connection, and a mechanism for prioritizing HTTP message requests and replies within this connection.

I am confused. The only way I can see this working is: Although browsers may open several connections and thus receive data in parallel, each of those connections is persistent. Does this make any sense? Or am I missing/misunderstanding something?

Thanks in advance!

已采纳解答

原帖链接 · Tero Kilkanen · CC BY-SA 4.0

Mozilla's pages on HTTP protocol are quite accurate. Connection header explains how connections are handled.

In HTTP/1.0, connections are closed by default after response is sent.

In HTTP/1.1, connections are persistent by default.

Browsers opened multiple connections with HTTP/1.1, because otherwise the server could be able to send only a single file at a time, which causes delays in showing the complete page. Drawback with this approach is the additional TCP handshakes and the slow start mechanism, which limits throughput.

HTTP/2 improved this by introducting multiplexed connection, which eliminates the additional TCP handshakes and slow start effect on throughput.

Connection persistency and multiple requests are independent from each other.

Browsers can also do things differently.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2020-07-28)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。