User Tools

Site Tools


aix:workloadmanager

Worload Manager to limit processes

AIX wokload manager can be used to limit processes usage (CPU, IO, and memory)

processes are classified by user, process name, ….

Then rules are applied to each class

Some classes exists by default, but you can create additional, for example for DB2, Oracle….

WLM definitions are stored into /etc/wlm/, you can use smit wlm

Before applying a workload, try it in passive mode, and check the load on each class

root@prod /root> wlmcntrl -p

Watch using wlmstat

root@prod /root> wlmstat
         CLASS    CPU    MEM   DKIO
  Unclassified   0.00   0.18   0.00
     Unmanaged   0.01  26.58   0.00
       Default   1.18  50.09   2.13
        Shared   0.00   7.18   0.00
        System   0.66  34.50   3.69
         TOTAL   1.84  91.95   5.82
root@prod /root> wlmcntrl -q
WLM is stopped

root@prod /root> wlmcntrl -a

root@prod /root> wlmcntrl -q
WLM is running

root@prod /root> wlmstat
         CLASS    CPU    MEM   DKIO
  Unclassified   0.00  20.54   0.00
     Unmanaged   0.00   9.04   0.00
       Default   2.25   4.38   0.00
        Shared   0.00   0.76   0.00
        System   1.12   2.41   0.35
         TOTAL   3.37  28.09   0.35
root@prod /root> lsclass -f
System:
        memorymin = 1
Default:
Shared: 

To monitor you can also use:

wlmstat 3 100
nmon (then option W)
topas
root@prod /root> topas –W
Topas Monitor for host: srv-aix-001nterval: 2      Fri Apr 17 09:08:56 2015
WLM-Class (Passive)             CPU%      Mem%     Blk-I/O%
clBP1                        24.70     30.67         1.31
System                          0.59     34.76         0.00
clPX6                        10.12     14.86         0.00
Default                         0.03      4.48         0.00
Unmanaged                       0.01     26.58         0.00
Shared                          0.00      7.18         0.00
Unclassified                    0.00      0.18         0.00

Check your process class

root@prod /root> ps -ae -o pid,user,class,args,pcpu,vsz
     PID     USER CLASS        COMMAND                           %CPU   VSZ                                                                                      
       1     root System       /etc/init                         0.0   804                                                                                                                 
  590300     root System       /usr/sbin/syncd 60                0.0   596                                                                                                                 
 2621880     root System       /usr/ccs/bin/shlap64              0.0   392                                                                                                                 
 3867110     root System       /usr/lib/errdemon                 0.0   928                                                                                                                 
 4325632     root System       /usr/sbin/srcmstr                 0.0   816                                                                                                                 
 5570884     root Default      iostat -Dsal 60 1                 0.0   844                                                                                                                 
 5636536     root System       /usr/sbin/xntpd                   0.0   388                                                                                                                 
 5833142     root System       /usr/sbin/syslogd -r -n           0.0   820                                                                                                                 
 5898680     root System       /usr/sbin/portmap                 2.0  1004                                                                                                                 
 5964220     root System       /usr/sbin/aso                     0.0  1396                                                                                                                 
 6029626      mqm Default      sshd: mqm@pts/1                   0.1  1188                                                                                                                 
 6095302     root System       /usr/sbin/biod 6                  0.0   120                                                                                                                 
 6423002     root System       /usr/sbin/pfcdaemon               0.0  1172                                                                                                                 
 6488524     root System       /usr/sbin/nfsrgyd                 3.0  1352                                                                                                                 
 6816036     root System       /opt/rsct/bin/IBM.DRMd            0.0  1696                                                                                                                 
 6881784     root System       /usr/sbin/sshd                    0.0  1196                                                                                                                 

Print memory in MB

root@prod /root> ps -ae -o pid,user,class,pcpu,vsz,args | awk '{$5=int(100 * $5/1024)/100"MB";}{ print;}'
PID USER CLASS %CPU 0MB COMMAND
1 root System 0.0 0.8MB /etc/init
2884068 root System 0.0 0.58MB /usr/sbin/syncd 60
3342724 root System 0.0 0.38MB /usr/ccs/bin/shlap64
3604962 root System 0.0 0.9MB /usr/lib/errdemon
Switch in WLM in to active mode. Active means monitor and possibly controlling class resource (if you assign shares):

wlmctrl -a
Alternatively, start in passive mode (monitor only and no possibility of changing the behavior):

wlmctrl -p
Create four new classes for RDBMS, Batch, Backup and remote user connection application:
A simple edit to the test file as the root user:  /etc/wlm/current/classes
Name the class and specify how AIX can decide which processes are in which class. A simple way is to name the AIX user that starts the workload programs. Alternatives, are using user groups or the directories that contain the binary program files. Once a process is in a class, the default setting is for all processes it creates are in the same class.

Tell AIX WLM to reevaluate ("u" for update) the classes file:
wlmcntrl -u


       -a
            Starts WLM in active mode or switches from passive to active mode. This is the default when no flag other than -d, -g, or -T is specified.
       -c
            Starts WLM in processor-only mode or switches from any mode to processor-only mode. In this mode, the WLM accounts for all resources, but only processor resource is regulated.
       -d Config_dir
            Uses /etc/wlm/Config_dir as an alternate directory for the WLM configuration (containing the classes, limits, shares and rules files) or configuration set (containing the list of configurations
            and the time tanges when they apply). This makes /etc/wlm/Config_dir the current configuration. This flag is effective when starting the WLM in active, processor-only or passive mode, or when
            updating the WLM. This flag cannot be used in conjunction with the -o and -q flags or when switching from a mode (among active, processor-only and passive) to another.
       -g
            Instructs WLM to ignore any potential resource set bindings. This means that all classes have access to the whole resource set of the system, regardless of whether or not they use a restricted
            resource set.

       -o
            Stops Workload Manager.
       -p
            Start WLM in passive mode or switches from any mode to passive mode. In this mode, the WLM accounts for all resources, but no resource is regulated.
       -q

