This chapter contains procedures for configuring and using the resource capping daemon rcapd.
For an overview of rcapd, see Chapter 10, Physical Memory Control Using the Resource Capping Daemon (Overview).
Define a physical memory resource resident set size (RSS) cap for a project by adding an rcap.max-rss attribute to the project database entry.
Become superuser, or assume a role that includes the Process Management profile.
The System Administrator role includes the Process Management profile. For information on how to create the role and assign the role to a user, see Managing RBAC (Task Map) in System Administration Guide: Security Services.
Add this attribute to the /etc/project file:
rcap.max-rss=value |
The following line in the /etc/project file sets an RSS cap of 10 Gbytes for a project named db.
db:100::db,root::rcap.max-rss=10737418240 |
Note that the system might round the specified cap value to a page size.
Become superuser, or assume a role that includes the Process Management profile.
The System Administrator role includes the Process Management profile. For information on how to create the role and assign the role to a user, see Managing RBAC (Task Map) in System Administration Guide: Security Services.
Set an rcap.max-rss attribute of 10 Gbytes in the /etc/project file, in this case for a project named db.
# projmod -a -K rcap.max-rss=10GB db |
The /etc/project file then contains the line:
db:100::db,root::rcap.max-rss=10737418240 |
Task |
Description |
For Instructions |
---|---|---|
Set the memory cap enforcement threshold. |
Configure a cap that will be enforced when the physical memory available to processes is low. | |
Set the operation interval. |
The interval is applied to the periodic operations performed by the resource capping daemon. | |
Enable resource capping. |
Activate resource capping on your system. | |
Disable resource capping. |
Deactivate resource capping on your system. | |
Report cap and project information. |
View example commands for producing reports. | |
Monitor a project's resident set size. |
Produce a report on the resident set size of a project. | |
Determine a project's working set size. |
Produce a report on the working set size of a project. | |
Report on memory utilization and memory caps. |
Print a memory utilization and cap enforcement line at the end of the report for each interval. |
Reporting Memory Utilization and the Memory Cap Enforcement Threshold |
This section contains procedures for configuring the resource capping daemon with rcapadm. See rcapd Configuration and the rcapadm(1M) man page for more information. Using the rcapadm to specify a temporary resource cap for a zone is also covered.
If used without arguments, rcapadm displays the current status of the resource capping daemon if it has been configured.
Caps can be configured so that they will not be enforced until the physical memory available to processes is low. See Memory Cap Enforcement Threshold for more information.
The minimum (and default) value is 0, which means that memory caps are always enforced. To set a different minimum, follow this procedure.
Become superuser, or assume a role that includes the Process Management profile.
The System Administrator role includes the Process Management profile. For information on how to create the role and assign the role to a user, see Managing RBAC (Task Map) in System Administration Guide: Security Services.
Use the -c option of rcapadm to set a different physical memory utilization value for memory cap enforcement.
# rcapadm -c percent |
percent is in the range 0 to 100. Higher values are less restrictive. A higher value means capped project workloads can execute without having caps enforced until the system's memory utilization exceeds this threshold.
To display the current physical memory utilization and the cap enforcement threshold, see Reporting Memory Utilization and the Memory Cap Enforcement Threshold.
rcapd Operation Intervals contains information about the intervals for the periodic operations performed by rcapd. To set operation intervals using rcapadm, follow this procedure.
Become superuser, or assume a role that includes the Process Management profile.
The System Administrator role includes the Process Management profile. For information on how to create the role and assign the role to a user, see Managing RBAC (Task Map) in System Administration Guide: Security Services.
Use the -i option to set interval values.
# rcapadm -i interval=value,...,interval=value |
All interval values are specified in seconds.
There are three ways to enable resource capping on your system. Enabling resource capping also sets the /etc/rcap.conf file with default values.
Become superuser, or assume a role that includes the Process Management profile.
The System Administrator role includes the Process Management profile. For information on how to create the role and assign the role to a user, see Managing RBAC (Task Map) in System Administration Guide: Security Services.
Enable the resource capping daemon in one of the following ways:
Turn on resource capping using the svcadm command.
# svcadm enable rcap |
Enable the resource capping daemon so that it will be started now and also be started each time the system is booted:
# rcapadm -E |
Enable the resource capping daemon at boot without starting it now by also specifying the -n option:
# rcapadm -n -E |
There are three ways to disable resource capping on your system.
Become superuser, or assume a role that includes the Process Management profile.
The System Administrator role includes the Process Management profile. For information on how to create the role and assign the role to a user, see Managing RBAC (Task Map) in System Administration Guide: Security Services.
Disable the resource capping daemon in one of the following ways:
Turn off resource capping using the svcadm command.
# svcadm disable rcap |
To disable the resource capping daemon so that it will be stopped now and not be started when the system is booted, type:
# rcapadm -D |
To disable the resource capping daemon without stopping it, also specify the -n option:
# rcapadm -n -D |
Disabling the Resource Capping Daemon Safely
Use rcapadm -D to safely disable rcapd. If the daemon is killed (see the kill(1) man page), processes might be left in a stopped state and need to be manually restarted. To resume a process running, use the prun command. See the prun(1) man page for more information.
This procedure is use to allocate the maximum amount of memory that can be consumed by a specified zone. This value lasts only until the next reboot. To set a persistent cap, use the zonecfg command.
Become superuser, or assume a role that includes the Process Management profile.
The System Administrator role includes the Process Management profile.
Set a maximum memory value of 512 Mbytes for the zone my-zone.
# rcapadm -z testzone -m 512M |
Use rcapstat to report resource capping statistics. Monitoring Resource Utilization With rcapstat explains how to use the rcapstat command to generate reports. That section also describes the column headings in the report. The rcapstat(1) man page also contains this information.
The following subsections use examples to illustrate how to produce reports for specific purposes.
In this example, caps are defined for two projects associated with two users. user1 has a cap of 50 megabytes, and user2 has a cap of 10 megabytes.
The following command produces five reports at 5-second sampling intervals.
user1machine% rcapstat 5 5 id project nproc vm rss cap at avgat pg avgpg 112270 user1 24 123M 35M 50M 50M 0K 3312K 0K 78194 user2 1 2368K 1856K 10M 0K 0K 0K 0K id project nproc vm rss cap at avgat pg avgpg 112270 user1 24 123M 35M 50M 0K 0K 0K 0K 78194 user2 1 2368K 1856K 10M 0K 0K 0K 0K id project nproc vm rss cap at avgat pg avgpg 112270 user1 24 123M 35M 50M 0K 0K 0K 0K 78194 user2 1 2368K 1928K 10M 0K 0K 0K 0K id project nproc vm rss cap at avgat pg avgpg 112270 user1 24 123M 35M 50M 0K 0K 0K 0K 78194 user2 1 2368K 1928K 10M 0K 0K 0K 0K id project nproc vm rss cap at avgat pg avgpg 112270 user1 24 123M 35M 50M 0K 0K 0K 0K 78194 user2 1 2368K 1928K 10M 0K 0K 0K 0K |
The first three lines of output constitute the first report, which contains the cap and project information for the two projects and paging statistics since rcapd was started. The at and pg columns are a number greater than zero for user1 and zero for user2, which indicates that at some time in the daemon's history, user1 exceeded its cap but user2 did not.
The subsequent reports show no significant activity.
The following example uses project user1, which has an RSS in excess of its RSS cap.
The following command produces five reports at 5-second sampling intervals.
user1machine% rcapstat 5 5 |
id project nproc vm rss cap at avgat pg avgpg 376565 user1 3 6249M 6144M 6144M 690M 220M 5528K 2764K 376565 user1 3 6249M 6144M 6144M 0M 131M 4912K 1637K 376565 user1 3 6249M 6171M 6144M 27M 147M 6048K 2016K 376565 user1 3 6249M 6146M 6144M 4872M 174M 4368K 1456K 376565 user1 3 6249M 6156M 6144M 12M 161M 3376K 1125K |
The user1 project has three processes that are actively using physical memory. The positive values in the pg column indicate that rcapd is consistently paging out memory as it attempts to meet the cap by lowering the physical memory utilization of the project's processes. However, rcapd does not succeed in keeping the RSS below the cap value. This is indicated by the varying rss values that do not show a corresponding decrease. As soon as memory is paged out, the workload uses it again and the RSS count goes back up. This means that all of the project's resident memory is being actively used and the working set size (WSS) is greater than the cap. Thus, rcapd is forced to page out some of the working set to meet the cap. Under this condition, the system will continue to experience high page fault rates, and associated I/O, until one of the following occurs:
The WSS becomes smaller.
The cap is raised.
The application changes its memory access pattern.
In this situation, shortening the sample interval might reduce the discrepancy between the RSS value and the cap value by causing rcapd to sample the workload and enforce caps more frequently.
A page fault occurs when either a new page must be created or the system must copy in a page from a swap device.
The following example is a continuation of the previous example, and it uses the same project.
The previous example shows that the user1 project is using more physical memory than its cap allows. This example shows how much memory the project workload requires.
user1machine% rcapstat 5 5 id project nproc vm rss cap at avgat pg avgpg 376565 user1 3 6249M 6144M 6144M 690M 0K 689M 0K 376565 user1 3 6249M 6144M 6144M 0K 0K 0K 0K 376565 user1 3 6249M 6171M 6144M 27M 0K 27M 0K 376565 user1 3 6249M 6146M 6144M 4872K 0K 4816K 0K 376565 user1 3 6249M 6156M 6144M 12M 0K 12M 0K 376565 user1 3 6249M 6150M 6144M 5848K 0K 5816K 0K 376565 user1 3 6249M 6155M 6144M 11M 0K 11M 0K 376565 user1 3 6249M 6150M 10G 32K 0K 32K 0K 376565 user1 3 6249M 6214M 10G 0K 0K 0K 0K 376565 user1 3 6249M 6247M 10G 0K 0K 0K 0K 376565 user1 3 6249M 6247M 10G 0K 0K 0K 0K 376565 user1 3 6249M 6247M 10G 0K 0K 0K 0K 376565 user1 3 6249M 6247M 10G 0K 0K 0K 0K 376565 user1 3 6249M 6247M 10G 0K 0K 0K 0K 376565 user1 3 6249M 6247M 10G 0K 0K 0K 0K |
Halfway through the cycle, the cap on the user1 project was increased from 6 Gbytes to 10 Gbytes. This increase stops cap enforcement and allows the resident set size to grow, limited only by other processes and the amount of memory in the machine. The rss column might stabilize to reflect the project working set size (WSS), 6247M in this example. This is the minimum cap value that allows the project's processes to operate without continuously incurring page faults.
While the cap on user1 is 6 Gbytes, in every 5–second sample interval the RSS decreases and I/O increases as rcapd pages out some of the workload's memory. Shortly after a page out completes, the workload, needing those pages, pages them back in as it continues running. This cycle repeats until the cap is raised to 10 Gbytes, approximately halfway through the example. The RSS then stabilizes at 6.1 Gbytes. Since the workload's RSS is now below the cap, no more paging occurs. The I/O associated with paging stops as well. Thus, the project required 6.1 Gbytes to perform the work it was doing at the time it was being observed.
Also see the vmstat(1M) and iostat(1M) man pages.
You can use the -g option of rcapstat to report the following:
Current physical memory utilization as a percentage of physical memory installed on the system
System memory cap enforcement threshold set by rcapadm
The -g option causes a memory utilization and cap enforcement line to be printed at the end of the report for each interval.
# rcapstat -g id project nproc vm rss cap at avgat pg avgpg 376565 rcap 0 0K 0K 10G 0K 0K 0K 0K physical memory utilization: 55% cap enforcement threshold: 0% id project nproc vm rss cap at avgat pg avgpg 376565 rcap 0 0K 0K 10G 0K 0K 0K 0K physical memory utilization: 55% cap enforcement threshold: 0% |