Creating a resource set

Using resource sets (rsets) is an effective way to isolate workloads from one another as far as the CPU is concerned. By separating two different workloads into two classes and giving each class a different subset of the CPUs, you can make sure that the two workloads never compete with each other for CPU resources, even though they still compete for physical memory and I/O bandwidth.

The simplest way to create a resource set is to use the SMIT interface (smit addrsetcntl fast path) or the mkrset command.

For instructional purposes, the following example illustrates each step of creating and naming a resource set on a 4-way system. Its goal is to create a resource set containing processors 0 to 2, and use it in WLM configuration to restrict all processes of a superclass to these three processors.

  1. With root authority, view the available building blocks (from which to create the resource sets) using the following command:
    lsrset -av
    The output for this example is the following:
    T  Name               Owner   Group   Mode    CPU  Memory  Resources    
    r  sys/sys0           root    system  r-----    4   98298  sys/sys0     
    r  sys/node.00000     root    system  r-----    4   98298  sys/sys0     
    r  sys/mem.00000      root    system  r-----    0   98298  sys/mem.00000
    r  sys/cpu.00003      root    system  r-----    1       0  sys/cpu.00003
    r  sys/cpu.00002      root    system  r-----    1       0  sys/cpu.00002
    r  sys/cpu.00001      root    system  r-----    1       0  sys/cpu.00001
    r  sys/cpu.00000      root    system  r-----    1       0  sys/cpu.00000
    In the output, sys/sys0 represents the whole system (in this case, a 4-way SMP). When a WLM class does not specify an rset attribute, this is the default set that its processes potentially can access.
  2. Create and name the resource set using the following SMIT fast path:
    smit addrsetcntl
    For this example, fill in the fields as follows:
    Name Space
    admin
    Resource Set Name
    proc0_2
    Resources
    Select from the list those lines that correspond to the memory and CPUs 0 to 2 (sys/cpu.00000 to sys.cpu.00002).
    All other fields
    Select from the lists.
    When you finish entering the fields and exit SMIT, the admin/proc0_2 rset is created in /etc/rsets.
  3. To use the new rset, add it into the kernel data structures using the following SMIT fast path:
    smit reloadrsetcntl
    This menu gives you the option to reload the database now, at next boot or both. Because this is the first time you are using the new resource set, select both so that this rset will be loaded now and after each reboot. (If you had changed an existing rset, you would probably have selected now.)
  4. Add the new rset to a WLM class using the following SMIT fast path:
    smit wlmclass_gal
    Select the class (in this example, super1) then select admin/proc0_2 from the list available for the Resource Set field. After you make your selection and exit SMIT, the classes file on disk is changed.
  5. Do one of the following:
    • If WLM is running, update the configuration using the following SMIT fast path:
      smit wlmupdate
    • If WLM is not running, start it using the following SMIT fast path:
      smit wlmstart
  6. Monitor the effect of the new resource set on the class. For example:
    1. Start 90 CPU loops (program executing an infinite loop) in class super1.
    2. Type wlmstat on the command line. The output for this example is the following
                     CLASS CPU MEM BIO
              Unclassified   0   0   0
                 Unmanaged   0   0   0
                   Default   8   0   0
                    Shared   0   0   0
                    System   0   0   0
                    super1  75   0   0
                    super2   0   0   0
          super2.Default     0   0   0
           super2.Shared     0   0   0
             super2.sub1     0   0   0
             super2.sub2     0   0   0

      This output shows that the 90 CPU bound processes, which otherwise unconstrained would take up 100% of the CPU, now use only 75% because the resource set limits them to run on CPUs 0 to 2.

    3. To verify what resource set a process (identified by its PID) has access to, use the following SMIT fast path:
      smit lsrsetproc

      Enter the PID of the process you are interested in or select it from the list. The following output is for one of the loop processes:

          CPU  Memory  Resources
            3   98298  sys/mem.00000 sys/cpu.00002 sys/cpu.00001 sys/cpu.00000

      However, a process from a class without a specified rset attribute uses the Default resource set that includes all processors except those processors that are part of an exclusive resource set. A process that does not belong to any class uses the System class (if it is a root process) or a Default class (if it is a nonroot process). Either of these classes might have resource sets that are defined for them.

      The following output is from the init process, which is in a class that does not specify a resource set:
          CPU  Memory  Resources
            4   98298  sys/sys0

At this point, your resource set exists and is being used by at least one class within WLM.

Note: WLM will not set its rset attachment for a process that currently has a bindprocessor subroutine binding or another rset attachment. When the other attachment no longer exists, WLM will assign its rset automatically.
Note: Resource sets can be created for any WLM class, which includes the Default and System classes.