第2章 操作系统管理策略
2.1.1 限制应用程序对CPU的使用率
2.1.1.1 安装WLM (Workload Manager)设置步骤
环境:RS6000,pSeries AIX
问题描述:
客户需要限制某些用户CPU和内存的使用率,可以通过设置WLM (Workload Manager)来实现.
解答:
步骤如下:
1.smit wlm
2.添加 class:
选择Add a class
Class name ftp
Description [cpu mem Intensive]
Inheritance [Yes]
Localshm
[Yes]
3.添加规则,
选择"Class assignment rules"
Create a new Rule
添加监控的用户,组以及应用的所在目录
Order of the rule 1
New Order of the rule [1]
Class name ftp
User [root]
Group [-]
Application [/usr/sbin/ftpd]
Type [-]
Tag
[-]
4.显示class
System
Default
Shared
ftp
5.Change / Show Characteristics of a class
指定cpu限制
CPU resource management -->
Class name ftp
Shares [-]
Minimum (%) [2]
Maximum (%) [5]
Absolute Maximum (%) [5]
指定memory限制
Memory resource management -->
Class name ftp
Shares [-]
Minimum (%) [2]
Maximum (%) [5]
Absolute Maximum (%) [5]
6.启动 WLM
smit wlm -->
Start/Stop/Update WLM -->
Start Workload Manager
Configuration, or for a set: set name/currently current
applicable configuration
Management mode active
Enforce Resource Set bindings Yes
Disable class total limits on resource usage Yes
Disable process total limits on resource usage Yes
Start now, at next boot, or both ? Now
7.验证WLM是否生效:
ftp 到服务器,执行以下命令:
put "|dd if=/dev/zero bs=32k count=10000" /dev/null
8.用命令检查WLM是否生效
wlmstat命令
#wlmstat
CLASS CPU MEM DKIO
Unclassified 0.00 27.93 0.00
Unmanaged 0.02 44.54 0.00
Default 0.12 6.43 0.00
Shared 0.00 3.12 0.00
System 14.38 50.05 0.00
ftp 0.00 0.01 0.00
TOTAL 14.50 87.54 0.00
topas命令
#topas -W
Topas Monitor for host: aix61haos1 Interval: 2 Tue Apr 7 15:19:32 2009
WLM-Class (Active) CPU% Mem% Blk-I/O%
ftp 7 0 0
System 3 50 0
Default 0 6 0
Unmanaged 0 45 0
Shared 0 3 0
Unclassified 0 28 0
svmon命令
#svmon -W ftp
======================================================================
Superclass Inuse Pin Pgsp Virtual
ftp 434 4 0 262
PageSize Inuse Pin Pgsp Virtual
s 4 KB 434 4 0 262
m 64 KB 0 0 0 0
以上说明cpu,内存使用率已经限定在指定范围内.
2.1.1.2 安装使用WLM充分发挥pSeries服务器的能力
只有AIX系统中提供的WLM(work load manager)是最完美的解决方案并可完全满足以上对系统资源调度策略的所有要求。WLM可以通过share和limit的设置,实现计算应用充分利用事务性应用变化的闲置资源,而又丝毫不影响事务性应用的运行。下面是一个设置实例。
首先建立class,本例中一个class是oracle,代表事务性应用,另一个是batch,代表计算应用。修改文件/etc/wlm/standard/rules为:
* class resvd user group application type tag
system - root - - - -
oracle - oracle - - - -
batch - batch - - - -
default - - - - - -
然后修改/etc/wlm/standard/limits文件:
system:
memory = 1%-100%;100%
batch:
CPU = 1%-10%;100%
oracle
CPU = 1%-90%;100%
再修改/etc/wlm/standard/shares:
batch:
CPU = 1
oracle:
CPU = 9