开发者

2 connections per server?

开发者 https://www.devze.com 2022-12-16 17:09 出处:网络
i´ve read somewhere that you can just have 2 connections (eg. ajax requests) to the same server. is this correct?

i´ve read somewhere that you can just have 2 connections (eg. ajax requests) to the same server. is this correct?

so you can´t run 3 ajax requests si开发者_开发知识库multaneously? what will happen to the 3rd one?

and if I´ve got one iframe, then i can just run 1 ajax request at the time?

what is the easiest way to get around this?

what keywords could i use to search for more information regarding this on google?


The 2 connection maximum pr server is mandated in the HTTP RFC 2616 section 8.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.

Q:what will happen to the 3rd one?

The third one will be queued untill one of the other HTTP calls return

Q:and if I´ve got one iframe, then i can just run 1 ajax request at the time?

The iFrame will be loaded through a HTTP connection, but once the HTML content has be returned the HTTP call has been completed and you again have 2 available HTTP connections

Q:what is the easiest way to get around this?

The most important is not to have long running HTTP requests, i.e. speed up processing on the server side. As long as HTTP requests are responded to in less than 100 ms, it is for normal apps not a problem.


You read it right, browsers limit simultaneous connection to the exact same domain to 2 for any type of requests (script src, image src, ajax etc.) originating from a given document, it can be changed in registry for IE and about:config in Firefox.

One way to get around this is to have additional CNAMEs to your host.

0

精彩评论

暂无评论...
验证码 换一张
取 消