Resource management in solaris zones : CPU shares, capped CPU, Dedicated CPU assignment
Resource management in solaris zones : Dynamic Resource pools
Resource management in solaris zones : Capped memory
Be default when you create a solaris zone, it will take up all the CPU and memory resources from the global zone. There are ways to limit the memory utilized by zones. The resource capping daemon makes it possible to limit the memory used by zones. Also it is possible to change the memory and swap allocation to a zone online without rebooting it.
Capped memory
The rcapd daemon takes care of the memory caps and its administration. add capped-memory in zone configuration sets the capped memory for a particular zone. For the capped memory to take effect you need to reboot the zone. The parameters physical, swap and locked are all optional but atleast one parameter should be used. After adding a capped memory zone01 will use a physical memory of 50 MB from global zone and use a swap space of 100 MB. The locked (30m) parameter specifies the minimum amount of physical memory always available to zone01 from global zone. Before assigning memory caps to a zone, make sure the rcapd daemon is working and if not start it :
global # svcadm enable rcap global # rcapadm -E
Enter the zone configuration mode to add the memory caps to zone01 :
global # zonecfg -z zone01 zonecfg:zone01> add capped-memory zonecfg:zone01:capped-memory> set physical=50m zonecfg:zone01:capped-memory> set swap=100m zonecfg:zone01:capped-memory> set locked=30m zonecfg:zone01:capped-memory> end
This requires a reboot to take effect. After reboot to check the allocation of capped memory :
global # zoneadm -z zone01 reboot
global # zonecfg -z zone01 info
root@zone01:~# swap -l swapfile dev swaplo blocks free /dev/swap - 8 204800 104600
204800 in blocks comes out to be 100 MB. To check physical memory assigned to the zone
root@zone01:~# prtconf -vp | grep Mem prtconf: openprom facility not available Memory size: 50 Megabytes
Modifying capped-memory and swap without rebooting zone
Starting solaris 10 u4 We can modify the capped-memory and swap assigned to a zone , without rebooting it. To change the capped memory to a zone :
global # rcapadm -z myzone -m 12G
To modify the swap space allocated to a zone :
global # prctl -n zone.max-swap -v 2g -t privileged -r -e deny -i zone myzone
I hope the post was informative. Do subscribe to stay updated.
Resource management in solaris zones : CPU shares, capped CPU, Dedicated CPU assignment
Resource management in solaris zones : Dynamic Resource pools
Resource management in solaris zones : Capped memory