淺談linux性能調優之十二:紅帽優化策略Tuned
紅帽推出的一個動態調優方案,用戶能夠在不一樣的時間段內採用不一樣的調優方案。因爲以服務進程形式存在,就能夠很方便的和crontab結合!Tuned 是監控並收集各個系統組件用量數據的守護進程,並可以使用那些信息根據須要動態調整系統設置。它能夠對 CPU 和網絡使用的更改做出反應,並調整設置以提升活動設備的性能或者下降不活躍設備的電源消耗。
伴隨它的工具 ktune 結合 tuned-adm 工具提供大量預先配置的調整分析以便在大量具體使用案例中提升性能並下降能耗。編輯這些配置或者建立新配置可生成爲系統定製的性能解決方案。
安裝:yum install tuned -y
啓動:/etc/init.d/tuned start
/etc/init.d/ktune start
查看系統中對於不一樣應用場景的調優方案
[root@localhost Desktop]# tuned-adm list
Available profiles:
- default
- enterprise-storage
- server-powersave
- throughput-performance
- desktop-powersave
- laptop-ac-powersave
- latency-performance
- laptop-battery-powersave
- spindown-disk
Current active profile: default
使用某種profile
[root@localhost Desktop]# tuned-adm profile server-powersave
Stopping tuned: [ OK ]
Switching to profile 'server-powersave'
Applying ktune sysctl settings:
/etc/ktune.d/tunedadm.conf: [ OK ]
Calling '/etc/ktune.d/tunedadm.sh start': [ OK ]
Applying sysctl settings from /etc/sysctl.conf
Starting tuned: [ OK ]
關於一些profile的說明:
default
默認節電配置。這是最基本的節點配置。它只啓用磁盤和 CPU 插件。注:這與關閉 tuned-adm 不一樣,關閉該程序會同時禁用 tuned 和 ktune。
latency-performance
典型延遲性能調試的服務器配置。它禁用 tuned 和 ktune 節能機制。cpuspeed 模式改成 performance。每一個設備的 I/O 提高程序改成 deadline。對於服務的電源管理質量,將 cpu_dma_latency 設定爲 0。
throughput-performance
用於典型吞吐性能調整的服務器側寫。若是系統沒有企業級存儲則建議使用這個側寫。它與 latency-performance 相同,只是:
將 kernel.sched_min_granularity_ns(調度程序最小優先佔用時間間隔)設定爲 10 毫秒,
將kernel.sched_wakeup_granularity_ns(調度程序喚醒間隔時間)設定爲 15 毫秒。
將 vm.dirty_ratio(虛擬機髒數據比例)設定爲 40%,並啓用透明超大頁面。
enterprise-storage
建議最企業級服務器配置中使用這個側寫,其中包括電池備份控制程序緩存保護以及管理磁盤緩存。它與 throughput-performance 配置相似,只是文件系統要使用 barrier=0 從新掛載。
virtual-guest
建議最企業級服務器配置中使用這個側寫,其中包括電池備份控制程序緩存保護以及管理磁盤緩存。它與 throughput-performance 相似,只是:
將 readahead 值設定爲 4x,同時不使用 barrier=0 從新掛載的 root/boot 文件系統。
virtual-host
根據 enterprise-storage 配置,virtual-host 還可減小可置換的虛擬內存,並啓用更多集合髒頁寫回。您能夠在紅帽企業版 Linux 6.3 以及以後的版本中找到這個配置,同時推薦在虛擬化主機中使用這個配置,包括 KVM 和紅帽企業版 Linux 虛擬化主機。
配置文件:/etc/tune-profiles/ 不一樣的profile以目錄形式存在!
製做適合本身應用場景的調優方案:
cd /etc/tune-profiles;
cp -r enterprise-storage/ my-server;
cd my-server/
修改響應的配置文件,添加調優參數
歡迎關注本站公眾號,獲取更多信息