PaquitoSoft
PaquitoSoft

Reputation: 3367

NodeJS load test poor performance (EADDRNOTAVAIL)

I'm beginning with web applications using NodeJS and there is one problem with my app I don't know how to solve.

the application (we use expressjs) is running smooth on my local machine but, when we deploy it to our dev server for load test, we're getting an error like this

Error: connect EADDRNOTAVAIL at errnoException (net.js:770:11) at connect (net.js:646:19) at Socket.connect (net.js:711:9) at asyncCallback (dns.js:68:16) at Object.onanswer [as oncomplete] (dns.js:121:9) GET XXXXXXX 500 21ms

Our application does not have a database, it deals with a Rest API backend. Every page we build needs one or more calls to our backend. I know we must use a caching system but we want to test without it.

Our load test simulates user navigation. It starts with 5 users and it adds another user every minute. When we have over 25 users, we begin to see the error in our logs.

At the beginning I thought it could be a problem regarding too many open connections, but our sys admins says that's not the case.

So, it would be great if anyone could give a hint about where should I look at.

EDIT: Our dev machine has 16 cores and we're running our application using cluster module. Calls to backend are handled with popular Mikael's request module.

Upvotes: 1

Views: 1734

Answers (2)

leew
leew

Reputation: 48

If you make sure it is not a program problem, you can change the linux system configure to solve this problem:

[xxx@xxx~]$vim /etc/sysctl.conf

net.ipv4.tcp_tw_reuse = 1

net.ipv4.tcp_tw_recycle = 1

[xxx@xxx~]$sysctl -p

Upvotes: 0

PaquitoSoft
PaquitoSoft

Reputation: 3367

As robertklep suggested, this is a problem of the SO running out virtual ports when opening too many outgoing connections. Follow his link for a detailed explanation.

When I increased the ports as the article says I still got the problem. With a some more googling I found out about problems with garbage collector and node network objects. It seems a good idea (when you need many many outgoing connections) to manually handle garbage collector. Check out this post.

Upvotes: 2

Related Questions