View Full Version : AJAX: Machine Gun or Cannon?

19 Feb 2007, 1:55 PM
Im currently working on a project that has to look up and create many locations on a map (currently Google Maps API). All of these locations also have details. I was wondering which is better for server health:

Load original location
Query arround location
Load each item seperatly


Load original location
Query arround location
Load all items together

Currently they all load seperatly which means that they kind of "pop" into view as youre looking at the map run your search, however it is also running anywhere from 3 - 100+ server requests which can increase the server load dramaticly.

My main question is this: If I combine these requests into one giant request will the other users on the server be less likely to be interupted? Due to IIS request limit only 4 requests can be made at a bime per processer (so 16 here), so the tought was that by running a lot of small requests other users could get their request into the middle of this massive chain of requests instead of forcing everyone to wait for the search to finish.

Any thoughts?

19 Feb 2007, 2:36 PM
By all means, bundle them into a single request and then parse out the response in your application. If you perform a single request to the web server providing a list of things you want it to return to you, you're going to run only on one IIS thread. So the other users will continue to have 15 threads to work with and you'll only be impacting a single thread.

In addition, since the default number of connections to remote HTTP servers is configured to 4 for Internet Explorer, even if you tried to send 100 connection attempts it will only process them 4 at a time in a FIFO, and you'd then impact any other accesses to that web server for the person sitting at the computer. By rolling it all into 1 request/response, even though it's a large request/response, you're freeing up the user to continue to look at other pages on the server if necessary.