Increase memory (capped-memory) on a Solaris zone or SmartOS smartmachine

Written by - 0 comments

Published on - Listed in Unix Solaris SmartOS


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.

RSS feed

Blog Tags:

  AWS   Android   Ansible   Apache   Apple   Atlassian   BSD   Backup   Bash   Bluecoat   CMS   Chef   Cloud   Coding   Consul   Containers   CouchDB   DB   DNS   Database   Databases   Docker   ELK   Elasticsearch   Filebeat   FreeBSD   Galera   Git   GlusterFS   Grafana   Graphics   HAProxy   HTML   Hacks   Hardware   Icinga   Influx   Internet   Java   KVM   Kibana   Kodi   Kubernetes   LVM   LXC   Linux   Logstash   Mac   Macintosh   Mail   MariaDB   Minio   MongoDB   Monitoring   Multimedia   MySQL   NFS   Nagios   Network   Nginx   OSSEC   OTRS   Office   PGSQL   PHP   Perl   Personal   PostgreSQL   Postgres   PowerDNS   Proxmox   Proxy   Python   Rancher   Rant   Redis   Roundcube   SSL   Samba   Seafile   Security   Shell   SmartOS   Solaris   Surveillance   Systemd   TLS   Tomcat   Ubuntu   Unix   VMWare   VMware   Varnish   Virtualization   Windows   Wireless   Wordpress   Wyse   ZFS   Zoneminder