solaris 11 exercise zones (2) resource control

Situation: global zone, zone1 and zone2.

First bring all processes under FSS control
dispadmin -d FSS
this will set the default scheduling to FSS at reboot.
file: /etc/dispadmin.conf

To set up a running system.
priocntl -s -c FSS -i all
priocntl -s -c FSS -i pid 1

prctl -n zone.cpu-shares -v 10 -r -i zone global
prctl -n zone.cpu-shares -i zone global
prctl -n zone.cpu-shares -v 10 -r -i zone zone1
prctl -n zone.cpu-shares -v 40 -r -i zone zone2

script:
#!/usr/bin/bash
while true
do
a=121.22/3.34
done

copy the script to the zone root dir of both zones
and run it from within the zone.

use: prstat -Z from within the global zone to
or
use: zonestat -z zone1,zone2 -R total,high 5 1m

watch the usage of cpu.

to change the cpu-shares in the zoneconfig:

zonecfg:zone1> add rctl
zonecfg:zone1:rctl> set name=zone.cpu-shares
zonecfg:zone1:rctl> add value (priv=privileged,limit=10,action=none)
zonecfg:zone1:rctl> end
zonecfg:zone1> verify
zonecfg:zone1> commit
zonecfg:zone1> exit

other resource controls:

zonecfg:my-zone> add dedicated-cpu
zonecfg:my-zone:dedicated-cpu> set ncpus=1-3
zonecfg:my-zone:dedicated-cpu> set importance=2
zonecfg:my-zone:dedicated-cpu> end
capped-cpu
ncpus

Specify the number of CPUs. The following example specifies a CPU cap of 3.5 CPUs for the zone my-zone.

zonecfg:my-zone> add capped-cpu
zonecfg:my-zone:capped-cpu> set ncpus=3.5
zonecfg:my-zone:capped-cpu> end
capped-memory
physical, swap, locked

Specify the memory limits for the zone my-zone. Each limit is optional, but at least one must be set.

zonecfg:my-zone> add capped-memory
zonecfg:my-zone:capped-memory> set physical=50m
zonecfg:my-zone:capped-memory> set swap=100m
zonecfg:my-zone:capped-memory> set locked=30m
zonecfg:my-zone:capped-memory> end

This entry was posted in solaris. Bookmark the permalink.

Comments are closed.