Header RSS Feed
 
If you only want to see the articles of a certain category, please click on the desired category below:
ALL Android Backup BSD Database Hacks Hardware Internet Linux Mail MySQL Monitoring Network Personal PHP Proxy Shell Solaris Unix Virtualization VMware Windows Wyse

Increase memory (capped-memory) on a Solaris zone or SmartOS smartmachine
Tuesday - Jan 14th 2014 - by - (0 comments)

Thanks to the Nagios plugin check_mem for SmartOS (by Voxer), I am monitoring the memory usage of hundreds of SmartOS smartmachines. This also helps me to figure out when it is time to increase the memory of the zone.
In this example a zone with 512MB memory was using almost 100% so I decided to increase the zone's memory to 1GB.

Before doing any changes, I check the current zone config and take a look at the relevant information:

zonecfg -z myzone export
create -b
set zonepath=/zones/myzone
set brand=joyent
set autoboot=true 
[...]
add rctl
set name=zone.max-physical-memory
add value (priv=privileged,limit=536870912,action=deny)
end
add rctl
set name=zone.max-locked-memory
add value (priv=privileged,limit=536870912,action=deny)
end
add rctl
set name=zone.max-swap
add value (priv=privileged,limit=536870912,action=deny)
end
[...]

This shows the current config with 512MB memory.

To permanently increase the value to 1GB, the zone's config must be edited.
Each rctl (resource control) entry must be altered with the new value of 1073741824 (1GB):

zonecfg -z myzone
zonecfg:myzone> select rctl name=zone.max-physical-memory
zonecfg:myzone:rctl> remove value (priv=privileged,limit=536870912,action=deny)
zonecfg:myzone:rctl> add value (priv=privileged,limit=1073741824,action=deny)
zonecfg:myzone:rctl> end
zonecfg:myzone> select rctl name=zone.max-locked-memory
zonecfg:myzone:rctl> remove value (priv=privileged,limit=536870912,action=deny)
zonecfg:myzone:rctl> add value (priv=privileged,limit=1073741824,action=deny)
zonecfg:myzone:rctl> end
zonecfg:myzone> select rctl name=zone.max-swap
zonecfg:myzone:rctl> remove value (priv=privileged,limit=536870912,action=deny)
zonecfg:myzone:rctl> add value (priv=privileged,limit=1073741824,action=deny)
zonecfg:myzone:rctl> end
zonecfg:myzone> verify
zonecfg:myzone> commit
zonecfg:myzone> exit

But this change affects the zone only after a reboot. As of now the zone still can only use up to 512MB.

To make the changes live without a reboot, one can use the command prctl:

prctl -n zone.max-swap -r -v 1G `pgrep -z myzone init`
prctl -n zone.max-locked-memory -r -v 1G `pgrep -z myzone init`
prctl -n zone.max-physical-memory -r -v 1G `pgrep -z myzone init`


 

Add a comment

Show form to leave a comment

Comments (newest first):

No comments yet.

Go to Homepage home
Linux Howtos how to's
Monitoring Plugins monitoring plugins
Links links

Valid HTML 4.01 Transitional
Valid CSS!
[Valid RSS]

7541 Days
until Death of Computers
Why?