Resource pools in Solaris 10/solaris 11 provide a mechanism to assign processor set and scheduling class to a non-global zone. The resource pool framework is as shown in the figure below. The dynamic resource pools come in extremely useful when you have a variable load on zones and you want to dynamically change the resource allocation to these zones. Unlike the capped CPU allocation, dynamic resource pool allocation to zones is online and can be changed anytime online.
For this example, we will first configure a zone for dynamic resource pool usage and then demonstrate how to change the number of CPUs of a zone from 1 to 2, then back to 1, then to 3.
Configuring zone for dynamic resource pool usage
Follow these steps to create a processor set, a resource pool, and bind it to a zone.
1. Start the /system/pools/dynamic service :
# svcadm enable /system/pools/dynamic
2. Create a file /var/tmp/pool.cfg (could be any file name) with the following contents:
# cat /var/tmp/pool.cfg create pset pset_1 (uint pset.min = 1; uint pset.max = 1) create pool pool_1 associate pool pool_1 (pset pset_1)
3. Create a pool from the above configuration:
# poolcfg -f /var/tmp/pool.cfg
4. Change the zone configuration to bind the pool to the zone (this is to make the pool assignment permanent across server and zone reboots):
# zonecfg -z zone_1 zonecfg:zone_1> set pool=pool_1 zonecfg:zone_1> verify zonecfg:zone_1> commit zonecfg:zone_1> exit
5. Bind pool pool_1 to zone zone_1 (this is to make the pool assignment effective immediately):
# poolbind -p pool_1 -i zoneid zone_1
6. Verify (list) the whole pool configuration:
# pooladm -n ...
7. Write the pool configuration to pool config file /etc/pooladm.conf:
# pooladm -s
8. Activate the pool configuration:
# pooladm -c
Changing the CPU count
The steps below demonstrates how to change the number of CPUs of zone zone01 to 2, then to 1, then to 3.
1. Increase the number of CPUs assigned to pset_1 (= pool_1 = zone01) from 1 to 2:
# poolcfg -dc 'modify pset pset_1 (uint pset.min = 2; uint pset.max = 2)'
2. Write this new pool configuration to pool config file /etc/pooladm.conf:
# pooladm -s
3. Display the new pool configuration:
# poolcfg -c 'info pool pool_1' /etc/pooladm.conf ... uint pset.min 2 uint pset.max 2 ...
4. Activate the pool configuration:
# pooladm -c
5. In the zone, verify that only 2 CPUs are assigned to the zone, using mpstat 2 2 :
# zlogin zone01 mpstat 2 2 CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl 0 0 0 207 203 1 6 0 0 0 0 3 0 0 0 100 1 0 0 3 10 0 6 0 0 0 0 1 0 1 0 99 CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl 0 0 0 203 203 1 1 0 0 0 0 8 0 0 0 100 1 5 0 0 2 0 1 0 0 0 0 5 0 0 0 100
6. Decrease the number of CPUs assigned to pset_1 (= pool_1 = zone01) from 2 to 1:
# poolcfg -dc 'modify pset pset_1 (uint pset.min = 1; uint pset.max = 1)'
7. Write this new pool configuration to pool config file /etc/pooladm.conf:
# pooladm -s
8. Display the new pool configuration:
# poolcfg -c 'info pool pool_1' /etc/pooladm.conf ... uint pset.min 1 uint pset.max 1 ...
9. Activate the pool configuration:
# pooladm -c
10. In the zone, verify that only 1 CPU is assigned to the zone, using mpstat 2 2 :
# zlogin zone01 mpstat 2 2 CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl 1 0 0 3 10 0 6 0 0 0 0 1 0 1 0 99 1 4 0 0 3 0 3 0 0 0 0 13 0 0 0 100
11. Increase the number of CPUs assigned to pset_1 (= pool_1 = zone01) from 1 to 3:
# poolcfg -dc 'modify pset pset_1 (uint pset.min = 3; uint pset.max = 3)'
12. Write that new pool configuration to pool config file /etc/pooladm.conf:
# pooladm -s
13. Display the new pool configuration:
# poolcfg -c 'info pool pool_1' /etc/pooladm.conf ... uint pset.min 3 uint pset.max 3 ...
14. Activate the pool configuration:
# pooladm -c
15. In the zone, verify that now 3 CPUs are assigned to the zone, using mpstat 2 2 :
# zlogin zone01 mpstat 2 2 CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl 0 0 0 207 203 1 6 0 0 0 0 3 0 0 0 100 1 0 0 3 10 0 6 0 0 0 0 1 0 1 0 99 2 0 0 3 10 0 5 0 0 0 0 0 0 0 0 100 CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl 0 0 0 202 201 1 0 0 0 0 0 0 0 0 0 100 1 5 0 0 2 0 1 0 0 0 0 7 0 0 0 100 2 0 0 0 1 0 0 0 0 0 0 0 0 0 0 100
Resource management in solaris zones : CPU shares, capped CPU, Dedicated CPU assignment
Resource management in solaris zones : Dynamic Resource pools
Resource management in solaris zones : Capped memory