I have the standard code for sending out http request. Using http.globalAgent.
I set my maxSockets be 2500.
And then when I send out multiple requests at once, I get this error:
['{'code':'ECONNRESET'}']
However, if I sent out the request after a bit of timeout between each request, then it works.
So, questions are:
1) what does ECONNRESET really mean? Why this error happen?
2) How to send out multiple requests instantly without getting that error?
original code to send out multiple requests:
// I'm using Seq()
Seq().
seq(function() {
this(null, ['p1','p2','p3','p4','p5']);
})
.flatten(false)
.parEach(fuctnion(data) {
// send out request
sendRemoteRequest(data); // a function that uses http.request
})
.seq(function(data) {
console.log("done");
})
ECONNRESET
basically means that the remote server has closed the connection. I assume it only allows a certain number of concurrent connections and if that limit is reached it just drops the connection, resulting in a ECONNRESET
in your program.