Amol Chiplunkar's Weblog

All | Music | Personal | Sports | Sun | Systems Management
« CEC visit | Main | Hands free sun manag... »
20060505 Friday May 05, 2006

CPU Caps: Control those CPU Pigs     I am thrilled to say that probably I am one of those few lucky souls to get an early experience of the latest and arguably coolest resource control mechanism on Solaris. CPU Caps released a month back by Andrei on opensolaris. Its fresh. I feel 'privileged' ( well I don't like this word when I am setting resource controls in the zone configuration. RFE 6222025 ) :) :)
    I am not one of those experienced senior sys admins, but even then it was a cakewalk to install CPU Cap BFUs and use the two new resource controls, zone.cpu-cap and project.cpu-cap. My observations and remarks here may not be technically perfect, or could even be ridiculed as amature thoughts, but you know what.. I don't care.

At a first glance: it's a simple equation. 1 CPU cap = 1/100 th of one CPU. And it gells well with the Solaris Containers. Let's check out how CPU caps and containers work together.
Let me switch off one cpu from my two way box for a moment.

# psradm -f 0
# psrinfo 
0       off-line  since 05/01/2006 20:23:09
1       on-line   since 05/01/2006 20:23:10

    Just so that the calculations become easy

# prctl -r -n zone.cpu-cap -v 10 -i zone newzone
# prctl -t privileged -n zone.cpu-cap -v 20 -i zone global

    And start nspins in global as well as the non global zone.

# prstat -Z -n4,2
   PID USERNAME  SIZE   RSS STATE  PRI NICE      TIME  CPU PROCESS/NLWP
348747 root     1176K  768K run     22    0   0:00:43  19% nspins/1
348805 root     1176K  768K run      1    0   0:00:07  10% nspins/1
116413 root       15M   12M sleep   59    0   0:17:40 0.2% java/35
348754 root     3336K 3024K cpu1    46    0   0:00:00 0.2% prstat/1
ZONEID    NPROC  SIZE   RSS MEMORY      TIME  CPU ZONE
     0       78 7931M 7483M    99%   2:38:38  20% global
     2       29  103M   42M   0.5%   0:01:08  10% newzone

    With the CPU Caps on, they just refuse to go up & take the entire CPU which they would have done otherwise. Now after I bring back my CPU 0, within seconds I get the results in prstat

# psradm -n 0
# prstat -Z -n4,2
   PID USERNAME  SIZE   RSS STATE  PRI NICE      TIME  CPU PROCESS/NLWP
348747 root     1176K  768K cpu1     1    0   0:01:26 9.6% nspins/1
348805 root     1176K  768K wait     1    0   0:00:32 5.4% nspins/1
116413 root       15M   12M sleep   59    0   0:17:41 0.2% esd/1
109924 noaccess  220M  182M sleep    8    0   0:17:56 0.1% java/35
ZONEID    NPROC  SIZE   RSS MEMORY      TIME  CPU ZONE
     0       78 7931M 7483M    99%   2:39:27  11% global
     2       29  103M   42M   0.5%   0:01:33 5.4% newzone


This is so cool.

I guess I better put a cap on my thoughts now...

Posted by chiplunkar ( May 05 2006, 10:10:00 PM IST ) Permalink Comments [0]

Trackback URL: http://blogs.sun.com/chiplunkar/entry/cpu_caps_control_those_cpu
Comments:

Post a Comment:

Name:
E-Mail:
URL:

Your Comment:

HTML Syntax: NOT allowed

Calendar

RSS Feeds

Search

Links

Navigation

Referers

Creative Commons License
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.