Why can browsers only download two or four components in parallel?

早过忘川 提交于 2019-12-08 08:52:28

问题


I know that reducing the number of HTTP requests decreases the page load time for users because browsers can only load "two or four" components in parallel per host name.

But I can't seem to find information anywhere about WHY browsers can only download "two or four" components in parallel per host name!? Is this a limitation of the browsers of HTTP?


回答1:


It's covered in RFC 2616, "Hypertext Transfer Protocol -- HTTP/1.1" (http://www.ietf.org/rfc/rfc2616.txt)

Clients that use persistent connections SHOULD limit the number of simultaneous connections that they maintain to a given server. A single-user client SHOULD NOT maintain more than 2 connections with any server or proxy. A proxy SHOULD use up to 2*N connections to another server or proxy, where N is the number of simultaneously active users. These guidelines are intended to improve HTTP response times and avoid congestion.

You've also got to remember this RFC was written in 1999, in a day where we had far less powerful servers, networking kit etc.

Most browsers now support more than two connections with six being very common.

See http://www.browserscope.org/?category=network if you want an up-to-date list of the number of parallel connections to a hostname that browsers support.

You might also want to read-up some of Jim Getty's stuff on 'buffer bloat' which parallel connections can make worse.



来源:https://stackoverflow.com/questions/10282107/why-can-browsers-only-download-two-or-four-components-in-parallel

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