tuned-adm 命令详解
更新时间:2026-09-17。「一个命令一个文档」系列,属于性能观测与调试族。同一份"高并发/低延迟该改哪些内核参数",RHEL/CentOS/Rocky 系常由 tuned 守护进程用一套预设方案统一下发,tuned-adm 就是查看/切换这些方案的命令。
tuned 以 profile 为单位,把一组 CPU 调频策略、sysctl、I/O 调度器、电源管理等参数打包,激活后由守护进程持续维护。
一、常用法
bash
tuned-adm list # 列出所有可用 profile
tuned-adm active # 当前激活的是哪个
tuned-adm profile throughput-performance # 切换方案
tuned-adm recommend # 系统根据用途给出推荐
tuned-adm profile_info throughput-performance
tuned-adm verify # 校验当前设置是否与 profile 期望一致(排查被改动/漂移)
tuned-adm off # 关闭 tuned,移除其调优(回到默认)二、常见 profile
| profile | 取向 |
|---|---|
latency-performance | 最低延迟:performance governor、关 C-state/省电、降延迟 sysctl |
throughput-performance | 高吞吐服务器常用(很多 RHEL 默认推荐),偏吞吐与整体性能 |
network-latency / network-throughput | 在上述基础上叠加网络延迟/吞吐参数 |
powersave | 省电优先,适合笔记本/成本敏感 |
virtual-guest / virtual-host | 虚拟机 / 虚拟化宿主专用 |
三、关键理解:它只是帮你改参数
- tuned 不是另一套玄学,它落地的仍是你手工也能改的东西:CPU governor(performance/powersave,对应
/sys/devices/system/cpu/cpu*/cpufreq)、sysctl(vm.、net.、kernel.sched*)、I/O 调度器、透明大页、停 watchdog 等。想知道具体改了什么:bash/usr/lib/tuned/<profile>/tuned.conf # profile 定义,逐行可读 tuned-adm verify # 对比期望值 - 会覆盖/重应用你的手动参数:你
sysctl -w改的值,重启或 tuned 重新应用 profile 后可能被刷回去;要固化自定义参数,应做一个自定义 profile 或/etc/sysctl.d/,并理解二者加载顺序,而不是和 tuned"打架"。 - 与云/容器:容器共享宿主内核,profile 在宿主/虚机层面设置;容器内单独切 tuned 通常无意义。Debian/Ubuntu 默认可能不装 tuned(用 sysctl/cpufrequtils 手工管)。
四、典型用法
性能基线先 tuned-adm active 看现状,压测/低延迟场景切 latency-performance 或 network-latency,再用 tuned-adm verify 与 nstat/压测数据验证效果;不要无脑套——比如台式开发机、电池设备就不适合强制 performance(发热/耗电)。
相关命令
单参数手工查看/修改用 sysctl,CPU 调度器/频率也见 chrt,NUMA 调优结合 numactl,网络参数背景见内核网络调优。
总结
tuned-adm 管理 tuned 的调优方案:active 看当前、list/recommend 选方案、profile latency-performance|throughput-performance 一键切换、verify 查参数漂移、off 关闭;profile 本质是打包的 governor+sysctl+IO 调度器等可复现设置,省心但会在重应用时覆盖手改值,定制应写自定义 profile/sysctl.d;它作用于宿主/虚机内核层,容器内不单独生效,Debian 系常需自行安装或手工 sysctl。