在 CentOS 系统(尤其是服务器长期运行、资源紧张或性能下降,即你所说的“dropped”状态)下,可以从系统参数、资源占用、网络、磁盘、服务几个层面进行优化。下面按实用优先级给你一套优化清单。
systemctl list-unit-files | grep enabled
常见可关闭:
systemctl disable --now postfix
systemctl disable --now cups
systemctl disable --now bluetooth
# 提高文件描述符
fs.file-max = 1000000
# 网络优化
net.core.somaxconn = 65535
net.core.netdev_max_backlog = 65535
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_fin_timeout = 30
net.ipv4.ip_local_port_range = 1024 65535
# 内存
vm.swappiness = 10
vm.dirty_ratio = 10
vm.dirty_background_ratio = 5
生效:
sysctl -p
/etc/security/limits.conf
* soft nofile 1000000
* hard nofile 1000000
* soft nproc 100000
* hard nproc 100000
netstat -s | grep drop
ip -s link
ethtool -G eth0 rx 4096 tx 4096
(视网卡支持情况)
已包含在 sysctl 中(tcp_tw_reuse)
/etc/fstab
/dev/sda1 / ext4 defaults,noatime 0 0
echo deadline > /sys/block/sda/queue/scheduler
yum clean all
journalctl --vacuum-time=7d
swapon --show
如内存充足:
sysctl vm.swappiness=10
worker_rlimit_nofile 100000;
events {
worker_connections 50000;
}
innodb_buffer_pool_sizequery cache(MySQL 5.7+)top
htop
iotop
iftop
dmesg | tail
如果你说的 “centos dropped” 是指:
可以告诉我具体现象或日志,我可以给你更精准的优化方案。