Le daemon tuned permet de selectionner un profil pour optimiser les performances du système, il utilise udev pour surveiller les appareils connectés et ajuste les paramètres du système de façon statique et dynamique en fonction d’un profil sélectionné.
Tuned comporte plusieurs profils prédéfinis pour des cas d’utilisation courants : débit élevé, faible latence, économie d’énergie, etc.
Tuned propose plusieurs profils prédéterminés pour l’économie d’énergie et l’amélioration des performances, par exemple : latence|debit stockage, Latence|debit réseau, performance VM, etc.
Tuned statique
Le daemon tunedapplique les paramètres d’optimisation au démarrage d’un service (ou lors d’un changement de profil). L’optimisation statique :
configure et applique les paramètres kernel prédéfinis
définit les paramètres (performances globales)
Tuned dynamique
Le daemon tunedsurveille l’activité du système et ajuste les paramètres d’optimisation. L’optimisation dynamique :
ajuste en continu l’optimisation en fonction de la charge du système
Activer le tuned dynamique
Par défault l’optimisation dynamique n’est pas activée, pour ce faire il faut modifier le fichier /etc/tuned/tuned-main.conf et modifier la variable dynamic_tuning à 1 :
# cat /etc/tuned/tuned-main.conf
[...] # Dynamicaly tune devices, if disabled only static tuning will be used. dynamic_tuning = 1
Profils d’optimisation de tuned
Les profils d’optimisation se trouve dans :
/usr/lib/tuned
/etc/tuned
Chaque profil possède un répertoire à son nom et son fichier de configuration tuned.conf :
# # tuned configuration # [main] summary=Optimize for running inside a VM for users 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 = 20
# 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 = 50
Verifier que le profil fonctionne bien en fonction des critères du fichier de configuration :
Connaitre le profil actuel avec tuned-adm active :
# tuned-adm active
Current active profile: virtual-guest
Informations sur un profil avec tuned-adm profile_info :
# tuned-adm profile_info hpc-compute
Profile name: hpc-compute
Profile summary: Optimize for HPC compute workloads
Profile description: Configures virtual memory, CPU governors, and network settings for HPC compute workloads.
Appliquer un autre profil avec tuned-adm profile ::
# tuned-adm profile hpc-compute
Avoir une recommandation de profil pour le système avec tuned-adm recommend :
# tuned-adm recommend
virtual-guest
Désactiver tuned avec tuned-adm off ::
# tuned-adm off
/!\ Résumé des commandes
Commandes :
# tuned-adm list // lister tous les profils # tuned-adm active // affiche le profil actuel # tuned-adm profile_info <profil> // informations sur un profil # tuned-adm profile <profil> // appliquer un profil # tuned-adm recommend // avoir une recommandation de profil # tuned-adm off // desactive tuned
// Installation et bon fonctionnement de tuned # dnf install tuned # systemctl enable --now tuned # systemctl is-enabled tuned # systemctl is-active tuned # sysctl vm.swappiness // doit correspondre au fichier de profil
Fichiers :
/etc/tuned/tuned-main.conf // dynamic_tuning = 1 pour avoir le tuned dynamique /usr/lib/tuned // emplacement des profils d'optimisation /etc/tuned // emplacement des profils d'optimisation
Paquets :
tuned
Cas pratiques
Ajustement des profils d’optimisation
Vérification de l’installation, de l’activation et de l’exécution du paquet tuned :
[aline@SERVER01 ~] systemctl is-active tuned active
Listing des tunning disponibles. Le profil actif est virtual-guest :
[aline@SERVER01 ~]$ sudo 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 - optimize-serial-console - Optimize for serial console use. - 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
Vérification des valeurs des paramètres vm.dirty_ratio et vm.swappiness dans le fichier de configuration /usr/lib/tuned/virtual-guest :
[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
Vérification de l’application des valeurs du profil d’optimisation sur le système :
Si on compare le le profil d’optimisation throughput-performance dans usr/lib/tuned/throughput-performance/tuned.conf la valeur des paramètres vm.dirty_ratio et vm.swappiness est différente :
# # tuned configuration # [main] summary=Broadly applicable tuning that provides excellent performance across a variety of common server workloads [...]
[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 = 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 cache vm.swappiness=10 [...]
Même si le profil actuel est virtual-guest, et que le paramètre vm.dirty_background_ratio n’a pas été défini pour lui, il hérite de la valeur vm.dirty_background_ratio du profil throughput-performance :