Monday, September 6, 2010

controlling cpu usage part 8: Adding Pools to a Zone

Zones are able to use the pool subsystem directly. When a zone is defined it can be associated with a named pool by setting the zone's pool property to the name of an existing pool.

 # zonecfg -z zone set pool=pool_web

Multiple zones may share the same pool. In this case each zone should set the cpu-shares resource type to arbitrate between the relative use of CPU for each zone in the pool.

 # zonecfg -z test0z1 set cpu-shares=20
 # zonecfg -z test0z2 set cpu-shares=30

Solaris 11/06 introduces the concept of anoymous pools. These are pools created by a zone when it boots for the exclusive use of that zone. This is done through the dedicated-cpu resource type for a zone. The dedicated-cpu resource type has two properties, ncpus which indicates the number CPU's to put into the created pool, or a range of CPU's if a dynamic pool is desired, and importance which sets the pool.importance property in the pool for use as tie-breaker by poold.



 # zonecfg -z test0z1
 zonecfg:test0z1> add dedicated-cpu
 zonecfg:test0z1:dedicated-cpu> set ncpu=1-3
 zonecfg:test0z1:dedicated-cpu> set importance=10
 zonecfg:test0z1:dedicated-cpu> end
 zonecfg:test0z1> commit
 zonecfg:test0z1> exit

Whenever the zone boots the zoneadmd deamon will create a pool and assign the zone to the pool. 
Note that the dedicated-cpu resource on a zone means that the pool cannot be shared between multiple zones.

If the FSS is desired for the zone then the scheduling-class resource type for the zone should also be set.



 # zonecfg -z test0z1
 zonecfg:test0z1> set scheduling-class=FSS
 zonecfg:test0z1> commit
 zonecfg:test0z1> exit

Note The pools system must be already configured on the system before the dedicated-cpu resource type is used by the zone. If the pool system is not configured any attempt to boot the pool will result in an error from zoneadm.

If there is not enough resources to create the pool an attempt to boot results in a fatal error, and the boot fails.


 # zoneadm -z test0z1 boot
 zoneadm: zone 'test0z1': libpool(3LIB) error: invalid configuration
 zoneadm: zone 'test0z1': dedicated-cpu setting cannot be instatiated
 zoneadm: zone 'test0z1': call to zoneadmd failed

When the zone is booted a temporary pool called SUNWtmp_zonename is created.


        pool SUNWtmp_test0z1
                int     pool.sys_id 4
                boolean pool.active true
                boolean pool.default false
                int     pool.importance 10
                string  pool.comment
                boolean pool.temporary true
                pset    SUNWtmp_test0z1

        pset SUNWtmp_test0z1
                int     pset.sys_id 1
                boolean pset.defaul false
                uint    pset.min 1
                uint    pset.max 3
                string  pset.units population
                uint    pset.load 1991
                uint    pset.size 1
                string  pset.comment
                boolean pset.temporary true

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

The dedicated-cpu resource type creates a pool for the exclusive use of this zone. The zone has exclusive access to the CPU's in the pool. For that reason the cpu-shares resource type in the zone has no meaning if a dedicated-cpu resource type is also defined. The zone will always have 100% of the shares in the processor set, and so will always have the entire processor set to itself irrespective of the number of shares. 


No comments:

Post a Comment