Wise people learn when they can; fools learn when they must - Arthur Wellesley

Sunday, 28 December 2014

Zones-9 [rctls / resource controls]





ZONES-9 [RESOURCE CONTROLS]

Great,

We had learned to assign mem & cpu to NGZ, but how we will check the utilization by NGZ

Rcapadm is command from which we can find and it relies on rcapd daemon

First we should enable the rcapadm

root@sol-test-1:>/# svcadm enable rcap

Enable the resource capping daemon so that it will be started now and also be started each time the system is booted

root@sol-test-1:>/# rcapadm -E

root@sol-test-1:>/# rcapstat -z 2 3  [3 samples on interval of 2 secs]
    id zone            nproc    vm   rss   cap    at avgat    pg avgpg
    17 newzone             -  212M  184M  500M    0K    0K    0K    0K
    17 newzone             -  212M  184M  500M    0K    0K    0K    0K
    17 newzone             -  212M  184M  500M    0K    0K    0K    0K\


[Plz refer man pages for the details about rcapadm]

We also have prstat –Z to monitor the zone

root@sol-test-1:>/# prstat -Z

[…………………]

ZONEID    NPROC  SWAP   RSS MEMORY      TIME  CPU ZONE
     0       53  250M  166M    16%   0:05:26 0.4% global
     1       32  217M  127M    12%   0:02:10 0.1% tzone4
    13       32  209M  196M    19%   0:01:32 0.0% clonedZone
    17       34  212M  185M    18%   0:00:32 0.0% newzone


OK… back to zone resources,

Previously we learned about zone resource capping, which needs reboot to take the changes in effect,

But what if we can’t reboot our zone but we must have to provide resource…


YES… HOT ADD/REDUCE OF MEM/CPU IS POSSIBLE…


root@sol-test-1:>/# zonecfg -z newzone info
capped-memory:
        physical: 500M
        [swap: 256M]
        [locked: 150M]

root@sol-test-1:>/# rcapadm -z newzone -m 300m

Here I had changed the ram size to 300mb

root@sol-test-1:>/# zonecfg -z newzone info |grep physical
        physical: e1000g0
        physical: e1000g0
        physical: 500M

But in zonecfg, it is still 500mb

Let’s check in the zone

bash-3.2# hostname
newzone
bash-3.2# prtconf -v |grep -i mem
prtconf: devinfo facility not available
Memory size: 300 Megabytes

Well… here it is changed

What does it mean?

It means that it is not persistent, just a reboot and it will back to value listed in zonecfg

Now change the SWAP on the fly,

root@sol-test-1:>/# prctl -n zone.max-swap -v 100m -r -e deny -i zone newzone

root@sol-test-1:>/# prctl -n zone.max-swap -i zone newzone
zone: 18: newzone
NAME    PRIVILEGE       VALUE    FLAG   ACTION                       RECIPIENT
zone.max-swap
        privileged       100MB      -   deny                                 -
        system          16.0EB    max   deny                                 -

-n         specifies the rctl name
-r         replaces the current value with the new value
-v         specifies a new value
-e         enables the specified action
-i         id type, Valid idtypes are process, task, project, or zone

        

root@sol-test-1:>/# prctl $$ |grep -i zone
zone.max-swap
zone.max-locked-memory
zone.max-shm-memory
zone.max-shm-ids
zone.max-sem-ids
zone.max-msg-ids
zone.max-lwps
zone.cpu-cap
zone.cpu-shares


RESOURCE TYPES

admin           Define the user name and the authorizations for that user for a given zone dedicated-cpu ncpus,importance
capped-cpu      ncpus
capped-memory   physical,swap,locked
fs              dir,special,raw,type,options
dataset         name
net             address,allowed-addressphysical,defrouter
device          match
rctl            name,value

The following zone-wide resource controls / rctls are available.

zone.cpu-cap
zone.cpu-shares      (preferred: cpu-shares)
zone.max-locked-memory
zone.max-lofi
zone.max-lwps        (preferred: max-lwps)
zone.max-msg-ids     (preferred: max-msg-ids)
zone.max-processes   (preferred: max-processes
zone.max-sem-ids     (preferred: max-sem-ids)
zone.max-shm-ids     (preferred: max-shm-ids)
zone.max-shm-memory  (preferred: max-shm-memory)
zone.max-swap




No comments:

Post a Comment