tcp_max_tw_buckets
这个参数52w太大了,导致同样的业务流量下,机器负载明现偏高
# 查看方式
sysctl -a | grep "tcp_max"
cat /proc/sys/net/ipv4/tcp_max_tw_buckets
# 值
net.ipv4.tcp_max_tw_buckets = 524288
net.ipv4.tcp_max_tw_buckets = 16384
txqueuelen
# 设置
ifconfig eth1 txqueuelen 10000
echo "ifconfig eth1 txqueuelen 10000" >> /etc/rc.d/rc.local
somaxconn
tcp的accept队列长度=min(somaxconn, backlog)
# 查看方式
sysctl -a | grep "net.core.somaxconn"
cat /proc/sys/net/core/somaxconn
# 设置
echo 4096 > /proc/sys/net/core/somaxconn
在/etc/sysctl.conf中添加: net.core.somaxconn = 4096
1. 查看登录用户
cat /var/log/secure | grep Accept
设置hostname
echo "kernel.hostname = hostname_temp_test" >> /etc/sysctl.d/hostname.conf
sysctl -p /etc/sysctl.d/hostname.conf
sed -i "1s/$/ hostname_temp_test/" /etc/hosts
echo "NETWORKING=yes" >> /etc/sysconfig/network
2. 统计目录下文件行数
Reference: https://www.cnblogs.com/phpfans/p/4474624.html
# 统计目录下所有文件行数
find . -type f | xargs cat | wc -l
# 统计目录下所有C代码行数
find ./ -name "*.c" | xargs cat | grep -v ^$ | wc -l
# 查看目录下各C代码文件行数
for i in `find ./ -name "*.c"`; do cat | wc -l $i; done;
3. iptables
# 多个端口
iptables -I ETH1_TCP -p tcp -m multiport --dports 8848,8849 -s 0.0.0.0/0 -j ACCEPT
4. curl
# 忽略证书
curl -k
# -H "Host:xxx"
curl -v -H "Host:www.baidu.com" "http://0.0.0.0/hls/10086_666.m3u8"
curl -v https://yun.playauth.live.qcloud.com/fdsaaa?abcccc
tcpdump -i eth1 -n -A port 8848 | fgrep abccc
5. nc验端口
# 监听端口
nc -ul port
# 连接
nc -u ip port
# 然后互发数据测试下
6. cpu
Reference:
# 物理CPU个数
cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l
# 单个CPU的核数
cat /proc/cpuinfo | grep "cpu cores"| uniq
# 逻辑CPU个数
cat /proc/cpuinfo |grep "processor" | wc -l
7. top
8. 网卡
Reference: https://www.cnblogs.com/zengkefu/p/5583618.html
ethtool eth0
# QDisc(queueing discipline)
# 设置大小
ifconfig eth1 txqueuelen 10000
echo "ifconfig eth1 txqueuelen 10000" >> /etc/rc.d/rc.local
# 查看丢包
tc -s qdisc show
执行结果:
qdisc mq 0: dev eth1 root
Sent 7857971645 bytes 47398281 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
9. 系统启动相关
# 启动时的相关配置
chkconfig --list | grep 3:on
# 重启记录
last | grep reboot
qdisc
kmalloc/vmalloc/malloc
slab/slub/slob
Reference: https://blog.csdn.net/lukuen/article/details/6935068