Before going for this task my assumptions were as front - I was under impression that prctl command will do the temporary effect and will not remain across the reboot. This is what my understanding - prctl is an “on-the-fly” way to temporarily set Resource Control assignments & only after reboot modified parameter get permanent.
Then Alex replied explaining how exactly it works...
prctl, rcapadm modifies the running zone.
zonecfg defines the resource parameters of the zone when it boots.
So... To make a change dynamically you:
1) Update the zonecfg. The reason you do this is so that when rebooted it doesn't revert back to the old settings.
2) Use the prctl, rcapadm commands to modify the zone while it is online. The data you feed into prctl and rcapadm should match the changes you've made to zonecfg.
Below are the detail steps to add capped-memory to running container –
# zonecfg -z XXXXXX
zonecfg:XXXXXX> select capped-memory
zonecfg:XXXXXX:capped-memory> info
capped-memory:
physical: 1G
[swap: 2G]
[locked: 512M]
zonecfg:XXXXXX:capped-memory> set physical=2g
zonecfg:XXXXXX:capped-memory> set swap=3g
zonecfg:XXXXXX:capped-memory> info
capped-memory:
physical: 2G
[swap: 3G]
[locked: 512M]
zonecfg:XXXXXX:capped-memory> end
zonecfg:XXXXXX> exit
Now modify the zones runtime settings:
XXXXXX:/
# rcapadm -z XXXXXX -m 2048m
XXXXXX:/
# sleep 60
XXXXXX:/
# rcapstat -z 1 1
id zone nproc vm rss cap at avgat pg avgpg
9 XXXXXX - 434M 377M 2048M 0K 0K 0K 0K
10 XXXXXX - 452M 370M 2048M 0K 0K 0K 0K
14 XXXXXX - 532M 328M 2048M 0K 0K 0K 0K
XXXXXX:/
# prctl -n zone.max-swap -v 3g -t privileged -r -e deny -i zone XXXXXX
Then verify you're settings have taken effect:
XXXXXX:/
# zlogin XXXXXX
[Connected to zone 'XXXXXX' pts/9]
Last login: Wed Sep 16 06:34:27 from XXX.XXX.XX.XX
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
WARNING: YOU ARE SUPERUSER on XXXXXX!!
Your shell is /usr/bin/ksh
XXXXXX:/
# top -c
load averages: 1.36, 0.67, 0.59; up 101+08:46:15 08:55:12
51 processes: 50 sleeping, 1 on cpu
CPU states: 89.6% idle, 4.4% user, 6.1% kernel, 0.0% iowait, 0.0% swap
Memory: 2048M phys mem, 177M free mem, 3072M swap, 2627M free swap
It taught me a new lesson and at the same time I am still wondering “AM I KNOWING THIS BEFORE OR I WAS JUST LOST???” SHAME ON ME, VERY DISAPPOINTING HOWEVER THIS CONCEPT IS NOW GOT HARDCODED IN MY LITTLE BRAIN….
Thanks Alex, thanks a lot.
Hope this will help someone, somewhere!
No comments:
Post a Comment