天天看點

主流浏覽器并發連接配接數

浏覽器預設對同一域下的資源,隻保持一定的連接配接數,會阻塞過多的連接配接。rfc2616建議不超過2個:

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.

不同浏覽器的預設值不一樣,對于不同的HTTP協定其值也不一樣。見下表。

浏覽器預設最大并發連接配接數

浏覽器 HTTP 1.1 HTTP 1.0
IE 6,7 2 4
IE 8 6 6
Firefox 2 2 8
Firefox 3 6 6
Safari 3, 4 4 4
Chrome 1,2 6 ?
Chrome 3 4 4
Opera 9.63,10.00alpha 4 4

上表資料來自Steve Souders。

總的來看,HTTP1.0下允許的連接配接數普遍大于HTTP1.1協定下的,是因為HTTP1.1是保持連接配接的,本身對同域下資源的擷取就是優化的,且對資源的消耗要大于HTTP1.0。在rfc2616中說到,限制連接配接數的目的在于提高響應速度和避免擁塞。

修改浏覽器最大連接配接數

1. Firefox

在檔案 X:\Program Files\Mozilla Firefox\greprefs\all.js中,有如下的參數:

//​ ​i​f​ ​n​e​t​w​o​r​k​.​h​t​t​p​.​k​e​e​p​-​a​l​i​v​e​ ​i​s​ ​t​r​u​e​,​ ​a​n​d​ ​i​f​ ​N​O​T​ ​c​o​n​n​e​c​t​i​n​g​ ​v​i​a​ ​a​ ​p​r​o​x​y​,​ ​t​h​e​n​

​/​/​ ​a​ ​n​e​w​ ​c​o​n​n​e​c​t​i​o​n​ ​w​i​l​l​ ​o​n​l​y​ ​b​e​ ​a​t​t​e​m​p​t​e​d​ ​i​f​ ​t​h​e​ ​n​u​m​b​e​r​ ​o​f​ ​a​c​t​i​v​e​ ​p​e​r​s​i​s​t​e​n​t​

/​/​ ​c​o​n​n​e​c​t​i​o​n​s​ ​t​o​ ​t​h​e​ ​s​e​r​v​e​r​ ​i​s​ ​l​e​s​s​ ​t​h​e​n​ ​m​a​x​-​p​e​r​s​i​s​t​e​n​t​-​c​o​n​n​e​c​t​i​o​n​s​-​p​e​r​-​s​e​r​v​e ​r​.​

​p​r​e​f​(​"​n​e​t​w​o​r​k​.​h​t​t​p​.​m​a​x​-​p​e​r​s​i​s​t​e​n​t​-​c​o​n​n​e​c​t​i​o​n​s​-​p​e​r​-​s​e​r​v​e​r​"​,​ ​6​)​;​

/​/​ ​i​f​ ​n​e​t​w​o​r​k​.​h​t​t​p​.​k​e​e​p​-​a​l​i​v​e​ ​i​s​ ​t​r​u​e​,​ ​a​n​d​ ​i​f​ ​c​o​n​n​e​c​t​i​n​g​ ​v​i​a​ ​a​ ​p​r​o​x​y​,​ ​t​h​e​n​ ​a​

/​/​ ​n​e​w​ ​c​o​n​n​e​c​t​i​o​n​ ​w​i​l​l​ ​o​n​l​y​ ​b​e​ ​a​t​t​e​m​p​t​e​d​ ​i​f​ ​t​h​e​ ​n​u​m​b​e​r​ ​o​f​ ​a​c​t​i​v​e​ ​p​e​r​s​i​s​t​e​n​t​

/​/​ ​c​o​n​n​e​c​t​i​o​n​s​ ​t​o​ ​t​h​e​ ​p​r​o​x​y​ ​i​s​ ​l​e​s​s​ ​t​h​e​n​ ​m​a​x​-​p​e​r​s​i​s​t​e​n​t​-​c​o​n​n​e​c​t​i​o​n​s​-​p​e​r​-​p​r​o​x​y ​.​

​p​r​e​f​(​"​n​e​t​w​o​r​k​.​h​t​t​p​.​m​a​x​-​p​e​r​s​i​s​t​e​n​t​-​c​o​n​n​e​c​t​i​o​n​s​-​p​e​r​-​p​r​o​x​y​"​,​ ​8​)​;

2. IE

需要修改系統資料庫或組政策,詳情見微軟的技術支援。

轉載于:https://www.cnblogs.com/web-backend/archive/2010/05/03/1726835.html