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 /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
posted @ 2018-09-06 11:41  发喜小爹  阅读(8158)  评论(0编辑  收藏  举报