Continuous Memory Optimization

The continuous memory optimization program runs page consolidation and promotion dynamically.

Dynamic Variable Page Size Support

The capability of AIX® Version 6.1 to combine the conservative memory usage of 4 KB page size in sparsely referenced memory regions with the performance benefits of 64 KB page size in densely referenced memory regions, automatically without user intervention is termed as dynamic variable page size support (DVPSS).

DVPSS is based on the capability of POWER6® to support mixed page sizes within a single segment. The architecture supports various permutations of different page sizes; however POWER6 supports combining 4 KB and 64 KB page sizes.

The default setting for a variable page size segment is 4 KB pages and 4 KB translations in a 64 KB sized and aligned region until all the 16 4 KB pages are referenced. When all the 16 pages are referenced, DVPSS checks the state to have the same state (such as same read or write page protection, no execution protection, storage key protection, and not in I/O state). If they do, then 4 KB translations are removed and replaced with a 64 KB translation.

Continuous Program Optimization Agent (CPOagent)

The limitation in supporting the DVPPS method by the operating system is that all 16 4 KB pages must be referenced before promoting page size to 64 KB. The CPOagent helps to overcome this limitation by using continuous memory optimization that performs page consolidation and promotion dynamically. This feature applies to AIX 6.1 Technology level 6 and above.

You can access CPOagent at:

usr/lib/perf/CPOagent

Syntax

CPOagent [-f configuration file]

Flag

Item Description
-f Changes the default configuration file name. If this option is not specified, the file name is assumed to be available at /usr/lib/perf/CPOagent.cf file location.
The CPOagent does not run, by default. The root user can start the CPOagent explicitly. When started, the CPOagent runs in the background to identify the candidate processes that can benefit from larger page sizes. The candidate processes are identified based on the memory and processor usage exceeding the specified threshold value.
Note: The CPOagent currently can promote page size to 64 KB.

CPOagent Configuration File

When CPOagent is started, it reads and parses the information in the configuration file. The configuration file is a stanza file with fields that includes:
TCPU=<n1>
TMEM=<n2>
PATI=<n3>
PATM=<n4>
PPTS=<n5>
TOPM=<n6>
PFLR=<c>

The description of fields in the configuration file follows:

Fields Description
TCPU Specifies the CPU usage threshold per process, in percentage

Default: 25

Minimum: 10

Maximum: 100

TMEM Specifies the memory usage threshold per process, in MB

Default: 1

Minimum: 1

PATI Specifies the page analysis time interval (PATI), in minutes. It specifies the time interval at which candidate processes are analyzed to identify the pages that can be consolidated and promoted to a higher size.

Default: 15

Minimum: 5

Maximum: 60

PATM Specifies the page analysis time monitor (PATM), in seconds. It specifies the amount of time page usage statistics to be collected for identifying candidate pages for page consolidation and promotion.

Default: 30

Minimum: 5

Maximum: 180

PPTS Specifies the page promotion trigger samples (PPTS). It specifies the number of samples to be collected before triggering a page promotion.

Default: 4

Minimum: 4

TOPM Specifies the number of top CPU consuming processes per CPU that must be considered for page consolidation and promotion.

Default: 2

Minimum: 1

PFLR Specifies the wildcard and the process that matches the wildcard are considered by CPOagent for page consolidation and promotion. It is referred as process filter wildcard (PFLR).

Advantages of using CPOagent

The advantage of using the CPOagent mechanism includes:
  • Applications are transparent to the changes. Therefore, there is no need to make changes to the applications.
  • The page promotion is run based on the policies set by the administrator in CPOagent.cf file, which is dependent on the workload demand on CPU and memory resources. This helps in efficient page promotion. This process allows fine granularity of control over dynamic variable page size support ensuring that page promotion is run for those applications with a requirement.
A sample scenario
Consider an application, StressEngine that is running on a system. The application has high CPU and Memory consumption. Without CPOagent, the StressEngine application cannot exploit dynamic variable page size support, until all 16 pages of a specific segment are referenced and the pages are in same state. The page size can be checked with the process report generated by the svmon command.
# svmon -P 8454254 -O pgsz=on,unit=MB,segment=on
Unit: MB
-------------------------------------------------------------------------------
     Pid Command          Inuse      Pin     Pgsp  Virtual
 8454254 StressEngine	  157.87     42.3        0   157.84

     PageSize                Inuse        Pin       Pgsp    Virtual
     s    4 KB                64.2       0.02          0       64.2
     m   64 KB                93.7       42.3          0       93.7

    Vsid      Esid Type Description              PSize  Inuse   Pin Pgsp Virtual
  86f49b         2 work process private              s   64.1  0.02    0    64.1
    9000         d work shared library text          m   47.9     0    0    47.9
    8002         0 work fork tree                    m   45.8  42.3    0    45.8
                   children=939b1c, 0
  80fdc3         f work shared library data          s   0.09     0    0    0.09
  85fd37         1 clnt code,/dev/hd1:10             s   0.02     0    -       -
If the CPOagent is started, and it has the following sample CPOagent.cf file
--------------------------------------------
TCPU=25
TMEM=50
PATI=15
PATM=30
PPTS=4
TOPM=2
PFLR=Stress*
--------------------------------------------
According to the configuration file, CPOagent cycles for 15 minutes (PATI =15). For a specific 15 minutes interval, it monitors the CPU and memory usage of the process that are running. Top 2 processes (TOPM =2) with the process name having Stress (PFLR = Stress*), CPU Usage exceeding 25% (TCPU = 25), and memory usage exceeding 50 MB (TMEM = 50) are the candidates for page consolidation and promotion. This process verifies by collecting four samples (PPTS = 4) before triggering the algorithm for page consolidation and promotion. Additionally, the page usage statistics is collected for 30 seconds (PATM =30) to identify the candidate pages for page consolidation and promotion. Now with CPOagent running, it will not wait for all 16 pages of a specific segment to be referenced. CPOagent evaluates if the application needs Page Consolidation and promotion by referring to the CPOagent.cf configuration file and the application’s demand on CPU and Memory resources. The promoted pages are evident from the process report generated by the svmon command.
# svmon -P 8454254 -O pgsz=on,unit=MB,segment=on
Unit: MB
-------------------------------------------------------------------------------
     Pid Command          Inuse      Pin     Pgsp  Virtual
 8454254 StressEngine	   157.87     42.3        0   157.84

     PageSize                Inuse        Pin       Pgsp    Virtual
     s    4 KB                64.2       0.02          0       64.2
     m   64 KB                93.7       42.3          0       93.7

    Vsid      Esid Type Description              PSize  Inuse   Pin Pgsp Virtual
  86f49b         2 work process private             sm   64.1   0.02    0    64.1
    9000         d work shared library text          m   47.9      0    0    47.9
    8002         0 work fork tree                    m   45.8   42.3    0    45.8
                   children=939b1c, 0
  80fdc3         f work shared library data         sm   0.09      0    0    0.09
  85fd37         1 clnt code,/dev/hd1:10             s   0.02      0    -       -