How to improve the performance networking (TCP & UDP) on Linux 2.4+

Type: sysctl -p | grep mem
This will display your current buffer settings. Save These! You may want to roll-back these changes

Type: sysctl -w net.core.rmem_max=8388608
This sets the max OS receive buffer size for all types of connections.

Type: sysctl -w net.core.wmem_max=8388608
This sets the max OS send buffer size for all types of connections.

Type: sysctl -w net.core.rmem_default=65536
This sets the default OS receive buffer size for all types of connections.

Type: sysctl -w net.core.wmem_default=65536
This sets the default OS send buffer size for all types of connections.

iptables -t nat -P PREROUTING ACCEPT
iptables -t nat -P POSTROUTING ACCEPT
iptables -t nat -P OUTPUT ACCEPT
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -P PREROUTING ACCEPT
iptables -t mangle -P INPUT ACCEPT
iptables -t mangle -P FORWARD ACCEPT
iptables -t mangle -P OUTPUT ACCEPT
iptables -t mangle -P POSTROUTING ACCEPT
iptables -t mangle -F
iptables -t mangle -X
iptables -t filter -P INPUT ACCEPT
iptables -t filter -P FORWARD ACCEPT
iptables -t filter -P OUTPUT ACCEPT
iptables -t filter -F
iptables -t filter -X

sysctl -w net.core.rmem_max=40960000
sysctl -w net.core.wmem_max=40960000
sysctl -w net.core.rmem_default=65536
sysctl -w net.core.wmem_default=65536
sysctl -w net.ipv4.tcp_rmem='4096 87380 8388608'
sysctl -w net.ipv4.tcp_wmem='4096 65536 8388608'
sysctl -w net.ipv4.tcp_mem='8388608 8388608 8388608'
sysctl -w net.ipv4.route.flush=1

ulimit -n 10240
ulimit -a
sysctl -a |grep net.core

你可能感兴趣的:(linux)