linux下减少TIME_WAIT的socket

本文转自:http://operamasks.blogbus.com/logs/30967007.html

 

在linux下做压力测试,发现CPU占用比较高,用netstat -an|grep 6888查看socket的情况,发现很多socket处于TIME_WAIT状态,google了一下,可以进行以下优化,问题解决:

sysctl -w net.ipv4.tcp_tw_reuse=1
sysctl -w net.ipv4.tcp_fin_timeout=30
sysctl -w net.ipv4.tcp_keepalive_time=1800
sysctl -w net.ipv4.tcp_max_syn_backlog=8192

sysctl -w sched_yield_scale=1

ulimit –d unlimited
ulimit –m unlimited
ulimit –s unlimited
ulimit –t unlimited
ulimit –v unlimited

你可能感兴趣的:(html,linux,.net,socket,Google)