Thursday, September 2, 2010

controlling cpu usage part 7: Pools

Dynamic pools were introduced in Solaris 10. A pool is binding of a resource and processor set together into a persistent entry. A pool allows us to name a pool and assign resource controls, such as the scheduler, on a persistent basis. 
Pools can also be used for projects using the project.pool attribute in /etc/project
By default if the pools system is enabled using SMF there is a default processor set created whcih is attached to a default pool. This configuration can be viewed using the poolcfg -dc info command.


 # poolcfg -dc info
 poolcfg: cannot load configuration from /dev/poolctl: Facility is not active

 # svcadm enable svcs:/system/pools:default
 # poolcfg -dc info

 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 481
                 uint    pset.size 2
                 string  pset.comment

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

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

To configure pools on a system you must create a configuration file. By default this file should be named /etc/pooladm.conf so it would automatically load at boot time. The easiest way of creating a file is to configure the current system as desired and then perform a pooladm save command.

 # pooladm -s /etc/pooladm.conf

The following example saves the current kernel state as /etc/pooladm.conf, and then uses poolcfg to create a new pool called pool_web which contains one processor set pset_web which has one CPU.

 # pooladm -s /etc/pooladm.conf
 # poolcfg -c 'create pool pool_web'
 # poolcfg -c 'create pset pset_web (uint pset.min = 1; uint pset.max = 4)'
 # poolcfg -c 'associate pool pool_web (pset pset_web)'
 # pooladm -c
 # pooladm -s

We can then display the resultant condiguration.



 # poolcfg -dc info

 system default
         string  system.comment
         int     system.version 1
         boolean system.bind-default true
         string  system.poold.objectives wt-load

         pool pool_web
                 int     pool.sys_id 1
                 boolean pool.active true
                 boolean pool.default false
                 int     pool.importance 1
                 string  pool.comment
                 pset    pset_web
       

         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_web
                 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 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 0
                 uint    pset.size 1
                 string  pset.comment


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


Note that the default pool and the default pset have their default property set to true.
We can also define other resource properties for the pools. To do this we can also define and set the pool.scheduler to the pool.
The following example sets the FSS scheduler for the pool pool_web



 # poolcfg -c 'modify pool pool_web (string pool.scheduler="FSS")'
 # poolcfg -dc info

 system default
         string  system.comment
         int     system.version 1
         boolean system.bind-default true
         string  system.poold.objectives wt-load

         pool pool_web
                 int     pool.sys_id 1
                 boolean pool.active true
                 boolean pool.default false
                 string  pool.scheduler FSS
                 int     pool.importance 1
                 string  pool.comment
                 pset    pset_web

 ...

As the load in one processor set increases the number of CPU's in that pool is increased by taking CPU's from other pools. The pset.min and pset.max properties of the processor set are used to constrain the minimum and maximum number of CPU's that can exist in a pool.

If the there is a tie for resource the pool.importance property is used as a tie-breaker.

To enable dynamic pools the svc:/system/pools/dynamic:default service must be enabled. This will start the poold deamon which performs the dynamic modification of the processor sets on the system.

 # ps -eaf|grep poold
     root 20334  3948   0 12:23:51 pts/4       0:00 grep poold

 # svcadm enable svc:/system/pools/dynamic:default
 # ps -eaf|grep poold
     root 20423  3948   0 12:24:55 pts/4       0:00 grep poold
     root 20422     1   0 12:24:53 ?           0:00 /usr/lib/pool/poold


No comments:

Post a Comment