Unlike CPU shares, CPU caps let you naturally limit CPU usage for a project or for a zone. My favorite part is that you talk to the system about these caps in terms of percentage of a CPU. So, a cap of “150” means “150%” or “never use more than 1 and 1/2 CPUs”. Here’s how to set a cap for a zone:
# zonecfg -z myzone zonecfg:myzone> add rctl zonecfg:myzone:rctl> set name=zone.cpu-cap zonecfg:myzone:rctl> add value (priv=privileged,limit=150,action=deny) zonecfg:myzone:rctl> end zonecfg:myzone> exit
(As an aside, I think we need to make this syntax in zonecfg much easier, both for shares and caps. This is 6222025 RFE: make cpu shares a global property)
Another advantage of CPU caps is that they are active for all scheduling classes
except for “RT” (realtime). We’re really excited to have this feature (which hopefully will integrate soon) since we think it will make resouce management configurations for
zones quite a bit simpler in many cases.
The CPU Caps website includes complete directions on how to try this feature out.