leora
leora

Reputation: 196669

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 ?

Upvotes: 2

Views: 1908

Answers (2)

Nick Craver
Nick Craver

Reputation: 630549

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.

Upvotes: 5

zerkms
zerkms

Reputation: 255005

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.

Upvotes: 0

Related Questions