测试系统在Linux上的性能发现丢包率极为严重,发210000条数据,丢包达110000之巨,丢包率超过50%。同等情形下Windows上测试,仅丢几条数据。形势严峻,必须解决。考虑可能是因为协议栈Buffer太低所致,于是先看看默认情况:
sysctl -a |grep net.core
发现
net.core.rmem_max = 131071
net.core.rmem_default = 112640
修改吧,变大一点,变成10M,然后reboot(应该重启某个服务即可)
然后查网卡收包情况:
netstat -su
结果如下:
Udp:
97690 packets received
112310 packets to unknown port received.
0 packet receive errors
20 packets sent
发现数据在网卡就丢了,判断可能是防火墙引起的,于是执行命令:
iptables -L
结果如下:
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
证明iptables启动