0

Facing a problem in the production server running debian (7.0) with nodejs (v0.10.x) cluster where it doesn't close some TCP connections to the clients.

This leads to connection drops when connection limit is reached.

Using ss -s tool I can monitor that some connections are closed after a while but some are not.

Here is the sysctrl config changes I use in order to increase maximum connections as temporary workaround:

net.ipv4.ip_local_port_range = 1024 65500 net.core.rmem_max = 33554432 net.core.wmem_max = 33554432 net.ipv4.tcp_rmem = 4096 16384 33554432 net.ipv4.tcp_wmem = 4096 16384 33554432 net.ipv4.tcp_mem = 786432 1048576 26777216 net.core.netdev_max_backlog = 2000 

How to find the bottleneck and solve the problem?

2
  • How solid is your code? Maybe there are some cases where the last callback is never called? Commented Jan 17, 2015 at 8:57
  • @Bazze the code looks solid. Also there is a 2 min default timeout for that case, so connection will be closed even if there missed callback. Commented Jan 17, 2015 at 10:08

1 Answer 1

1

The problem was that https server doesn't inherit sockets timeout logic from http server.

There is a patch merged since Apr 2013, but it still doesn't merged to stable 0.10 branch.

The solutions:

  • avoid https usage, use some proxy server (nginx);
  • custom timeout handle;
  • use node version higher than 0.10.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.