性能配置文件的详细内容


/usr/lib/tuned/

RHEL自带的性能调优profile文件存储在目录中。每个配置文件都有其自己的目录。该配置文件由名为tuned.conf的主要配置文件以及其他文件(例如脚本)组成。

查看现有的(/usr/lib/tuned/目录下的)profile目录:

查看throughput-performance的目录,包含tuned.conf文件:

查看tuned.conf中内容:

[root@repo throughput-performance]# cat tuned.conf## tuned configuration#
[main]summary=Broadly applicable tuning that provides excellent performance across a variety of common server workloads
[cpu]governor=performanceenergy_perf_bias=performancemin_perf_pct=100
[disk]# The default unit for readahead is KiB.  This can be adjusted to sectors# by specifying the relevant suffix, eg. (readahead => 8192 s). There must# be at least one space between the number and suffix (if suffix is specified).readahead=>4096
[sysctl]# ktune sysctl settings for rhel6 servers, maximizing i/o throughput## Minimal preemption granularity for CPU-bound tasks:# (default: 1 msec#  (1 + ilog(ncpus)), units: nanoseconds)kernel.sched_min_granularity_ns = 10000000
# SCHED_OTHER wake-up granularity.# (default: 1 msec#  (1 + ilog(ncpus)), units: nanoseconds)## This option delays the preemption effects of decoupled workloads# and reduces their over-scheduling. Synchronous workloads will still# have immediate wakeup/sleep latencies.kernel.sched_wakeup_granularity_ns = 15000000
# If a workload mostly uses anonymous memory and it hits this limit, the entire# working set is buffered for I/O, and any more write buffering would require# swapping, so it's time to throttle writes until I/O can catch up.  Workloads# that mostly use file mappings may be able to use even higher values.## The generator of dirty data starts writeback at this percentage (system default# is 20%)vm.dirty_ratio = 40
# Start background writeback (via writeback threads) at this percentage (system# default is 10%)vm.dirty_background_ratio = 10
# PID allocation wrap value.  When the kernel's next PID value# reaches this value, it wraps back to a minimum PID value.# PIDs of value pid_max or larger are not allocated.## A suggested value for pid_max is 1024 * <# of cpu cores/threads in system># e.g., a box with 32 cpus, the default of 32768 is reasonable, for 64 cpus,# 65536, for 4096 cpus, 4194304 (which is the upper limit possible).#kernel.pid_max = 65536
# The swappiness parameter controls the tendency of the kernel to move# processes out of physical memory and onto the swap disk.# 0 tells the kernel to avoid swapping processes out of physical memory# for as long as possible# 100 tells the kernel to aggressively swap processes out of physical memory# and move them to swap cachevm.swappiness=10


/etc/tuned/

如果需要定制profile文件,需要将profile文件目录从/usr/lib/tuned/复制到/etc/tuned/的子目录中,然后修改tuned.conf对应的参数。如vm.dirty_ratio = 40。


此外,在/etc/tuned/中还有个全局配置文件tuned-main.conf。

我们查看/etc/tuned/tuned-main.conf文件的内容:

[root@repo tuned]# cat tuned-main.conf# Global tuned configuration file.
# Whether to use daemon. Without daemon it just applies tuning. It is# not recommended, because many functions don't work without daemon,# e.g. there will be no D-Bus, no rollback of settings, no hotplug,# no dynamic tuning, ...daemon = 1
# Dynamicaly tune devices, if disabled only static tuning will be used.dynamic_tuning = 0
# How long to sleep before checking for events (in seconds)# higher number means lower overhead but longer response time.sleep_interval = 1
# Update interval for dynamic tunings (in seconds).# It must be multiply of the sleep_interval.update_interval = 10
# Recommend functionality, if disabled "recommend" command will be not# available in CLI, daemon will not parse recommend.conf but will return# one hardcoded profile (by default "balanced").recommend_command = 1
# Whether to reapply sysctl from the e.g /etc/sysctl.conf, /etc/sysctl.d, ...# If enabled these sysctls will be re-appliead after Tuned sysctls are# applied, i.e. Tuned sysctls will not override system sysctls.reapply_sysctl = 1
# Default priority assigned to instancesdefault_instance_priority = 0
# Udev buffer sizeudev_buffer_size = 1MB


动态调整

默认情况下,动态调整是禁用的。要启用它,编辑/etc/tuned/tuned-main.conf文件,并将dynamic_tuning选项更改为1。然后定期分析系统统计信息并使用它们来更新系统调整设置。要配置两次更新之间的时间间隔(以秒为单位),请使用update_interval选项。如上小节展示。


在典型的办公室使用的Workstation上,以太网负载很低。只有进出几封电子邮件,或者只会加载某些网页。


