Optimizing for throughput
This topic briefly describes how the variables mentioned in the listings in this section are calculated.
For complete configuration file listings, refer to cpuplugd configuration files.
The first test series was aimed at reaching a throughput close to the manual sized case. The following rules are analyzed:
MEMPLUG="pgscanrate > 20" # kswapd + direct scansMEMUNPLUG="(meminfo.MemFree > meminfo.MemTotal / 10) | (cache > meminfo.MemTotal / 2)"Memory is increased if the page scan rate (normal and direct page scans) exceeds 20 pages/sec. Memory is reduced if more than 10% of the total memory is free or if memory of the types cache and buffers exceeds 50% of the total memory. The rules use the values the variables have during the current interval.
CMM_INC="(meminfo.MemFree + cache) / 40"CMM_DEC="meminfo.MemTotal / 40"
/proc/meminfo.MEMPLUG="pgscanrate > 20" # kswapd + direct scansMEMUNPLUG="meminfo.MemFree > meminfo.MemTotal / 10 "Memory is increased if the page scan rate (normal and direct page scans) exceeds 20 pages/sec. Memory is reduced if more than 10% of the total memory is free. The rules use the values the variables have during the current interval.
The CMM pool increments are defined as:
CMM_INC="meminfo.MemFree / 40"CMM_DEC="meminfo.MemTotal / 40"
Memory configuration 3 (plug: page scan, unplug: free memory + page cache). The plugging rules are:
MEMPLUG="pgscanrate > 20" # kswapd + direct scansMEMUNPLUG="(meminfo.MemFree + avail_cache) > ( meminfo.MemTotal / 10)"Memory is increased if the page scan rate (normal and direct page scans) exceeds 20 pages/sec. Memory is reduced if the sum of free memory and page cache (avail_cache=cache- shared memory) exceeds 10% of the total memory. The rules use the values the variables have during the current interval.
CMM_INC="meminfo.MemFree / 40"CMM_DEC="meminfo.MemTotal / 40"
Memory configuration 4 (plug: direct scan, unplug: free memory + page cache). The plugging rules are:
MEMPLUG="pgscanrate > 20" # direct scans only!MEMUNPLUG="(meminfo.MemFree + avail_cache) > ( meminfo.MemTotal / 10)"
Memory is increased if the direct page scan rate exceeds 20 pages per second. Memory is reduced if the sum of free memory the page cache exceeds 10% of the total memory. The rules use the values the variables have during the current interval.
CMM_INC="meminfo.MemFree / 40"CMM_DEC="meminfo.MemTotal / 40"
Memory configuration 5 (plug: page scan vs steal, unplug: free memory + page cache). The plugging rules are:
MEMPLUG="pgscanrate > pgstealrate" # kswapd + direct scansMEMUNPLUG="(meminfo.MemFree + avail_cache) > ( meminfo.MemTotal / 10)"
Memory is increased if the page scan rate exceeds the page steal rate. Memory is reduced if the sum of free memory and page cache exceeds 10% of the total memory. The page scan rate exceeding the page steal rate indicates high memory usage while not all unused pages are consolidated at the end of the lists used for memory management. The strength of this rule is limited, and lies between normal pages scans a direct page scans. The system is no longer relaxed. The rules use the values the variables have during the last two intervals.
CMM_INC="meminfo.MemFree / 40"CMM_DEC="meminfo.MemTotal / 40"
| Increase memory, if | Shrink memory, if | Relative TPS* | Relative LPAR CPU load* | Guest size [MiB]* | ||||
|---|---|---|---|---|---|---|---|---|
| Configuration | Parameter | Rate [pages/sec] | Memory type | % of total memory | Linux™ | z/VM® | ||
| 1 | page scans | > 20 | free (cache + buffers) | > 10% or > 50% | 97% | 99% | 132% | 115% |
| 2 | page scans | > 20 | free | > 10% | 97% | 98% | 131% | 107% |
| 3 | page scans | > 20 | free + page cache | > 10% | 96% | 99% | 120% | 114% |
| 4 | direct scans | > 20 | free + page cache | > 10% | 96% | 99% | 109% | 105% |
| 5 | page scans | > page steal | free + page cache | > 10% | 95% | 97% | 118% | 105% |
| *100% is the manual sized run | higher is better | lower is better | closer to 100% is better | |||||
Observation
The CPU load varies only slightly between scenarios. It is slightly lower than the manually sized run, but follows the throughput. The throughput also only varies slightly. Configuration 5 provides the lowest throughput and therefore the lowest CPU load. The resulting memory sizes are higher than the manually sized run.
Configurations 1 to 3 vary only the UNPLUG rule. It seems that the rule which uses page cache and free memory as a parameter to determine whether memory can be reduced (configuration 3) provides the smallest memory size at relatively high throughput values. In runs using the number of direct pages scans instead of kswapd page scans the system size is reduced further without additional impact on throughput or CPU load.
The VM view, which represents the real allocation of physical memory, typically shows lower values, which are much closer together than the Linux memory sizes.
Conclusion
The combination of using direct page scan rates to increase memory and using free memory and page cache to reduce memory is very suitable for memory management. It provides a throughput and memory size very close to the manually sized configuration. Interestingly, the plug and the unplug rules influence the system size. The expectation was that the plug rule would have no effect unless the system load changes.
It is expected that the smallest system results from using the direct scan rate instead of kswapd page scans for plugging memory, because direct scans are an indicator for a higher memory pressure. meaning the system tolerates a higher memory pressure before increasing memory.
Configuration 4 impacts throughput only slightly (-4%), but results in a memory size that is 9% larger than the manually sized configuration. This finding indicates that it is likely to be difficult to optimize both throughput and memory size at the same time.