Dynamically change zone capped memory

Display the zone’s current memory cap. If no cap is set the zone name will not appear in the output:

# rcapstat -z 1 1
    id zone            cappd  nproc     vm     rss    cap    at   avgat    pg   avgpg
     1 zone1              Yes         -   16G    16G   32G    0K      0K    0K        0K

using zonecfg:

# zonecfg -z zone1 info capped-memory
capped-memory:
    physical: 32G
    [swap: 8G]
    [locked: 
16G]

If the zone has no memory cap it will not appear in the above output.

Display the zone's current usage (see the last two columns to view the total cap and the percentage of the cap currently in use):

# zonestat -z zone1 -r memory 1 1
Collecting data for first interval…
Interval: 1, Duration: 0:00:01
PHYSICAL-MEMORY    SYSTEM MEMORY
mem_default              256G
                                  ZONE      USED    %USED     CAP      %CAP
                                  [total]     113G     44.4%         -            -
                                  [system]  27.9G    10.9%        -            -
                                  zone1     46.1G    18.0%  16.0G   72.0%

Solaris 10 - 11.1

# prctl -n zone.max-swap -v 48g -r -i zone zone1
# rcapadm -z zone1 -m 16g

Solaris 11.2 onwards

# zonecfg -z zone01
# zonecfg –z zone1
zonecfg:zone1> select capped-memory
zonecfg:zone1:capped-memory> set physical=24g
zonecfg:zone1:capped-memory> end
zonecfg:zone1> verify
zonecfg:zone1> commit
zonecfg:zone1> exit
zonecfg:zone01> commit
zonecfg:zone01> exit

# zoneadm -z zone1 apply
zone 'zone1': Checking: Adding 
capped-memory set physical=24g
zone 'zone1': Applying the changes


© John Hodson 2018