CPU caps
Introduction
Solaris already provides four different mechanisms which can be
used to control CPU usage of applications.
- Processor Binding - see pbind(1M)
- Processor Sets - see psrset(1M)
- Dynamic Resource Pools - see pooladm(1M)
- Fair Share Scheduler - see FSS(7)
This project is going to provide yet another mechanism which will allow
system administrators to define an absolute upper limit (or a cap) on how
much CPU time can be consumed by applications. CPU caps can be used
for better isolation of applications from each other and for achieving more
predictable behavior. CPU caps can also help to meet SLA requirements.
CPU caps can be especially useful when migrating applications to a new server. By
setting CPU caps on them in advance, applications and/or users will not get
used to having a complete control of the whole system. CPU caps can help simulate
the performance of the system as if other applications were also running on it at the same time.
This way, performance of each application will not degrade too much when more applications actually migrate to the server.
Documentation
- CPU Caps Design (pdf version)
- CPU Caps implementation notes (pdf version)
- PSARC 2004/402 CPU Caps (pdf version)
Status
- CPU Caps are integrated in snv_61
The capctl script
Although it is possible to use prctl(1M) command to manage CPU caps, the capctl Perl script that simplifies it a lot.
The script is used like this:
# capctl <-P project> <-p pid> <-Z zone> <-n name> <-v value>
- -P proj: Specify project id
- -p pid: Specify pid
- -Z zone: Specify zone name
- -n name: Specify resource name
- -v value: Specify resource value
For example, to set a cap for project foo to 50% you can say:
# capctl -P foo -v 50
To change the cap to 80%:
# capctl -P foo -v 80
To see the cap value:
# capctl -P foo
To remove the cap:
# capctl -P foo -v 0
The script automagically envokes prctl(1M) commands (and shows you what it actually does).