Linux调优工具tuned

1、tuned调优工具简介

tuned是Linux调优工具(自动优化),RHEL8默认内置tuned,RHEL7需要手工安装

2、安装tuned

# centos安装tuned调优工具
yum install tuned -y

# Ubuntu或Debian安装
sudo apt install tuned tuned-utils tuned-utils-systemtap -y
	       
# 开机自启服务并现在就启动服务
systemctl enable --now tuned

3、开启动态微调

# 编辑tuned主配置文件
vim /etc/tuned/tuned-main.conf

# 开启动态微调
dynamic_tuning = 1

## 使用sed替换配置参数
sed -ri 's#(^dynamic_tuning).*#\1 = 1#' /etc/tuned/tuned-main.conf

## 查看是否修改成功
grep dynamic_tuning /etc/tuned/tuned-main.conf

# 重启tuned服务
systemctl restart tuned

4、查看性能调整方案列表

# 查看调优方案
tuned-adm list

[root@localhost ~]# tuned-adm list
Available profiles:
- balanced                    - General non-specialized tuned profile
- desktop                     - Optimize for the desktop use-case
- hpc-compute                 - Optimize for HPC compute workloads
- latency-performance         - Optimize for deterministic performance at the cost of increased power consumption
- network-latency             - Optimize for deterministic performance at the cost of increased power consumption, focused on low latency network performance
- network-throughput          - Optimize for streaming network throughput, generally only necessary on older CPUs or 40G+ networks
- powersave                   - Optimize for low power consumption
- throughput-performance      - Broadly applicable tuning that provides excellent performance across a variety of common server workloads
- virtual-guest               - Optimize for running inside a virtual guest
- virtual-host                - Optimize for running KVM guests
Current active profile: virtual-guest

# 查看当前生效的方案,查看当前活动的配置文件
tuned-adm active

# 使用系统推荐的优化方案
tuned-adm recommend

5、切换调优方案

# 切换虚拟主机方案
tuned-adm profile virtual-guest

# 切换高吞吐量方案
tuned-adm profile network-throughput

# 可以同时使用多个方案
## 方案名使用 tuned-adm list 查看
tuned-adm  profile 方案1 方案2

## 启用虚拟机方案和低时延方案
tuned-adm profile virtual-guest network-latency

禁用所有优化调整

tuned-adm off

6、手动创建minio调优方案

# 手动创建minio调优方案

/usr/lib/tuned/是tuned的默认调优方案目录.

# 创建minio的tuned优化策略目录
mkdir -p /usr/lib/tuned/minio

# 创建minio的tuned优化策略文件
vim /usr/lib/tuned/minio/tuned.conf

# 配置内容如下
[main]
summary=Maximum server performance for MinIO

[vm]
transparent_hugepage=madvise

[sysfs]
/sys/kernel/mm/transparent_hugepage/defrag=defer+madvise
/sys/kernel/mm/transparent_hugepage/khugepaged/max_ptes_none=5

[cpu]
force_latency=1
governor=performance
energy_perf_bias=performance
min_perf_pct=100

[sysctl]
fs.xfs.xfssyncd_centisecs=72000
net.core.busy_read=50
net.core.busy_poll=50
kernel.numa_balancing=1
vm.swappiness=0
vm.vfs_cache_pressure=50
vm.dirty_background_ratio=3
vm.dirty_ratio=10
vm.max_map_count=524288
kernel.sched_migration_cost_ns=5000000
kernel.hung_task_timeout_secs=85
net.core.netdev_max_backlog=250000
net.core.somaxconn=16384
net.ipv4.tcp_syncookies=0
net.ipv4.tcp_max_syn_backlog=16384
net.core.wmem_max=4194304
net.core.rmem_max=4194304
net.core.wmem_default=4194304
net.core.rmem_default=4194304
net.ipv4.tcp_rmem="4096 87380 4194304"
net.ipv4.tcp_wmem="4096 65536 4194304"
net.ipv4.tcp_timestamps=0
net.ipv4.tcp_sack=1
net.ipv4.tcp_low_latency=1
net.ipv4.tcp_adv_win_scale=1
net.ipv4.tcp_slow_start_after_idle=0
net.ipv4.tcp_mtu_probing=1
net.ipv4.tcp_base_mss=1280
net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.default.disable_ipv6=1
net.ipv6.conf.lo.disable_ipv6=1

重启tuned服务,然后就可以看到minio的调优策略了

# 重启tuned服
systemctl restart tuned

# 查看调优策略
tuned-adm list

# 切换minio方案
tuned-adm minio
posted @ 2025-06-11 10:38  哈喽哈喽111111  阅读(160)  评论(0)    收藏  举报