一个应用系统出现如下情况时,我们认为该系统存在网络性能问题:
网络接口的吞吐量小于期望值;出现大量的丢包现象;
出现大量的冲突现象。
Network性能调整方法:
1。调整网卡的参数。
# ethtool eth0
Settings for eth0:
Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full 1000baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Advertised auto-negotiation: Yes
Speed: 100Mb/s
Duplex: Half Port: Twisted Pair
PHYAD: 0 Transceiver: internal
Auto-negotiation: on
Supports Wake-on: d
Wake-on: d
Current message
level: 0x00000007
(7) Link detected: yes
#ethtool -s eth0 duplex full
#ifconfig eth0 mtu 9000 up
2。增加网络缓冲区和包的队列。
# cat /proc/sys/net/ipv4/tcp_mem
196608 262144 393216
# cat /proc/sys/net/core/rmem_default 135168
# cat /proc/sys/net/core/rmem_max 131071
# cat /proc/sys/net/core/wmem_default 135168
# cat /proc/sys/net/core/wmem_max 131071
# cat /proc/sys/net/core/optmem_max 20480
# cat /proc/sys/net/core/netdev_max_backlog 300
# sysctl net.core.rmem_max net.core.rmem_max = 131071
# sysctl -w net.core.rmem_max=135168 net.core.rmem_max = 135168
3。调整Webserving。
# sysctl net.ipv4.tcp_tw_reuse
net.ipv4.tcp_tw_reuse = 0
# sysctl -w net.ipv4.tcp_tw_reuse=1
net.ipv4.tcp_tw_reuse = 1
# sysctl net.ipv4.tcp_tw_recycle
net.ipv4.tcp_tw_recycle = 0
# sysctl -w
net.ipv4.tcp_tw_recycle=1
net.ipv4.tcp_tw_recycle = 1