If you want to cap the usage of memory for a zone, follow below steps:-
Here we will ensure that zone(zcldvdas) doesn't use more than 3072mb memory.
# zonecfg -z zcldvdas zonecfg:zcldvdas> add capped-memory zonecfg:zcldvdas:capped-memory> set physical=3072m zonecfg:zcldvdas:capped-memory> end zonecfg:zcldvdas> verify zonecfg:zcldvdas> commit zonecfg:zcldvdas> exit
Now if you want to dedicate 3072mb memory to a zone so that it's always available only to this zone. Follow below steps:-
# zonecfg -z zcldvdas zonecfg:zcldvdas> add capped-memory zonecfg:zcldvdas:capped-memory> set locked=3072m zonecfg:zcldvdas:capped-memory> end zonecfg:zcldvdas> verify zonecfg:zcldvdas> commit zonecfg:zcldvdas> exit
You can also use a combination of physical and locked to assign max and min memory to a zone.
In the next example we are assigning maximum memory the zone can use as 3072mb while minimum 1024mb which should always be available to zone.
# zonecfg -z zcldvdas zonecfg:zcldvdas> add capped-memory zonecfg:zcldvdas:capped-memory> set physical=3072m zonecfg:zcldvdas:capped-memory> set locked=1024m zonecfg:zcldvdas:capped-memory> end zonecfg:zcldvdas> verify zonecfg:zcldvdas> commit zonecfg:zcldvdas> exit
This change will be effective after reboot of the local zone.
zoneadm -z zcldvdas reboot
From Solaris10u4 onwards you can cap the memory online also using rcapadm.
rcapadm -z zcldvdas -m 3G
But remember the changes made my rcapadm are not persistent across reboot so you will still have to make the entry in zonecfg as discussed above.
You can view the set memory using rcapstat from Global Zone.
rcapstat -z 2 5
From local zone you can check this with prtconf.
prtconf -vp | grep Mem
No comments:
Post a Comment