環境:
- Red Hat Enterprise Linux 4
- Red Hat Enterprise Linux 5
- Red Hat Enterprise Linux 6
- Red Hat Enterprise Linux 7
On RHEL4:
configure the cpu speed to run at MAX speed all the time by adding the following parameter into the file /etc/cpuspeed.conf and restart the cpuspeed service:
vim /etc/cpuspeed.conf
插入或修改:
OPTS="$OPTS -n -C -S \\"0 1\\""
/etc/init.d/cpuspeed restart
On RHEL 5:
add the above parameters to /etc/sysconfig/cpuspeed or use the performance governor by adding the following parameter to the /etc/sysconfig/cpuspeed file and restart the cpuspeed service:
vim /etc/sysconfig/cpuspeed
插入或修改:
GOVERNOR=performance
/etc/init.d/cpuspeed restart
On RHEL 6:
configure the performance cpuspeed governor as above for RHEL 5 and add the following kernel boot options and restart the server. More information available in the Low Latency Performance Tuning for Red Hat Enterprise Linux 6 article.
/etc/init.d/cpuspeed stop # 開啟性能模式
processor.max_cstate=1 intel_idle.max_cstate=0 idle=poll
On RHEL 7:
Red Hat recommends tuned profiles (which use the /dev/cpu_dma_latency interface) as they achieve measured equivalent performance without reboot requirement. More information available in the Low Latency Performance Tuning for Red Hat Enterprise Linux 7article.
yum install -y tuned # 安裝tuned工具
systemctl start/stop tuned # 啟動/停止tuned服務
systemctl enable/disable tuned # 自啟動/禁止自啟動
tuned服務的相關配置目錄:
/usr/lib/tuned/ # 原生的性能模式
├── balanced
│ └── tuned.conf
├── desktop
│ └── tuned.conf
├── functions
├── latency-performance
│ └── tuned.conf
├── network-latency
│ └── tuned.conf
├── network-throughput
│ └── tuned.conf
├── powersave
│ ├── script.sh
│ └── tuned.conf
├── recommend.conf
├── throughput-performance
│ └── tuned.conf
├── virtual-guest
│ └── tuned.conf
└── virtual-host
└── tuned.conf
/etc/tuned # DIY的性能模式
├── active_profile # 當前的性能模式
├── bootcmdline
└── tuned-main.conf
tuned-adm list # 顯示host上能運行的性能模式
Available profiles:
- balanced # 平衡模式
- desktop
- latency-performance # 低延遲的性能模式
- network-latency
- network-throughput
- powersave # 節能模式
- throughput-performance # 高吞吐量優化模式
- virtual-guest # 虛擬客人模式
- virtual-host
- oracle # oracle模式
常用模式介紹:
balanced
它的目的是成為性能和功耗之間的折衷。它試圖盡量使用自動調節。它有好的結果對於大多數負載。唯一的缺點是增加了延遲。在當前調釋放它使CPU、磁盤、音頻和視頻插件和激活ondemand調控器。radeon_powersave設置為自動。
latency-performance
低延遲的性能模式。它禁用電能節約機制,使sysctl設置提高延遲。CPU調節器將性能低的CPU鎖定C狀態(通過PM QoS)。
throughput-performance
高吞吐量優化模式。它禁用電能節約機制,使sysctl設置提高吞吐量性能的磁盤、網絡IO和轉向最后期限的調度器。CPU調試器設置為性能模式。
virtual-guest
基於企業存儲配置文件,在其他任務,增加虛擬內存swappiness和減少磁盤預讀值。它沒有禁用磁盤屏障。
oracle
基於throughput-performance模式,它另外禁用透明的巨大的頁面和修改內核參數相關的一些其他性能。這個配置文件是由tuned-profiles-oracle包。在6.8及以后版本可用。
tuned-adm active # 顯示host的當前性能模式
- Current active profile: latency-performance
tuned-adm profile latency-performance # 切換至性能模式
tuned-adm off