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

Sunday, 28 December 2014

Zones-8 [Addition IP / Resource Capping]


                    
Well…

Done with basic create / modify /delete a NGZ?

Let’s play some more

Did u wondered till now we just created the zones,

Never bothered about

·         What is the ram size?
·         What is swap size?
·         What is CPU capability?
·         What if NGZ starts eating ram & CPU?


Well … Now it’s time to consider these stuffs…. But before that just see how to add additional ip in NGZ,

root@sol-test-1:>/# ifconfig e1000g0:3 plumb
root@sol-test-1:>/# ifconfig e1000g0:3 inet 192.168.234.211 netmask 255.255.255.0 zone newzone

root@sol-test-1:>/# ifconfig e1000g0:3 up

root@sol-test-1:>/# zonecfg -z newzone
zonecfg:newzone> add net
zonecfg:newzone:net> set address=192.168.234.211
zonecfg:newzone:net> set physical=e1000g0
zonecfg:newzone:net> end
zonecfg:newzone> verify
zonecfg:newzone> commit
zonecfg:newzone> exit
root@sol-test-1:>/# ping 192.168.234.211
192.168.234.211 is alive

root@sol-test-1:>/# zlogin newzone
[Connected to zone 'newzone' pts/2]
Last login: Wed Dec 24 04:58:39 on console
Oracle Corporation      SunOS 5.10      Generic Patch   January 2005
# ifconfig -a
lo0:1: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
e1000g0:1: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 192.168.234.209 netmask ffffff00 broadcast 192.168.234.255
e1000g0:3: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 192.168.234.211 netmask ffffff00 broadcast 192.168.234.255

OK… Now back to RESOURCES

We will discuss about

MEMORY     [RAM / SWAP]
CPU

Good … now consider a situation that my GZ has 8g of physical memory & 2g of swap, we did not limited any NGZ for resources. Whatever GZ have, can be claimed by NGZ. Suppose a resource hunger NGZ had start eating Physical memory till maximum and then jump to eat swap meanwhile it steals CPU cycles also.

Does this situation tolerable? What happen to GZ and other NGZ’s?
All results in a system hang state.

To avoid this situation we need to limit the max usage of RESOURCES on NGZ, and the term used for limiting is CAPPING,

So it is RESOURCE CAPPING…..

Let’s start with CAPPING

root@sol-test-1:>/# zlogin newzone
[Connected to zone 'newzone' pts/2]
Last login: Wed Dec 24 05:44:10 on pts/2
Oracle Corporation      SunOS 5.10      Generic Patch   January 2005
# bash
bash-3.2# swap -l
swapfile             dev  swaplo blocks   free
/dev/swap            0,0       8 2104504 1839760
bash-3.2# swap -s
total: 762240k bytes allocated + 126820k reserved = 889060k used, 738196k available
bash-3.2# prtconf -v |grep -i mem
prtconf: devinfo facility not available
Memory size: 1024 Megabytes
bash-3.2# psrinfo
0       on-line   since 12/23/2014 18:11:38
1       on-line   since 12/23/2014 18:11:44
2       on-line   since 12/23/2014 18:11:45
3       on-line   since 12/23/2014 18:11:45
bash-3.2# psrinfo -p
2


All above info gathered from NGZ “newzone” is similar to GZ

MEMORY CAPPING

root@sol-test-1:>/# zonecfg -z newzone
zonecfg:newzone> add capped-memory
zonecfg:newzone:capped-memory> set physical=500m
zonecfg:newzone:capped-memory> set swap=256m
zonecfg:newzone:capped-memory> set locked=150m
zonecfg:newzone:capped-memory> end
zonecfg:newzone> verify
zonecfg:newzone> commit
zonecfg:newzone> exit

set physical=500m    NGZ can use max of 500mb of phy mem
set swap=256m        NGZ can use max of 256mb of swap
set locked=150m      This is the min guarantee of 150mb from phy mem to NGZ


CPU CAPPING

DEDICATED CPU —

root@sol-test-1:>/# zonecfg -z newzone
zonecfg:newzone> add dedicated-cpu
zonecfg:newzone:dedicated-cpu> set ncpus=1
zonecfg:newzone:dedicated-cpu> end
zonecfg:newzone> commit
zonecfg:newzone> exit

set ncpus=1          NGZ have no of cpu’s is 1
we can use another flag like,
set ncpus=1-2        NGZ has min 1 cpu & max 2 cpu’s incase needed

Dedicated CPU denotes the entire no of CPU allotted to NGZ

CAPPED CPU —

root@sol-test-1:>/# zonecfg -z newzone
zonecfg:newzone> add capped-cpu
zonecfg:newzone:capped-cpu> set ncpus=0.25
zonecfg:newzone:capped-cpu> end
zonecfg:newzone> commit
zonecfg:newzone> exit

So what is this capped cpu?

This is the min guarantee of the CPU time to a NGZ, ncpus indicates the % of CPU time for a zone,
If n=1 means 100% of CPU time,  here we had given 0.25, means 25% of Cpu time is min guarantee for this zone.


Now… let’s check at NGZ

root@sol-test-1:>/# zlogin newzone
[Connected to zone 'newzone' pts/2]
Last login: Wed Dec 24 05:59:55 on pts/2
Oracle Corporation      SunOS 5.10      Generic Patch   January 2005
# bash
bash-3.2# swap -l
swapfile             dev  swaplo blocks   free
/dev/swap            0,0       8 524288 349808
bash-3.2# prtconf -v |grep -i mem
prtconf: devinfo facility not available
Memory size: 500 Megabytes
bash-3.2# psrinfo -p
1
bash-3.2# swap -s
total: 216792k bytes allocated + 0k reserved = 216792k used, 45352k available

Well… we can see that the changes are in effect now.


No comments:

Post a Comment