Sun Microsystems 10 用户手册

下载
页码 121
Version 3.1-en
  Solaris 10 Container Guide - 3.1   5. Cookbooks 
Effective: 30/11/2009
5.5. Resource management
5.5.1. Limiting the /tmp-size within a zone
[dd] In many cases, /tmp is used as tmpfs in swap. This leads to the swap area being shared by 
all zones by /tmp in each  zone.  Although  the  /tmp  areas are visible to each zone itself, global 
resources are used. To limit the use of space, /tmp should be mounted in the /etc/vfstab of 
zones with the size option.
swap    -       /tmp    tmpfs   -       yes     size=250m
However, this limitation can be changed by the root administrator of the zone.
Yet,   this   area   is  counted  as  virtual  memory   of   the   zone   and  is  therefore   also   limited   by  setting 
zonecfg:add capped-memory: set swap= <value>.
5.5.2. Limiting the CPU usage of a zone (CPU capping)
[dd] Since Solaris 10 5/08, it is possible to cap the CPU time for a zone. CPU shares can be specified 
as potential capping values. Thus, the value 1.5, for example, represents a whole CPU and a half. 
With respect to the syntax, care must be taken to specify  set   ncpus=1.5  (locale=C) or  set 
ncpus=1,5
, depending on the locale setting of the session by the administrator. The setting is 
accurate to 1/100 CPUs.
zonecfg:keetonga> add capped-cpu 
zonecfg:keetonga:capped-cpu> set ncpus=1.5 
zonecfg:keetonga:capped-cpu> end
zonecfg:keetonga> info 
capped-cpu: 
[ncpus: 1.50] 
rctl: 
name: zone.cpu-cap 
value: (priv=privileged,limit=150,action=deny)
This setting is a hard limit, that is to say, the set CPU capacity cannot be exceeded.
5.5.3. Resource pools with processor sets
[ug] In Solaris (since Solaris 9), CPUs can be portioned out to resource pools. Solaris zones can be 
assigned to these resource pools; this allows CPU resources to be separated easily:
With the commands  poolcfg  and  pooladm, resource management is activated and the 
additional resource pool is created.
With   the   command  poolcfg,   the   processor   set   (pset)   is   created   and  assigned   to   the 
resource pool.
With the command  zonecfg, the attribute  pool  of the zone can be changed and the new 
resource pool can be set there. This will then be the setting that is valid if the zone is rebooted 
without further measures.
With   the  command  poolbind, the allocation of zones to resource pools can be changed 
dynamically. This has no effect on the default setting done with zonecfg; after a restart of the 
zone   the   setting   from   the   zone   configuration   is   re-established.
The processes of a zone that are allocated to a resource pool will then only run on the processors 
that belong to the processor set of this resource pool.
If several zones are allocated to a resource pool, the ratio of the CPU time used can be adjusted 
between the zones with the fair share scheduler.
The number of CPUs assigned to the processor set  is a hard limit and cannot be exceeded by the 
processes of the zone
107