← ClaudeAtlas

tuninglisted

系统调优
ryukyagamilight/terminal-skills · ★ 1 · AI & Automation · score 75
Install: claude install-skill ryukyagamilight/terminal-skills
# 系统调优 ## 概述 内核参数、文件系统、网络优化技能。 ## 内核参数调优 ### 内存管理 ```bash # /etc/sysctl.d/99-memory.conf # 减少交换倾向 vm.swappiness = 10 # 脏页刷新 vm.dirty_ratio = 20 vm.dirty_background_ratio = 5 # 内存过量提交 vm.overcommit_memory = 1 vm.overcommit_ratio = 80 # 最大内存映射数 vm.max_map_count = 262144 # 应用 sysctl -p /etc/sysctl.d/99-memory.conf ``` ### 网络调优 ```bash # /etc/sysctl.d/99-network.conf # TCP 缓冲区 net.core.rmem_max = 16777216 net.core.wmem_max = 16777216 net.ipv4.tcp_rmem = 4096 87380 16777216 net.ipv4.tcp_wmem = 4096 65536 16777216 # 连接队列 net.core.somaxconn = 65535 net.core.netdev_max_backlog = 65535 net.ipv4.tcp_max_syn_backlog = 65535 # TIME_WAIT net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_fin_timeout = 30 net.ipv4.tcp_max_tw_buckets = 65535 # 端口范围 net.ipv4.ip_local_port_range = 1024 65535 # Keep-Alive net.ipv4.tcp_keepalive_time = 600 net.ipv4.tcp_keepalive_intvl = 30 net.ipv4.tcp_keepalive_probes = 3 ``` ### 文件系统 ```bash # /etc/sysctl.d/99-fs.conf # 文件句柄 fs.file-max = 2097152 fs.nr_open = 2097152 # inotify fs.inotify.max_user_watches = 524288 fs.inotify.max_user_instances = 512 ``` ## 文件描述符限制 ### ulimit 配置 ```bash # /etc/security/limits.conf * soft nofile 65535 * hard nofile 65535 * soft nproc 65535 * hard nproc 65535 root soft nofile 65535 root hard nofile 65535 ``` ### systemd 服务 ```bash # /etc/systemd/system/myapp.service.d/limits.conf [Service] LimitNOFILE=65535 LimitNPROC=65535 ``` ## 磁盘 IO 调优 ### IO 调度器 ```bash # 查看当前调度器 cat /sys/block/sda/queue/scheduler # 设置调度器 echo de