Tuesday, August 01, 2006

Solaris Zones on VMware on 2 core Wintel Machine



This is a small testing to see whether Solaris 10 zones resource management feature really works. Objectives are to test both Resource Pool and FSS.

First i installed Solaris 10 on VMware on a Pentium Duo Core machine with 1GB RAM.
The global zone is sol10vm8. The two non-global zones created are vm8z1 and vm8z2 respectively. When creating VM using VMware, i choosed to use 2 CPUs for this Sol 10 virtual machine.

****************************
sol10vm8:[/scripts] psrinfo
0 on-line since 08/01/2006 16:36:15
1 on-line since 08/01/2006 16:36:20

*****************************
Created a pool called vm8-pool which used maximum 1 CPU.
This step is important as we want to limit the utilization of CPU to 1 by using resource pool.

****************************
sol10vm8:[/scripts] pooladm

system sol10vm8
string system.comment
int system.version 1
boolean system.bind-default true
int system.poold.pid 441

pool vm8-pool
int pool.sys_id 3
boolean pool.active true
boolean pool.default false
int pool.importance 1
string pool.comment
pset vm8-pset

pool pool_default
int pool.sys_id 0
boolean pool.active true
boolean pool.default true
int pool.importance 1
string pool.comment
pset pset_default

pset vm8-pset
int pset.sys_id 1
boolean pset.default false
uint pset.min 1
uint pset.max 1
string pset.units population
uint pset.load 12002
uint pset.size 1
string pset.comment

cpu
int cpu.sys_id 0
string cpu.comment
string cpu.status on-line

pset pset_default
int pset.sys_id -1
boolean pset.default true
uint pset.min 1
uint pset.max 65536
string pset.units population
uint pset.load 18
uint pset.size 1
string pset.comment

cpu
int cpu.sys_id 1
string cpu.comment
string cpu.status on-line

****************************
Seems ok. Enable FSS on Global zone.

#dispadmin -d FSS # init 6

Non-global zones shares
vm8z1 -- 30
vm8z2 -- 20


sol10vm8:[/scripts] zonecfg -z vm8z1 info
zonepath: /vm8z1
autoboot: false
pool: vm8-pool
inherit-pkg-dir:
dir: /lib
inherit-pkg-dir:
dir: /platform
inherit-pkg-dir:
dir: /sbin
inherit-pkg-dir:
dir: /usr
net:
address: 134.251.5.235
physical: e1000g0
rctl:
name: zone.cpu-shares
value: (priv=privileged,limit=30,action=none)

****************************
sol10vm8:[/scripts] zonecfg -z vm8z2 info
zonepath: /vm8z2
autoboot: false
pool: vm8-pool
inherit-pkg-dir:
dir: /lib
inherit-pkg-dir:
dir: /platform
inherit-pkg-dir:
dir: /sbin
inherit-pkg-dir:
dir: /usr
net:
address: 134.251.5.236
physical: e1000g0
rctl:
name: zone.cpu-shares
value: (priv=privileged,limit=20,action=none)

****************************
started Brendan Greggs's script zoneflogcpu.....

sol10vm8:[/scripts] zoneflogcpu start

.........and the above images are the output

You can see the utilization of vm8z1 and vm8z2 used 29% and 20% of the cpu resources respectively. Look at the Windows Task Manager......the 1st CPU is highly loaded while the 2nd one is relatively idle.

Yes!! We achieved our objective!
By using resource pool, we are able to limit the processor set we use.
By using FSS, we have successfully limit the utilization of zones.

What about setting the shares to 60 and 30? (This time i set vm8z2 to 60 and vm8z1 to 30) Here's the result:

PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/NLWP
4281 root 2920K 1496K run 3 0 0:00:50 5.8% perl/1
4252 root 2920K 1496K run 1 0 0:01:10 5.4% perl/1
4249 root 2920K 1496K run 14 0 0:01:10 5.4% perl/1
4278 root 2920K 1496K run 2 0 0:00:50 5.3% perl/1
4255 root 2920K 1496K run 5 0 0:01:10 5.3% perl/1
4275 root 2920K 1496K run 14 0 0:00:50 5.2% perl/1
4266 root 2920K 1496K run 1 0 0:00:26 2.9% perl/1
4246 root 2920K 1496K run 1 0 0:00:36 2.9% perl/1
4269 root 2920K 1496K run 3 0 0:00:26 2.8% perl/1
4240 root 2920K 1496K cpu0 14 0 0:00:36 2.7% perl/1
4243 root 2920K 1496K run 3 0 0:00:36 2.7% perl/1
4272 root 2920K 1496K run 3 0 0:00:26 2.7% perl/1
441 root 77M 17M sleep 1 0 0:00:12 0.1% poold/8
1779 noaccess 130M 60M sleep 11 0 0:00:22 0.1% java/27
3513 root 4392K 4176K cpu1 56 0 0:00:01 0.0% prstat/1
ZONEID NPROC SIZE RSS MEMORY TIME CPU ZONE
7 39 126M 72M 19% 0:06:20 32% vm8z2
5 41 130M 74M 20% 0:03:26 17% vm8z1
0 53 385M 178M 47% 0:01:09 0.2% global


Total: 133 processes, 454 lwps, load averages: 12.01, 11.61, 13.18

You can see that the prstat did not show 60% and 30%, it shows 32% and 17% which is about the half of it. Well, this is simple, what prstat -Z shows is the overall utilization which includes all the CPU resources in the system, which is 2 CPU in this case.

The OVERALL cpu allocation for vm8z1 is : [30/90] * 100 * 1/2 = 17%
and vm8z2: [60/90] * 100 * 1/2 = 33%

This indeed shows that prstat output is correct. I will look into granularity of cpu allocation at project level when have time.

No comments: