开发者

how many simultaneous ajax calls should i call at once

i have a page that loads a bunch of different windows which each come from different servers.

i do this now by having a number of javascript function firing off ajax calls to different asp.net-mvc controller actions and then all come back independently.

Is there a开发者_开发技巧 sweet spot in terms of number of ajax calls to do at once. At some threshhold, it is better to wait for some to return before kicking off other requests ?


The big question here is not how many calls, but how many per server, that's where connection limits come into play (and the reason people use CDNs with different host names for example).

If the resources are on different host names that go to the same place then you're all set and it'll parallelize nicely in older browsers, newer ones have higher connection limits by default.

However, I'm assuming all the requests are hitting the same host name (otherwise the same origin policy kicks in)...in which case your best bet is still to just let it go (unless we're talking about 50-100+ requests here) and let the browser parallelize as it sees fit.


The browser will limit it for you. Each browser has its predefined amounts of simultaneous parallel connections, parallel connections to the same domain, etc.

There is no best practices in this question afaik.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