不管鸡肋与否还是要学习linux系统原生的调优模板-灵析社区

秋月无边

📜19.1 调优系统

基于多种用例工作负载来调整各种设备设置,以此优化系统系统能。tuned守护进程会利用反映特定工作负载要求的调优配置文件,以静态和动态两种方式应用调优调整。


📜19.2 Tuned

  • 静态调优

tuned守护进程会在服务启动时或选择新的调优配置文件时应用系统设置。静态调优会对配置文件中由tuned在运行时应用的预定义kernel参数进行配置。对于静态调优而言,内核参数是针对整体性能预期而设置的,不会随着活跃度的变化而进行调整


  • 动态调优

对于动态调优而言,tuned守护进程会监视系统活动,并根据运行时行为的变化来调整设置。从所选调优配置文件中声明的初始设置开始,动态调优会不断进行调优调整以适应当前工作负载


🔖19.2.1 安装并启用TUNED

默认情况下,RHEL 8 的最小化安装中包含并启用了tuned软件包。要手动安装并启用该软件包。

范例

[root@servera ~]# yum -y install tuned
[root@servera ~]# systemctl enable --now tuned
Created symlink /etc/systemd/system/multi-user.target.wants/tuned.service → /usr/lib/systemd/system/tuned.service.


🔖19.2.2 从命令行管理配置文件

查看调优级配置文件:

tuned-adm list

范例:

[root@servera ~]# tuned-adm list
Available profiles:
- accelerator-performance     - Throughput performance based tuning with disabled higher latency STOP states
- balanced                    - General non-specialized tuned profile
- desktop                     - Optimize for the desktop use-case
- hpc-compute                 - Optimize for HPC compute workloads
- intel-sst                   - Configure for Intel Speed Select Base Frequency
- 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


范例:

[root@servera ~]# tuned-adm active
Current active profile: virtual-guest


让系统推荐最优配置

tuned-adm recommend


范例:

[root@servera ~]# tuned-adm recommend
virtual-guest


更改配置文件:

可以将活动的配置文件切换为更符合系统当前调优要求的其他配置文件

[root@servera ~]# tuned-adm profile balanced 
[root@servera ~]# tuned-adm active
Current active profile: balanced


关闭调优活动

tuned-adm off


📜19.3 影响进程调度

🔖19.3.1 进程优先级

RHEL 优先级


🔖19.3.2 设置和调整进程优先级

进程优先级调整

  • 静态优先级:100-139
  • 进程默认启动时的nice值为0,优先级为120
  • 只有根用户才能降低nice值(提高优先性)

nice命令

以指定的优先级来启动进程

nice [OPTION] [COMMAND [ARG]...]
-n, --adjustment=N add integer N to the niceness (default 10)


renice命令

可以调整正在执行中的进程的优先级

renice [-n] priority pid...


查看:

ps axo pid,comm,ni

范例:

[root@servera ~]#nice -n -10 ping 127.0.0.1
[root@servera ~]#ps axo pid,cmd,nice |grep ping
2118 ping 127.0.0.1 -10
2120 grep --color=auto ping 0
[root@servera ~]#
[root@servera ~]#renice -n -20 2118
2106 (process ID) old priority -10, new priority -20
[root@servera ~]#ps axo pid,cmd,nice |grep ping
2118 ping 127.0.0.1 -20
2200 grep --color=auto ping 0

top调整优先级可进入监控后输入r指定进程进行renice处理


阅读量:2005

点赞量:0

收藏量:0