Linux服務器CPU性能模式

環境:

  • 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

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.oracle

/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.app

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和減小磁盤預讀值。它沒有禁用磁盤屏障。ui

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
相關文章
相關標籤/搜索