We are encountering an issue when we are doing a lot of requests using HTTP Request on our NodeJS API server using NodeRED.
By the way, we also tested this using our WWW Request node which his implemented on the Request library. The result is the same :(
Here is the error stacktrace:
error:
{ message: 'Error: connect ECONNREFUSED 163.113.172.80:1337',
source:
{ id: '5d2aa78c.a2d558',
type: 'http-request',
name: undefined,
count: 1 },
stack: 'Error: connect ECONNREFUSED 163.113.172.80:1337\n at
Object.exports._errnoException (util.js:856:11)\n at
exports._exceptionWithHostPort (util.js:879:20)\n at
TCPConnectWrap.afterConnect [as oncomplete] (net.js:1062:14)' } }
Of course, we tested our API server using Apache Benchmark (ab CLI) with success (no failure) and an API Rate of 500 req/s.
Technical information :
Any idea ?
We've found an workaround by setting the max sockets value like this :
http.globalAgent.maxSockets = 100;
https.globalAgent.maxSockets = 100;
By default, the HTTP(S) global agent max socket value seems to be infinite...