performance-tuning
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePerformance Tuning
性能调优
Optimize Linux system performance.
优化Linux系统性能。
System Monitoring
系统监控
bash
top / htop # Process monitoring
vmstat 1 # Memory statistics
iostat -x 1 # Disk I/O
sar -n DEV 1 # Network statistics
perf top # CPU profilingbash
top / htop # Process monitoring
vmstat 1 # Memory statistics
iostat -x 1 # Disk I/O
sar -n DEV 1 # Network statistics
perf top # CPU profilingKernel Parameters
内核参数
bash
undefinedbash
undefined/etc/sysctl.d/99-performance.conf
/etc/sysctl.d/99-performance.conf
vm.swappiness = 10
net.core.somaxconn = 65535
net.ipv4.tcp_max_syn_backlog = 65535
fs.file-max = 2097152
vm.dirty_ratio = 40
vm.dirty_background_ratio = 10
undefinedvm.swappiness = 10
net.core.somaxconn = 65535
net.ipv4.tcp_max_syn_backlog = 65535
fs.file-max = 2097152
vm.dirty_ratio = 40
vm.dirty_background_ratio = 10
undefinedFile Descriptor Limits
文件描述符限制
bash
undefinedbash
undefined/etc/security/limits.conf
/etc/security/limits.conf
- soft nofile 65535
- hard nofile 65535
- soft nproc 65535
- hard nproc 65535
undefined- soft nofile 65535
- hard nofile 65535
- soft nproc 65535
- hard nproc 65535
undefinedDisk I/O
磁盘I/O调优
bash
undefinedbash
undefinedChange scheduler
Change scheduler
echo noop > /sys/block/sda/queue/scheduler
echo noop > /sys/block/sda/queue/scheduler
Enable trim for SSDs
Enable trim for SSDs
fstrim -av
undefinedfstrim -av
undefinedNetwork Tuning
网络调优
bash
undefinedbash
undefinedIncrease buffers
Increase buffers
sysctl -w net.core.rmem_max=134217728
sysctl -w net.core.wmem_max=134217728
undefinedsysctl -w net.core.rmem_max=134217728
sysctl -w net.core.wmem_max=134217728
undefinedBest Practices
最佳实践
- Profile before optimizing
- Change one parameter at a time
- Monitor impact of changes
- Document all tuning
- 优化前先进行性能分析
- 每次仅修改一个参数
- 监控参数变更带来的影响
- 记录所有调优操作