[20230227]tuned-adm簡單介紹.txt

lfree發表於2023-02-27

[20230227]tuned-adm簡單介紹.txt

# man tuned-adm
TUNED_ADM(8)            tuned         TUNED_ADM(8)

NAME
       tuned-adm - command line tool for switching between different tuning profiles

SYNOPSIS
       tuned-adm [list | active | profile [profile] | off | verify | recommend]

DESCRIPTION
       This command line utility allows you to switch between user definable tuning profiles. Several predefined
       profiles are already included. You can even create your own profile, either based on one of the existing ones by
       copy-ing it or make a completely new one. The distribution provided profiles are stored in subdirectories below
       /usr/lib/tuned and the user defined profiles in subdirectories below /etc/tuned. If there are profiles with the
       same  name in both places, user defined profiles have precedence.


# tuned-adm list
Available profiles:
- balanced               - General non-specialized tuned profile
- desktop                - Optimize for the desktop use-case
- 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

--//簡單一點就是修改伺服器配置修改一些核心引數.當前選擇的是virtual-guest.
--//可以根據需要自己修改,例子:
# tuned-adm profile balanced
# tuned-adm active

# ll /usr/lib/tuned/
total 16
drwxr-xr-x. 2 root root    24 2020-11-10 19:43:31 balanced
drwxr-xr-x. 2 root root    24 2020-11-10 19:43:31 desktop
-rw-r--r--. 1 root root 13963 2017-10-30 03:57:37 functions
drwxr-xr-x. 2 root root    24 2020-11-10 19:43:31 latency-performance
drwxr-xr-x. 2 root root    24 2020-11-10 19:43:31 network-latency
drwxr-xr-x. 2 root root    24 2020-11-10 19:43:31 network-throughput
drwxr-xr-x. 2 root root    41 2020-11-10 19:43:31 powersave
drwxr-xr-x. 2 root root    27 2020-11-10 19:43:31 recommend.d
drwxr-xr-x. 2 root root    24 2020-11-10 19:43:31 throughput-performance
drwxr-xr-x. 2 root root    24 2020-11-10 19:43:31 virtual-guest
drwxr-xr-x. 2 root root    24 2020-11-10 19:43:31 virtual-host

--//檢視其中virtual-guest的配置情況:

# cat /usr/lib/tuned/virtual-guest/tuned.conf
#
# tuned configuration
#

[main]
summary=Optimize for running inside a virtual guest
include=throughput-performance

[sysctl]
# 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 = 30

# Filesystem I/O is usually much more efficient than swapping, so try to keep
# swapping low.  It's usually safe to go even lower than this on systems with
# server-grade storage.
vm.swappiness = 30

--//實際上檢視配置檔案就是以throughput-performance的配置為藍本,再改動一些核心引數.

# sysctl vm.dirty_ratio
vm.dirty_ratio = 30

# sysctl vm.swappiness
vm.swappiness = 30

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2937259/,如需轉載,請註明出處,否則將追究法律責任。