Node.js app has periodic slowness and/or timeouts (does not accept incoming requests)

前端 未结 7 473
眼角桃花
眼角桃花 2021-01-30 02:08

This problem is killing the stability of my production servers.

To recap, the basic idea is that my node server(s) sometimes intermittently slow down, sometimes resultin

7条回答
  •  北荒
    北荒 (楼主)
    2021-01-30 03:04

    We have a similar problem with our Node.js server. It didn't scale well for weeks and we had tried almost everything as you had. Our problem was in the implicit backlog value which is set very low for high-concurrent environments.

    http://nodejs.org/api/http.html#http_server_listen_port_hostname_backlog_callback

    Setting the backlog to a significantly higher value (e.g. 10000) as well as tune networking in our kernel (/etc/sysctl.conf on Linux) as described in manual section helped a lot. From this time forward we don't have any timeouts in our Node.js server.

提交回复
热议问题