List classes and limits class

root@prod /root> lsclass -C
#name:description:tier:inheritance:authuser:authgroup:adminuser:admingroup:rset:CPUshares:CPUmin:CPUsoftmax:CPUhardmax:memoryshares:memorymin:memorysoftmax:memoryhardmax:diskIOshares:diskIOmin:diskIOsoftmax:diskIOhardmax:totalCPUhardmax:totalCPUunit:totalDiskIOhardmax:totalDiskIOunit:totalConnecttimehardmax:totalConnecttimeunit:totalProcesseshardmax:totalThreadshardmax:totalLoginshardmax:classRealMem:classRealMemunit:classVirtMem:classVirtMemunit:classLargePages:classLargePagesunit:procVirtMem:procVirtMemunit:localshm:vmenforce:delshm:iopriority
System::0:no::::::-:0:100:100:-:1:100:100:-:0:100:100:-:s:-:KB:-:s:-:-:-:-:MB:-:MB:-:MB:-:MB:no:proc:no:0
Default::0:no::::::-:0:100:100:-:0:100:100:-:0:100:100:-:s:-:KB:-:s:-:-:-:-:MB:-:MB:-:MB:-:MB:no:proc:no:0
Shared::0:no::::::-:0:100:100:-:0:100:100:-:0:100:100:-:s:-:KB:-:s:-:-:-:-:MB:-:MB:-:MB:-:MB:no:proc:no:0

Commands to manage classes: mkclass, chclass, rmclass …

Command Description Usage
mkclass Creates a WLM classmkclass <class name> ; mkclass -a inheritance=yes -a localshm =yes <class name>
wlmassign Assigns a process to a WLM class wlmassign <class name> <process id>
lsclass Returns the list of superclasses lsclass
wlmcheck Checks WLM settings wlmcheck
rmclass Removes a WLM class rmclass <class name>
wlmcntrl -p Starts WLM in passive modewlmcntrl -p
wlmcntrl -a Starts WLM in active mode wlmcntrl -a
wlmcntrl -o Stops WLM wlmcntr -o
wlmcntrl -u Update WLM (refresh after modifications) wlmcntr -u

Monitoring

Multiple tools to monitor WLM

Here example of the class app1

[p630n02][/work]> acctcom -w | grep app1
prog1 user1 app1.Default pts/2 12:02:48 12:05:22 154.12 144.55 10008.00
prog1 user1 app1.Default pts/2 12:05:42 12:07:19 97.16 111.80 7705.00
prog1 user1 app1.Default pts/2 12:09:27 12:10:04 37.20 32.22 4370.00
prog1 user1 app1.Default pts/2 12:10:14 12:14:42 268.50 233.17 10256.00
prog1 user1 app1.Default pts/2 12:17:51 12:20:45 174.62 250.88 13296.00
[p630n02][/work]> acctcom -c app1
COMMAND START END REAL CPU MEAN
NAME USER TTYNAME TIME TIME (SECS) (SECS) SIZE(K)
prog1 user1 pts/2 12:02:48 12:05:22 154.12 144.55 10008.00
prog1 user1 pts/2 12:05:42 12:07:19 97.16 111.80 7705.00
prog1 user1 pts/2 12:09:27 12:10:04 37.20 32.22 4370.00
prog1 user1 pts/2 12:10:14 12:14:42 268.50 233.17 10256.00

Topas

[p630n02][/work]> topas -W
Topas Monitor for host: p630n02 Interval: 2 Mon Oct 25 15:13:04
2004
WLM-Class (Passive) CPU% Mem% Disk-I/O%
app1                  47    1         0
app2                  23    0         0
app3                  12   55         0
System                 0    7         0
Shared                 0    1         0
Default                0    0         0
Unmanaged              0   14         0
Unclassified           0    0         0

wlmstat

p630n02][/etc/wlm/current]> wlmstat
CLASS       CPU MEM DKIO
Unmanaged     0  14    0
Default       0   0    0
Shared        0   1    0
System        0   7    0
app1         44   1    0
app2         22   0    0
app3          8  55    0
TOTAL        74  64    0
[p630n02][/etc/wlm/current]> wlmstat -Svc
CLASS tr i #pr CPU sha min smx hmx des rap urap pri
Unmanaged 0 0 0 0 -1 0 100 100 100 100 0 10
Default 0 0 0 0 -1 0 100 100 100 100 0 0
Shared 0 0 0 0 -1 0 100 100 100 100 0 0
System 0 0 80 0 -1 0 100 100 100 100 0 0
app1 0 1 2 43 -1 0 100 100 100 100 0 0
app2 0 1 2 19 -1 0 100 100 100 100 0 0
app3 0 1 1 06 -1 0 100 100 100 100 0 0

Example of config

root@aixtest /etc/wlm/current> cat /etc/wlm/current/classes
System:

Default:

splunk:
        inheritance = "yes"
        authuser = "splunk"

root@aixtest /etc/wlm/current> cat /etc/wlm/current/limits
System:
        memory = 1%-100%;100%
splunk:
        CPU    = 0%-10%;10%

root@aixtest /etc/wlm/current> cat /etc/wlm/current/rules
* class resvd user group application type tag
splunk   -    splunk -    -           -   -
System   -    root   -    -           -   -
Default  -    -      -    -           -   -

root@aixtest /etc/wlm/current> cat /etc/wlm/current/shares
* IBM_PROLOG_BEGIN_TAG
aix/workloadmanager.txt · Last modified: 2024/04/08 18:01 by manu