对于这些类型的负载,网络接口不必始终保持全速运行。Tuned具有用于网络设备的监视和调整插件,可以检测到这种低活动性,然后自动降低该接口的速度,通常会降低功耗。


如果界面上的活动持续较长时间(例如,由于正在下载DVD映像或打开了带有大附件的电子邮件),则Tuned会检测到此情况,并将界面速度设置为最大,以提供最佳性能。




安装并使用一个profile

安装一个profile的rpm:

yum -y install tuned-profiles-cpu-partitioning

然后在/usr/lib/tuned/目录中可以看到对应的profile子目录:

查看tuned.conf文件:

[root@repo cpu-partitioning]# cat tuned.conf# tuned configuration#
[main]summary=Optimize for CPU partitioninginclude=network-latency
[variables]# User is responsible for updating variables.conf with variable content such as isolated_cores=X-Yinclude=/etc/tuned/cpu-partitioning-variables.conf
isolated_cores_assert_check = \\${isolated_cores}# Fail if isolated_cores are not setassert1=${f:assertion_non_equal:isolated_cores are set:${isolated_cores}:${isolated_cores_assert_check}}
# tmpdirtmpdir=${f:strip:${f:exec:/usr/bin/mktemp:-d}}# Non-isolated cores cpumask including offline coresisolated_cores_expanded=${f:cpulist_unpack:${isolated_cores}}isolated_cpumask=${f:cpulist2hex:${isolated_cores_expanded}}not_isolated_cores_expanded=${f:cpulist_invert:${isolated_cores_expanded}}isolated_cores_online_expanded=${f:cpulist_online:${isolated_cores}}not_isolated_cores_online_expanded=${f:cpulist_online:${not_isolated_cores_expanded}}not_isolated_cpumask=${f:cpulist2hex:${not_isolated_cores_expanded}}no_balance_cores_expanded=${f:cpulist_unpack:${no_balance_cores}}
# Fail if isolated_cores contains CPUs which are not onlineassert2=${f:assertion:isolated_cores contains online CPU(s):${isolated_cores_expanded}:${isolated_cores_online_expanded}}
[sysctl]kernel.hung_task_timeout_secs = 600kernel.nmi_watchdog = 0vm.stat_interval = 10kernel.timer_migration = 1
[sysfs]/sys/bus/workqueue/devices/writeback/cpumask = ${not_isolated_cpumask}/sys/devices/virtual/workqueue/cpumask = ${not_isolated_cpumask}/sys/devices/system/machinecheck/machinecheck*/ignore_ce = 1
[systemd]cpu_affinity=${not_isolated_cores_expanded}
[script]priority=5script=${i:PROFILE_DIR}/script.sh
[scheduler]isolated_cores=${isolated_cores}ps_blacklist=.*pmd.*;.*PMD.*;^DPDK;.*qemu-kvm.*
[bootloader]priority=10initrd_remove_dir=Trueinitrd_dst_img=tuned-initrd.imginitrd_add_dir=${tmpdir}cmdline_cpu_part=+nohz=on nohz_full=${isolated_cores} rcu_nocbs=${isolated_cores} tuned.non_isolcpus=${not_isolated_cpumask} intel_pstate=disable nosoftlockup

此时,查看可使用的profile,已经增加了CPI分区的profile:

使用这个profile:

#tuned-adm profile  cpu-partitioning


此外,我们还可以一次设置多个profile,如下所示:


©著作权归作者所有:来自51CTO博客作者mob604756f145d3的原创作品,如需转载,请注明出处,否则将追究法律责任

更多相关文章

  1. Linux系统性能调优配置文件 : RHEL8学习系列1
  2. 紫枫术河 imx6 uboot的mtd分区总结(rootfs为ubi文件系统) imx6 ubo
  3. Shell编程案例:统计指定目录下指定文件大小的个数及总和
  4. 虚拟文件系统
  5. gdb core调试
  6. ramdisk配置、解压、创建rootfs、启动简单分析
  7. 超级详细|Linux系统下从0到1的玩法大全
  8. Linux命令cURL如何访问FTP服务器
  9. Linux crontab命令详解

随机推荐

  1. 分布式事务 TCC-Transaction 源码解析 —
  2. Springboot应用缓存实践之:Ehcache加持
  3. 注册中心 Eureka 源码解析 —— 应用实例
  4. 注册中心 Eureka 源码解析 —— 注册表 I
  5. Android(安卓)官方架构组件 ViewModel :
  6. 数据库中间件 MyCAT 源码分析 —— 调试
  7. Python PK C++,初学者该如何挑选?
  8. REPMGR高可用+VIP方案
  9. 注册中心 Eureka 源码解析 —— 应用实例
  10. Android学习笔记(十七)数据保存