增加出站 TCP 连接数

Har*_*ram 7 linux iperf tcp node.js

我正在为 websockets 开发一个小型测试客户端。我正在使用 Ubuntu 11.04 。我已阅读 /sf/ask/28743151/并且我已完成以下操作

sudo sysctl -w  net.ipv4.tcp_fin_timeout=10 
sysctl -w net.ipv4.ip_local_port_range="1024 65535" 
Run Code Online (Sandbox Code Playgroud)

据我了解,这些是用于入站连接而不是出站连接。

当我打字

ulimit -n
unlimited
Run Code Online (Sandbox Code Playgroud)

我的客户端和服务器运行在不同的机器上。即使有了上述所有内容,我也无法从一个盒子跨越 1000 个以上的连接。如果有不同的提示,请告诉我

回答 我通过输入 ulimit -a 来显示所有内核限制。

ulimit -n 
unlimited 
Run Code Online (Sandbox Code Playgroud)

尽管

ulimit -a 
Run Code Online (Sandbox Code Playgroud)

将 nofile 的值返回为 1024。我在/etc/security/limits.conf文件中设置了以下格式的限制

 <user> soft nofile 8192 
 <user> hard nofile 65000 
Run Code Online (Sandbox Code Playgroud)

对用户有用的东西

Har*_*ram 1

我通过输入 ulimit -a 来计算出这一点,它显示了所有内核限制。ulimit -n 返回无限制,而 ulimit -a 返回 nofile 的值为 1024。我在 /etc/security/limits.conf 文件中以 ** soft nofile 8192 Hard nofile 65000 格式设置限制,一切正常