Open sbiaudet opened 10 years ago
Hi sbiaudet,
We had and have similar issues so any tips on how to resolve it properly would be much appreciated.
We started to look at this blog post on the topic: http://blog.gluwer.com/2014/03/story-of-eaddrinuse-and-econnreset-errors/
So far we set the maxsocket to 1000 (http.globalAgent.maxSockets = 1000) and lowered the timeout for any external calls to 55 seconds. Still have a few EASSEINUSE error's but it improved quite a bit.
Hi @markusahlstrand ,
changing the globalAgent is not enough, if you use default httpModule. You can use forever-agent https://github.com/mikeal/forever-agent. It manage a connection pool to avoid this problem.
We have this problem specificly with azure storage - https://github.com/Azure/azure-storage-node. Azure storage default implementation use httpModule. We've made a fork to use forever agent instead of httpModule https://github.com/Azure/azure-storage-node/issues/11.
Hi @sbiaudet
There's support for custom agents in the latest release now. We use the keep-alive-agent and it works just fine.
@markusahlstrand can you post some code on how to use custom agents? I am using the azure storage npm package to make many requests to azure tables, which fail with EADDRINUSE errors when fully loaded.
@murdockcrc you can found below an example to use custom agent with agentkeepalive https://github.com/node-modules/agentkeepalive
var http = require('http');
var https = require('https');
var Agent = require('agentkeepalive');
var HttpsAgent = require('agentkeepalive').HttpsAgent;
....
http.globalAgent = new Agent();
https.globalAgent = new HttpsAgent();
@sbiaudet I can confirm, running the app on node 0.12.0 AND adding the agentkeepalive as described above caused a BIG BIG BIG improvement time on my scale tests againt Azure. Thanks for the pointer.
I use nodejs for my websites in azure website. When I made a stress test I've a EADDRINUSE error to external rest api call (azure table, ....) and the server crash.
I've made no special changes in iisnode config, just errors et logs enabled.
What can I do ?