加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – 增加出站TCP连接的数量

发布时间:2020-12-13 17:20:57 所属栏目:Linux 来源:网络整理
导读:我正在为websockets开发一个小型测试客户端.我正在使用Ubuntu 11.04.我读过了 https://stackoverflow.com/questions/410616/increasing-the-maximum-number-of-tcp-ip-connections-in-linux我完成了以下工作 sudo sysctl -w net.ipv4.tcp_fin_timeout=10 sys
我正在为websockets开发一个小型测试客户端.我正在使用Ubuntu 11.04.我读过了
https://stackoverflow.com/questions/410616/increasing-the-maximum-number-of-tcp-ip-connections-in-linux我完成了以下工作
sudo sysctl -w  net.ipv4.tcp_fin_timeout=10 
sysctl -w net.ipv4.ip_local_port_range="1024 65535"

据我所知,这些是针对入站连接而不是出站连接.

当我打字

ulimit -n
unlimited

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

回答
我通过输入ulimit -a来计算它,它显示了所有内核限制.

ulimit -n 
unlimited

ulimit -a

将nofile的值返回为1024.我在格式中设置了/etc/security/limits.conffile中的限制

<user> soft nofile 8192 
 <user> hard nofile 65000

并且事情对用户有效

解决方法

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读