drcomwc134525 2018-03-27 09:31
浏览 38

如何在客户端无错误地进行大量连接

I have written a program in golang to make request about 2000qps to different remote ip with local port randomly selected by linux, and close request immediately after connection established, but still encounter bind: address already in use error periodically

what I have done:

  1. net.ipv4.ip_local_port_range is 15000-65535
  2. net.ipv4.tcp_tw_recycle=1 net.ipv4.tcp_tw_reuse=1 net.ipv4.tcp_fin_timeout=30

above is sockstat:

sockets: used 1200 TCP: inuse 2302 orphan 1603 tw 40940 alloc 2325 mem 201

I don't figure it out why this error still there with kernel selecting available local port,will kernel return a port in use ?

  • 写回答

1条回答 默认 最新

报告相同问题?