Computer Hardware User Manual

Version 3.1-en Solaris 10 Container Guide - 3.1 5. Cookbooks Effective: 30/11/2009
5.5.10. Limiting the physical main memory consumption of a project
[dd] To limit the physical main memory of a project, the resource capping daemon rc apd(1 M) can
be used. If the resident set size (RSS) of a project exceeds the capping target (rc ap.ma x -rss in
bytes), r capd reduces the RSS and swaps used memory pages to the paging device. rc apd is
configured by rcapad m (1M) and monitored with rcaps tat(1 ) . The rcapd can be used in
zones in connection with projects and can limit the physical main memory consumption of a project
within a zone.
It is recommended to limit virtual memory (called swap) first and then considering a limit for physical
main memory, since this limit is a hard limit and is noticed more quickly in case of a misconfiguration
(f.e. 20 GB cache for the database instead of 2 GB). In such a case, the sole limitation of physical
memory consumption would have an extreme effect on the performance of this zone and potentially
affect other zones as well.
5.5.11. Implementing memory resource management for zones
[dd] According to 4.6.3 Limiting memory resources , the virtual, physical and locked main memory of a
zone can be limited starting with Solaris 10 8/07. The configuration for this takes place in the zone
configuration.
global # zonecfg -z zone1
zonecfg:zone1> add capped-memory
zonecfg:zone1:capped-memory> set physical=50m
zonecfg:zone1:capped-memory> set swap=200m
zonecfg:zone1:capped-memory> set locked=20m
zonecfg:zone1:capped-memory> end
zonecfg:zone1> commit
zonecfg:zone1> exit
The configuration of capping parameters for a zone and restart of a zone leads to the automatic start-
up of the rc apd daemon in the global zone, which undertakes resource management. The activity
of r capd can be observed with rc apsta t -z.
global # rcapstat -z
id zone nproc vm rss cap at avgat pg avgpg
21 zone1 29 42M 57M 50M 12M 0K 8584K 0K
21 zone1 29 42M 57M 50M 6752K 0K 6712K 0K
21 zone1 - 26M 29M 50M 0K 0K 0K 0K
21 zone1 - 26M 29M 50M 0K 0K 0K 0K
id zone nproc vm rss cap at avgat pg avgpg
21 zone1 - 18M 22M 50M 0K 0K 0K 0K
21 zone1 - 17M 18M 50M 0K 0K 0K 0K
id zone nproc vm rss cap at avgat pg avgpg
22 zone1 29 42M 57M 50M 12M 0K 8672K 0K
22 zone1 29 42M 57M 50M 10M 0K 7776K 0K
22 zone1 - 42M 43M 50M 0K 0K 0K 0K
Memory capping settings with z onecf g are static. If changes to the settings during the zone's
runtime are required, they can be carried out using the command rcap a dm without rebooting the
zone.
rcapadm -z zone1 -m 40m
110