Saturday, December 15, 2012

CAPPING MEMORY & SWAP ON SOLARIS CONTAINER

If you have multiple virtualization on one server which need similar amount of resource, it is important for you to setting resource on each virtualization system. On solaris container (virtualization on Solaris) as long as I know there are possibility to cap memory and swap.

Below is some step to do that.

Login to Global Zone as root

Run zonecfg command and fill zone_name with name of your solaris zone : 
# zonecfg -z zone_name

To show the configuration information about currently limit physical memory [and swap if any], type info :
zonecfg:zone_name> info
   ...
   capped-memory:
        physical: XX G
        [swap: XX G]
   ....

Capping memory and swap (put XX with value which depend on resource you have):
zonecfg:zone_name> select capped-memory
zonecfg:zone_name:capped-memory> set physical=XXG
zonecfg:zone_name:capped-memory> set swap=XXG
zonecfg:zone_name:capped-memory> end

To show the configuration information about currently limit physical memory [and swap if any] after setting:
zonecfg:zone_name> info
   ...
   capped-memory:
        physical: XX G
        [swap: XX G]
   ....

Exit from zonecfg command
zonecfg:zone_name> exit

Login to local zone, stop the application and database if any and restart local zone to take effect.
If you restart from local zone you can use init 6 command, but if you restart from global zone you can use this command (but remember to stop the application and database in local zone first):
# zoneadm -z  zone_name halt
# zoneadm -z  zone_name boot

No comments:

Post a Comment