Niklas Jonsson wrote:
> Hi,
> I have 5 zones on my machine,
> I would like to change the cpu-shares for all these machines to look like
> this:
> machine 1, Should have a minimum of 50% cpu share available all the time
> machine 2-5, share the rest of the resources.
> If I do this with pools (since this is a V445 with 4 cpu's) that would
> mean,
> machine gets 2 cpu's, machine 2-5 only shares 1 cpu, and the global-zone
> gets one cpu.
> Hope someone could explain how to do this.

Renaud gave an excellent listing of commands to do this with pools and current 
Solaris 10 (11/06 or earlier).  Because your subject line mentioned CPU 
shares, I will show the other method: how to do this with FSS, the Fair-Share 
Scheduler.  Using pools allows you to guarantee a *maximum* amount of CPU time 
available to a zone's processes.  Using FSS allows you to guarantee a 
*minimum* amount of CPU time available to a zone, which is better in most 

Using pools will often waste CPU cycles.  Generally we recommend FSS because 
it uses more of the CPU cycles available to the system.  However, people often 
use pools when CPU capping is more important than efficiency, and in a few 
other specific situations.

This example assumes OpenSolaris build 56 or later, or the next update to 
Solaris 10, which is due in the next couple of months.  You can also do this 
with Solaris 10, any release from 3/05 to 11/06, but it requires more 
commands.  You can find an example of their usage at .

The example below guarantees that the global zone gets sufficient CPU capacity 
to perform platform management.  As long as an application is not running in 
the global zone, this should be a very small amount of CPU time.

Ignoring the global zone, the commands below guarantees that zone1 will get a 
minimum of 50% of the CPU cycles.  It also guarantees that the other four 
zones will get the other 50%.  You didn't specify how the other four zones 
should split up their 50%.  I arbitrarily chose to guarantee 1/4 of their 50%, 
per zone.  In other words, each of zones 2-5 get at least 1/8 of the CPU 
cycles not used by the global zone.  If it does not matter how they split up 
their 50%, choosing an equal number of shares for each is arbitrary, but will 
work well.

===== Using shares but not pools ======================
# (1) Set shares for the global zone so that it can manage the system
global# zonecfg -z global
set cpu-shares=100

# (2) For the 'big' zone:
global# zonecfg -z zone1
set cpu-shares=100

# (3) For each of the other zones:

global# zonecfg -z <zonename>
set cpu-shares=25

If you prefer, you could leave the global zone in the default pool and assign 
one CPU to it, and skip the command in section (1) above.  Then you would put 
all of the other zones into a pool that you create, with all of the other CPUs 
in that pool, using the commands that Renaud showed in his first response 
(those poolcfg, pooladm, and poolbind commands).  You would still use the 
commands in (2) and (3) above, and add "set pool=<poolname>" to each zonecfg 

As you can see, there is a great deal of flexibility in Solaris resource 

Jeff VICTOR              Sun Microsystems            jeff.victor @
OS Ambassador            Sr. Technical Specialist
Solaris 10 Zones FAQ:
zones-discuss mailing list

Reply via email to