What is the limit of sending concurrent ajax requests with node.js?

I am making a node.js server that makes a lot of ajax requests to download json or html code, to different websites (not ddos/dos). For this language, I was wondering how many requests I can make at the same time without problems. Like is it ok to do like

for(i=0;i<1000;i+=1) {
    callajax();
}

or do I have to do

function call() {
    callajax(call);
}

this sorta calls the next ajax call, when the current one finishes.

If the top one is ok, how many ajax calls can I call at the same time before I have to wait till they return. I don't want problems with non-returning ajax requests.

Can anyone share some insight into this?

Also, lets say I have two servers running on the same wifi network. If both of them runs their node.js server making ajax requests, is that the same thing as doing it from 1 server?

This will depend upon several variables.

  1. How many simultaneous sockets is node.js configured to allow (this is a configuration option within node.js)?

  2. If all the requests are going to the same host, then how many simultaneous connections can that host handle?

  3. If the requests take a little time for the receiving server to process, how fast can it process each request and will it be able to process the last request in less time than your timeout value is set to?

In general, it would be best to limit the number of simultaneous requests you send to the same host to something manageable like 5-10 because in most cases you won't actually get better throughput by sending more simultaneous requests, but you could exhaust some resources or hit timeouts with a lot of simultaneous requests.

The actual max value is dependent upon a lot of configuration choices and specifics related to the type of request and would have to be discovered via testing.