Wise people learn when they can; fools learn when they must - Arthur Wellesley

Sunday, 28 December 2014

Zones-10 [FSS-fair share scheduler]


ZONES-10 [FAIR SHARE SCHEDULER-FSS]

Well…

What is FSS? Any guess?

Something which schedule the shares without partiality!!!

Good… close enough…

Let’s try to understand this in simple way.

Imagine a race of 3-4 year old kids,

Can u control them?
Can u expect that they run in their track?
Can u expect even 1% of discipline from them?
 
They are king of the ground, nobody can control them until they finish the race in their preferred manner or way.

Imagine the same situation with NGZ’s. If there is no rctls defined then what they are capable to do with system?
They might capable to eat all CPU resources

To prevent this behavior Solaris has FSS class. This ensures that all processes are given the proper share of CPU cycles, based upon the assigned share.

Again there is a situation; if one person is running in the ground then FSS will do not tell him anything, just run wherever and however.

But when several runners are in ground then FSS will come and instruct them to be in limit.

It means that if several zones are running but only one zone is resource hunger then FSS will left him to do whatever, until some more zones jump into arena to eat resources. Means if there is competition for CPU then only FSS comes in picture.

Each zone will get its share no matter how much system is busy


If we set “cpu-share” that does not mean that the FSS will be used as default scheduling class, so better set the FSS as systems default scheduling class
 
root@sol-test-1:>/# dispadmin -d FSS

Now FSS is default scheduling class, now onwards all new processes will use FSS, but what about current processes?

We should also ensure about current processes to use FSS

root@sol-test-1:>/# priocntl -s -c FSS -i all

-s     set the class
-c     class name
-i     include individual process or processes using a specific scheduler        class

root@sol-test-1:>/# init 6

So… it’s all game of %

Let’s assign the % to each NGZ including GZ

root@sol-test-1:>/# zoneadm list -cv
  ID NAME             STATUS     PATH                           BRAND    IP
   0 global           running    /                              native   shared
   1 tzone4           running    /export/zones/tzone4           native   excl
  13 clonedZone       running    /export/zones/clonedZone       native   shared
  18 newzone          running    /export/zones/newzone          native   shared
  19 tzone3           running    /export/zones/tzone3           native   excl

We have 5 zones including GZ

Let’s divide the Percentage between them

GZ              20%
tzone4          20%
clonedZone      20%
newzone         10%
tzone3          30%

Global
root@sol-test-1:>/# zonecfg -z global
zonecfg:global> add rctl
WARNING: Setting a global zone resource control too low could deny
service to even the root user; this could render the system impossible
to administer.  Please use caution.
zonecfg:global:rctl> set name=zone.cpu-shares
zonecfg:global:rctl> add value (priv=privileged,limit=20,action=none)
zonecfg:global:rctl> end
zonecfg:global> commit
zonecfg:global> exit

tzone4
root@sol-test-1:>/# zonecfg -z tzone4
zonecfg:tzone4> add rctl
zonecfg:tzone4:rctl> set name=zone.cpu-shares
zonecfg:tzone4:rctl> add value (priv=privileged,limit=20,action=none)
zonecfg:tzone4:rctl> end
zonecfg:tzone4> verify
zonecfg:tzone4> commit
zonecfg:tzone4> exit


newzone
root@sol-test-1:>/# zonecfg -z newzone        
zonecfg:newzone> add rctl
zonecfg:newzone:rctl> set name=zone.cpu-shares
zonecfg:newzone:rctl> add value (priv=privileged,limit=10,action=none)
zonecfg:newzone:rctl> end
zonecfg:newzone> verify
zonecfg:newzone> commit
zonecfg:newzone> exit


Same for others also, then reboot all NGZ’s

root@sol-test-1:>/# zoneadm -z tzone4 reboot
root@sol-test-1:>/# zoneadm -z newzone reboot

To check the CPU share of NGZ from GZ,

root@sol-test-1:>/# prctl -n zone.cpu-shares -i zone tzone4
zone: 20: tzone4
NAME    PRIVILEGE       VALUE    FLAG   ACTION                       RECIPIENT
zone.cpu-shares
        privileged         20       -   none                                 -
        system          65.5K     max   none                                 -

root@sol-test-1:>/# prctl -n zone.cpu-shares -i zone newzone
zone: 21: newzone
NAME    PRIVILEGE       VALUE    FLAG   ACTION                       RECIPIENT
zone.cpu-shares
        privileged         10       -   none                                 -
        system          65.5K     max   none                                 -

We can know other rctls also,

root@sol-test-1:>/# prctl -n zone.max-locked-memory -i zone newzone
zone: 22: newzone
NAME    PRIVILEGE       VALUE    FLAG   ACTION                       RECIPIENT
zone.max-locked-memory
        privileged       150MB      -   deny                                 -
        system          16.0EB    max   deny                                 -

root@sol-test-1:>/# prctl -n zone.max-swap -i zone newzone
zone: 22: newzone
NAME    PRIVILEGE       VALUE    FLAG   ACTION                       RECIPIENT
zone.max-swap
        privileged       256MB      -   deny                                 -
        system          16.0EB    max   deny                                 -





No comments:

Post a Comment