# to add a user to a projects
usermod -K project=myproj myappl
# or edit /etc/user_attr
# to add a user to a project
projmod -a -U user3 myproj
# to remove a user from a project
projmod -r -U user1 myproj
# NOTE: This sets the project membership to be only the named user
# all other previous members are removed
projmod -U user1 myproj
# newtask spawns a shell in the new project by default
# to run a script in a project
newtask -p myproj /opt/application/bin/startup
# to change the project of the current shell
newtask -p myproj -c $$
# to see your current project
id -p
# To create a project
projadd -c "Application foo" -U fooadm -K project.pool=pool_bar user.fooadm
# to set a limit on shared memory to 4GB on the user.oracle project which already exists:
projmod -aK 'project.max-shm-memory=(privileged,4294967296,deny)' user.oracle
# to check
$ su - oracle
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
$ prctl -n project.max-shm-memory $$
process: 24150: -ksh
NAME PRIVILEGE VALUE FLAG ACTION RECIPIENT
project.max-shm-memory
privileged 4.00GB - deny -
system 16.0EB max deny -
# to enable the Fair Share Scheduler
# Set the default class to FSS for the next reboot
dispadmin -d FSS
# set the default shceduler
priocntl -s -c FSS
# switch init to use the new shceduler
priocntl -s -c FSS -i pid 1
# switch all TS (Time share) Class processes to FSS
priocntl -s -c FSS -i class TS
# reboot is a good idea now to check that the config sticks
# you can see the scheduler in ps with
ps -eo 'pid comm class'
# priocntl has a '-i zone global' option that can be used when allocating shares to the global zone. It's not saved across reboots
# so needs to be made part of init if required
# for non-global zones (this will change the next boot)
zonecfg -z my-zone
zonecfg:my-zone> add rctl
zonecfg:my-zone:rctl> set name=zone.cpu-shares
zonecfg:my-zone:rctl> add value (priv=privileged,limit=20,action=none)
zonecfg:my-zone:rctl> end
zonecfg:my-zone> verify
zonecfg:my-zone> commit
zonecfg:my-zone> exit
# for a running zone do above and also
prctl -i my-zone -n zone.cpu-shares -r -v 20
# projects within non-global zones are configured like in the global zone.
projmod -aK 'project.cpu-shares=(privileged,40,none)' myproj
prctl -n project.cpu-shares -r -v 60 -i project myproj
# verified with
prctl -n project.cpu-shares $pid
# resource caps can only be applied to projects
# enable to daemon (in each zone that uses resource capping)
rcapadm -E
# can only limit resident memory at the moment (rcap.rss-max)
projmod -aK rcap.rss-max=X projname
# monitoring
# check the utilisation of pools
poolstat 5 10
# list memory/CPU load by projects
prstat -J
# monitor resource cap limits
rcapstat
# monitor CPU stats by processor set
mpstat -a 10
# list pids in each scheduling class
priocntl -d -i all
Friday, 11 July 2008
Project / Resource pool notes.
A project can be used to limit CPu and memory useage (I'm not sure where this came from but it's certainly not original)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment