As a follow up on the earlier posting about setting up hard cpu limits under Solaris. That posting didn't address processor sets and resource pools, this will. The basic steps are as follows:
1. build a processor set with a number of CPU's assigned
2. bind the processor set to a resource pool
3. bind the zone to the same resource pool
1. I’ll create three non-global zones. The first is bound to a two processor set and the second two zones are bound to a quad processor set. In the global zone, list the available CPU’s:
root@x4140> psrinfo
0 on-line since 08/11/2009 13:18:42
1 on-line since 08/11/2009 13:18:48
2 on-line since 08/11/2009 13:18:50
3 on-line since 08/11/2009 13:18:52
4 on-line since 08/11/2009 13:18:54
5 on-line since 08/11/2009 13:18:56
6 on-line since 08/11/2009 13:18:58
7 on-line since 08/11/2009 13:19:00
2. Enable the resource pool facility on the global zone:
root@x4140> pooladm –e
3. Save the configuration:
root@x4140> pooladm –s
4. List the pools:
root@x4140> pooladm
system default
string system.comment
int system.version 1
boolean system.bind-default true
string system.poold.objectives wt-load
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 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 6
uint pset.size 8
string pset.comment
cpu
int cpu.sys_id 7
string cpu.comment
string cpu.status on-line
cpu
int cpu.sys_id 4
string cpu.comment
string cpu.status on-line
cpu
int cpu.sys_id 1
string cpu.comment
string cpu.status on-line
cpu
int cpu.sys_id 6
string cpu.comment
string cpu.status on-line
cpu
int cpu.sys_id 3
string cpu.comment
string cpu.status on-line
cpu
int cpu.sys_id 0
string cpu.comment
string cpu.status on-line
cpu
int cpu.sys_id 5
string cpu.comment
string cpu.status on-line
cpu
int cpu.sys_id 2
string cpu.comment
string cpu.status on-line
5. Create the processor set that contains two CPU's:
root@x4140> poolcfg -c 'create pset duo-pset (uint pset.min=1; uint pset.max=4)'
6. Create a resource pool for the processor set:
root@x4140> poolcfg -c 'create pool duo-pool'
7. Assign the resource pool to the processor set:
root@x4140> poolcfg -c 'associate pool duo-pool (pset duo-pset)'
8. Enable the configuration:
root@x4140> pooladm –c
9. List the changes:
root@x4140> pooladm
system default
string system.comment
int system.version 1
boolean system.bind-default true
string system.poold.objectives wt-load
pool duo-pool
int pool.sys_id 1
boolean pool.active true
boolean pool.default false
int pool.importance 1
string pool.comment
pset duo-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 duo-pset
int pset.sys_id 1
boolean pset.default false
uint pset.min 1
uint pset.max 4
string pset.units population
uint pset.load 0
uint pset.size 2
string pset.comment
cpu
int cpu.sys_id 3
string cpu.comment
string cpu.status on-line
cpu
int cpu.sys_id 4
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 2
uint pset.size 4
string pset.comment
cpu
int cpu.sys_id 7
string cpu.comment
string cpu.status on-line
cpu
int cpu.sys_id 4
string cpu.comment
string cpu.status on-line
cpu
int cpu.sys_id 6
string cpu.comment
string cpu.status on-line
cpu
int cpu.sys_id 5
string cpu.comment
string cpu.status on-line
10. Make the changes to the zone:
root@x4140> zonecfg -z zone
zonecfg:zone> set pool=duo-pool
zonecfg:zone> verify
zonecfg:zone> commit
zonecfg:zone> exit
11. Create a second processor set with four CPU's and assign it to a new resource pool:
root@x4140> poolcfg -c 'create pset quad-pset (uint pset.min=1; uint pset.max=4)'
root@x4140> poolcfg -c 'create pool quad-pool'
root@x4140> poolcfg -c 'associate pool quad-pool (pset quad-pset)'
root@x4140> pooladm -c
12. Make changes to the second and third zones:
root@x4140> zonecfg -z zone2
zonecfg:zone> set pool=quad-pool
zonecfg:zone> verify
zonecfg:zone> commit
zonecfg:zone> exit
root@x4140> zonecfg -z zone3
zonecfg:zone3> set pool=quad-pool
zonecfg:zone3> verify
zonecfg:zone3> commit
zonecfg:zone3> exit
13. List the processors available to the zones:
root@x4140> zlogin zone
[Connected to zone 'zone' pts/3]
Last login: Mon Aug 17 16:25:23 on pts/3
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
# psrinfo
3 on-line since 08/17/2009 16:46:44
4 on-line since 08/17/2009 16:46:46
root@x4140-a> zlogin zone2
[Connected to zone 'zone2' pts/3]
Last login: Mon Aug 17 16:25:39 on pts/3
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
# psrinfo
0 on-line since 08/17/2009 16:46:34
1 on-line since 08/17/2009 16:46:40
2 on-line since 08/17/2009 16:46:42
root@x4140-a> zlogin zone3
[Connected to zone 'zone3' pts/4]
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
# psrinfo
0 on-line since 08/17/2009 16:46:34
1 on-line since 08/17/2009 16:46:40
2 on-line since 08/17/2009 16:46:42
14. Then if we want to, we can enable the Fair Share Scheduler so that zone2 and zone3 share the processors in the quad-pool, while zone has dedicated access to two cpu's and doesn't share any cpu's with any other zones.
root@x4140> poolcfg -c 'modify pool quad-pool (string pool.scheduler="FSS")'
root@x4140> pooladm -c
[reboot zones or run this command]
root@x4140> priocntl -s -c FSS -i class TS
root@x4140> priocntl -s -c FSS -i pid 1
Assign three shares to zone2 and one share to zone3:
root@x4140> zonecfg -z zone2
zonecfg:zone2> add rctl
zonecfg:zone2:rctl> set name=zone.cpu-shares
zonecfg:zone2:rctl> add value (priv=privileged,limit=3,action=none)
zonecfg:zone2:rctl> end
zonecfg:zone2> exit
root@x4140> zonecfg -z zone3
zonecfg:zone3> add rctl
zonecfg:zone3:rctl> set name=zone.cpu-shares
zonecfg:zone3:rctl> add value (priv=privileged,limit=1,action=none)
zonecfg:zone3:rctl> end
zonecfg:zone3> exit
The zone "zone" now runs on it's own dedicated and guaranteed CPU's protected from the workload of the other zones. zone2 and zone3 now share the other quad resource pool with zone2 getting a higher weighting than zone3 and the global zone has the remaining CPU.
Tuesday, August 18, 2009
Subscribe to:
Posts (Atom)