Cap Memory in a Zone

From the “Oracle White Paper— Best Practices for Running Oracle Databases in Oracle Solaris Containers”
Section CPU and Memory Management, page 6

Resource Capping Daemon
The resource capping daemon (rcapd) can be used to regulate the amount of physical memory that is consumed by projects with resource caps defined. The rcapd daemon repeatedly samples the memory utilization of projects which are configured with physical memory caps. The sampling interval is specified by the administrator. When the system’s physical memory utilization soft cap exceeds the threshold for cap enforcement and other conditions are met, the daemon takes action to reduce the memory consumption of projects with memory caps to levels at or below the caps.
Virtual memory (swap space) can also be capped. This is a hard cap. In an Oracle Solaris Container which has a swap cap, an attempt by a process to allocate more virtual memory than is allowed will fail.
With Oracle Database it may be not appropriate to set the physical memory and swap limitation since the swapping of Oracle Database processes or System Global Area (SGA) is not desirable.
The third new memory cap is locked memory. This is the amount of physical memory that an Oracle Solaris Container can lock down, or prevent from being paged out. By default an Oracle Solaris Container now has the proc_lock_memory privilege, so it is wise to set this cap for all Oracle Solaris Containers.

You shouldn’t generally care of/set this limit unless you know some processes are actually using locked memory or if you don’t trust that zone users/administrators. Its value should then be set to a value smaller than the granted physical memory.

Below an example, that uses rcapd:

zonecfg:svr01> add capped-memory
zonecfg:svr01:capped-memory> set physical=4096M
zonecfg:svr01:capped-memory> set swap=6G zonecfg:svr01:capped-memory> set locked=2G
zonecfg:svr01:capped-memory> end

#Add-capped memory: limit RAM usage
#Set physical: self explained
#Set swap: here the value must be greater than physical, its address space, and not swap file usage.
#Set locked=2G: here is your value for lock

Leave a Reply

Your email address will not be published. Required fields are marked *