performance - node.js concurrent connection limit -
i wrote trivial node.js
client/server pair test local limits on concurrent connections. no data sent between them: 10.000 clients connect, , wait.
each time run test, spawn server , 10 clients create 1000 connections each.
it takes little on 2 seconds reach ~8000 concurrent connections. stops. no errors happen (on 'error'
callbacks don't fire, close
doesn't fire either). connections "block", no result or timeout.
i've raised max file descriptor limit (ulimit -n
), , allowed more read/write memory consumed tcp stack via sysctl
(net.ipv4.tcp_rmem
, wmem
).
what's cap i'm hitting? how can lift it?
-- edit --
server program, logging code stripped:
clients = [] server = net.createserver() server.on 'connection', (socket) -> clients.push socket server.listen 5050
client (this runs n
times):
sockets = [] [1..num_sockets] socket = new net.socket sockets.push socket socket.connect 5050
these system limits:
sysctl -w net.ipv4.ip_local_port_range="500 65535" sysctl -w net.ipv4.tcp_tw_recycle="1" sysctl -w net.ipv4.tcp_tw_reuse="1" sysctl -w net.ipv4.tcp_rmem="4096 87380 16777216" sysctl -w net.ipv4.tcp_wmem="4096 16384 16777216" sysctl -w fs.file-max="655300" sysctl -w fs.nr_open="3000000" ulimit -n 2000000
Comments
Post a Comment