linux服務之tuned


 

RHEL/CentOS 在 6.3 版本以后引入了一套新的系統調優工具 tuned/tuned-adm,其中 tuned 是服務端程序,用來監控和收集系統各個組件的數據,並依據數據提供的信息動態調整系統設置,達到動態優化系統的目的;tuned-adm 是客戶端程序,用來和 tuned 打交道,用命令行的方式管理和配置 tuned,tuned-adm 提供了一些預先配置的優化方案可供直接使用,比如:筆記本、虛擬機、存儲服務器等。
如果你正在使用筆記本(電池電源),想優化系統、節約電源又不想知道太多這方面的細節,就可以用 tuned/tuned-adm 這套工具並應用 laptop-battery-powersave 方案來調整和優化系統。當然不同的系統和應用場景有不同的優化方案,tuned-adm 預先配置的優化策略不是總能滿足要求,這時候就需要定制,tuned-adm 允許用戶自己創建和定制新的調優方案。

[root@1st-kvm tuned]# rpm -qa|grep tun
tuned-2.5.1-4.el7.noarch

[root@1st-kvm tuned]# less /var/log/tuned/tuned.log

[root@1st-kvm ~]# tuned-adm list
Available profiles:
- balanced
- desktop
- latency-performance
- network-latency
- network-throughput
- powersave
- throughput-performance
- virtual-guest
- virtual-host
Current active profile: balanced
[root@1st-kvm ~]# tuned-adm active
Current active profile: balanced
[root@1st-kvm ~]# tuned-adm profile virtual-host
[root@1st-kvm ~]# tuned-adm active
Current active profile: virtual-host

 

 

如果是企業存儲服務器的話,可以用 enterprise-storage 方案:
tuned-adm profile enterprise-storage
上面預定的方案不是總能滿足要求,如果有自己的需求可以定制自己的方案。自己定制很容易,切換到優化方案的配置目錄,拷貝一個例子,然后編輯里面的相關參數就可以了,使用 tuned-adm list 命令會看到剛創建的新方案 my-virtual-host:

[root@1st-kvm tuned]# ll
total 16
drwxr-xr-x. 2 root root    23 Jul 24 14:59 balanced
drwxr-xr-x. 2 root root    23 Jul 24 14:59 desktop
-rw-r--r--. 1 root root 12260 May 19  2015 functions
drwxr-xr-x. 2 root root    23 Jul 24 14:59 latency-performance
drwxr-xr-x. 2 root root    23 Jul 24 14:59 network-latency
drwxr-xr-x. 2 root root    23 Jul 24 14:59 network-throughput
drwxr-xr-x. 2 root root    39 Jul 24 14:59 powersave
-rw-r--r--. 1 root root  1288 Aug  1  2015 recommend.conf
drwxr-xr-x. 2 root root    23 Jul 24 14:59 throughput-performance
drwxr-xr-x. 2 root root    23 Jul 24 14:59 virtual-guest
drwxr-xr-x. 2 root root    23 Jul 24 14:59 virtual-host
[root@1st-kvm tuned]# pwd
/usr/lib/tuned

在這個目錄下,新建一個目錄,修改里面的tuned.conf來配置參數,最后用tuned-adm active來選擇這個定制的方案

[root@test tuned]# ls -R
.:
balanced  desktop  functions  latency-performance  network-latency  network-throughput  powersave  recommend.d  throughput-performance  virtual-guest  virtual-host

./balanced:
tuned.conf

./desktop:
tuned.conf

./latency-performance:
tuned.conf

./network-latency:
tuned.conf

./network-throughput:
tuned.conf

./powersave:
script.sh  tuned.conf

./recommend.d:
50-tuned.conf

./throughput-performance:
tuned.conf

./virtual-guest:
tuned.conf

./virtual-host:
tuned.conf
[root@test tuned]# pwd
/usr/lib/tuned

 

[root@test tuned]# cd network-throughput/
[root@test network-throughput]# cat tuned.conf
#
# tuned configuration
#

[main]
summary=Optimize for streaming network throughput, generally only necessary on older CPUs or 40G+ networks
include=throughput-performance

[sysctl]
# Increase kernel buffer size maximums.  Currently this seems only necessary at 40Gb speeds.
#
# The buffer tuning values below do not account for any potential hugepage allocation.
# Ensure that you do not oversubscribe system memory.
net.ipv4.tcp_rmem="4096 87380 16777216"
net.ipv4.tcp_wmem="4096 16384 16777216"
net.ipv4.udp_mem="3145728 4194304 16777216"

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM