<chapter id="rmintro-1"><title>Introduction to Solaris Resource Management</title><highlights><para>Resource management functionality is a component of the <trademark>Solaris</trademark> Container
environment. Resource management enables you to control how applications use
available system resources. You can do the following:</para><itemizedlist><listitem><para>Allocate computing resources, such as processor time</para>
</listitem><listitem><para>Monitor how the allocations are being used, then adjust the
allocations as necessary</para>
</listitem><listitem><para>Generate extended accounting information for analysis, billing,
and capacity planning</para>
</listitem>
</itemizedlist><para>This chapter covers the following topics.</para><itemizedlist><listitem><para><olink targetptr="rmintro-21" remap="internal">Resource Management Overview</olink></para>
</listitem><listitem><para><olink targetptr="rmintro-2" remap="internal">When to Use Resource Management</olink></para>
</listitem><listitem><para><olink targetptr="rmintro-29" remap="internal">Setting Up Resource Management
(Task Map)</olink></para>
</listitem>
</itemizedlist>
</highlights><sect1 id="rmintro-21"><title>Resource Management Overview</title><para>Modern computing environments have to provide a flexible response to
the varying workloads that are generated by different applications on a system.
A <emphasis>workload</emphasis> is an aggregation of all processes of an application
or group of applications. If resource management features are not used, the
Solaris Operating System responds to workload demands by adapting to new application
requests dynamically. This default response generally means that all activity
on the system is given equal access to resources. Solaris resource management
features enable you to treat workloads individually. You can do the following:</para><itemizedlist><listitem><para>Restrict access to a specific resource</para>
</listitem><listitem><para>Offer resources to workloads on a preferential basis</para>
</listitem><listitem><para>Isolate workloads from each another</para>
</listitem>
</itemizedlist><para>The ability to minimize cross-workload performance compromises,
along with the facilities that monitor resource usage and utilization, is
referred to as <emphasis>resource management</emphasis>. Resource management
is implemented through a collection of algorithms. The algorithms handle the
series of capability requests that an application presents in the course of
its execution.</para><para>Resource management facilities permit you to modify the default behavior
of the operating system with respect to different workloads. <emphasis>Behavior</emphasis> primarily
refers to the set of decisions that are made by operating system algorithms
when an application presents one or more resource requests to the system.
You can use resource management facilities to do the following:</para><itemizedlist><listitem><para>Deny resources or prefer one application over another for
a larger set of allocations than otherwise permitted</para>
</listitem><listitem><para>Treat certain allocations collectively instead of through
isolated mechanisms</para>
</listitem>
</itemizedlist><para>The implementation of a system configuration that uses the resource
management facilities can serve several purposes. You can do the following:</para><itemizedlist><listitem><para>Prevent an application from consuming resources indiscriminately</para>
</listitem><listitem><para>Change an application's priority based on external events</para>
</listitem><listitem><para>Balance resource guarantees to a set of applications against
the goal of maximizing system utilization</para>
</listitem>
</itemizedlist><para>When planning a resource-managed configuration, key requirements include
the following:</para><itemizedlist><listitem><para>Identifying the competing workloads on the system</para>
</listitem><listitem><para>Distinguishing those workloads that are not in conflict from
those workloads with performance requirements that compromise the primary
workloads</para>
</listitem>
</itemizedlist><para>After you identify cooperating and conflicting workloads, you can create
a resource configuration that presents the least compromise to the service
goals of the business, within the limitations of the system's capabilities.</para><para>Effective resource management is enabled in the Solaris system by offering
control mechanisms, notification mechanisms, and monitoring mechanisms. Many
of these capabilities are provided through enhancements to existing mechanisms
such as the <olink targetdoc="group-refman" targetptr="proc-4" remap="external"><citerefentry><refentrytitle>proc</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink> file
system, processor sets, and scheduling classes. Other capabilities are specific
to resource management. These capabilities are described in subsequent chapters.</para><sect2 id="rmintro-27"><title>Resource Classifications</title><para>A resource is any aspect of the computing system that can be manipulated
with the intent to change application behavior. Thus, a resource is a capability
that an application implicitly or explicitly requests. If the capability is
denied or constrained, the execution of a robustly written application proceeds
more slowly.</para><para>Classification of resources, as opposed to identification of resources,
can be made along a number of axes. The axes could be implicitly requested
as opposed to explicitly requested, time-based, such as CPU time, compared
to time-independent, such as assigned CPU shares, and so forth.</para><para>Generally, scheduler-based resource management is applied to resources
that the application can implicitly request. For example, to continue execution,
an application implicitly requests additional CPU time. To write data to a
network socket, an application implicitly requests bandwidth. Constraints
can be placed on the aggregate total use of an implicitly requested resource.</para><para>Additional interfaces can be presented so that bandwidth or CPU service
levels can be explicitly negotiated. Resources that are explicitly requested,
such as a request for an additional thread, can be managed by constraint.</para>
</sect2><sect2 id="rmintro-23"><title>Resource Management Control Mechanisms</title><para>The three types of control mechanisms that are available in the Solaris
Operating System are constraints, scheduling, and partitioning.</para><sect3 id="rmintro-24"><title>Constraint Mechanisms</title><para>Constraints allow the administrator or application developer to set
bounds on the consumption of specific resources for a workload. With known
bounds, modeling resource consumption scenarios becomes a simpler process.
Bounds can also be used to control ill-behaved applications that would otherwise
compromise system performance or availability through unregulated resource
requests.</para><para>Constraints do present complications for the application. The
relationship between the application and the system can be modified to the
point that the application is no longer able to function. One approach that
can mitigate this risk is to gradually narrow the constraints on applications
with unknown resource behavior. The resource controls feature discussed in <olink targetptr="rmctrls-1" remap="internal">Chapter&nbsp;6, Resource Controls (Overview)</olink> provides
a constraint mechanism. Newer applications can be written to be aware of their
resource constraints, but not all application writers will choose to do this.</para>
</sect3><sect3 id="rmintro-25"><title>Scheduling Mechanisms</title><para>Scheduling refers to making a sequence of allocation decisions
at specific intervals. The decision that is made is based on a predictable
algorithm. An application that does not need its current allocation leaves
the resource available for another application's use. Scheduling-based resource
management enables full utilization of an undercommitted configuration, while
providing controlled allocations in a critically committed or overcommitted
scenario. The underlying algorithm defines how the term &ldquo;controlled&rdquo;
is interpreted. In some instances, the scheduling algorithm might guarantee
that all applications have some access to the resource. The fair share scheduler
(FSS) described in <olink targetptr="rmfss-1" remap="internal">Chapter&nbsp;8, Fair Share Scheduler
(Overview)</olink> manages application access to CPU resources in a controlled
way.</para>
</sect3><sect3 id="rmintro-26"><title>Partitioning Mechanisms</title><para>Partitioning is used to bind a workload to a subset of the system's
available resources. This binding guarantees that a known amount of resources
is always available to the workload. The resource pools functionality that
is described in <olink targetptr="rmpool-1" remap="internal">Chapter&nbsp;12, Resource Pools
(Overview)</olink> enables you to limit workloads to specific subsets of the
machine.</para><para>Configurations that use partitioning can avoid system-wide overcommitment.
However, in avoiding this overcommitment, the ability to achieve high utilizations
can be reduced. A reserved group of resources, such as processors, is not
available for use by another workload when the workload bound to them is idle.</para>
</sect3>
</sect2><sect2 id="rmintro-28"><title>Resource Management Configuration</title><para>Portions of the resource management configuration can be placed in a
network name service. This feature allows the administrator to apply resource
management constraints across a collection of machines, rather than on an
exclusively per-machine basis. Related work can share a common identifier,
and the aggregate usage of that work can be tabulated from accounting data.</para><para>Resource management configuration and workload-oriented identifiers
are described more fully in <olink targetptr="rmtaskproj-1" remap="internal">Chapter&nbsp;2,
Projects and Tasks (Overview)</olink>. The extended accounting facility that
links these identifiers with application resource usage is described in <olink targetptr="rmacct-1" remap="internal">Chapter&nbsp;4, Extended Accounting (Overview)</olink>. </para>
</sect2><sect2 id="rmintro-38"><title>Interaction With Non-Global Zones</title><para>Resource management features can be used with zones to further refine
the application environment. Interactions between these features and zones
are described in applicable sections in this guide.</para>
</sect2>
</sect1><sect1 id="rmintro-2"><title>When to Use Resource Management</title><para>Use resource management to ensure that your applications have the required
response times.</para><para>Resource management can also increase resource utilization. By categorizing
and prioritizing usage, you can effectively use reserve capacity during off-peak
periods, often eliminating the need for additional processing power. You can
also ensure that resources are not wasted because of load variability.</para><sect2 id="rmintro-13"><title>Server Consolidation</title><para>Resource management is ideal for environments that consolidate a number
of applications on a single server.</para><para>The cost
and complexity of managing numerous machines encourages the consolidation
of several applications on larger, more scalable servers. Instead of running
each workload on a separate system, with full access to that system's resources,
you can use resource management software to segregate workloads within the
system. Resource management enables you to lower overall total cost of ownership
by running and controlling several dissimilar applications on a single Solaris
system.</para><para>If you are providing Internet and application services, you can use
resource management to do the following:</para><itemizedlist><listitem><para>Host multiple web servers on a single machine. You can control
the resource consumption for each web site and you can protect each site from
the potential excesses of other sites.</para>
</listitem><listitem><para>Prevent a faulty common gateway interface (CGI) script from
exhausting CPU resources.</para>
</listitem><listitem><para>Stop an incorrectly behaving application from leaking all
available virtual memory.</para>
</listitem><listitem><para>Ensure that one customer's applications are not affected by
another customer's applications that run at the same site.</para>
</listitem><listitem><para>Provide differentiated levels or classes of service on the
same machine.</para>
</listitem><listitem><para>Obtain accounting information for billing purposes.</para>
</listitem>
</itemizedlist>
</sect2><sect2 id="rmintro-15"><title>Supporting a Large or Varied User Population</title><para>Use resource management features in any system that has a large, diverse
user base, such as an educational institution. If you have a mix of workloads,
the software can be configured to give priority to specific projects.</para><para>For example, in large brokerage firms, traders intermittently require
fast access to execute a query or to perform a calculation. Other system users,
however, have more consistent workloads. If you allocate a proportionately
larger amount of processing power to the traders' projects, the traders have
the responsiveness that they need.</para><para>Resource management is also ideal for supporting thin-client systems.
These platforms provide stateless consoles with frame buffers and input devices,
such as smart cards. The actual computation is done on a shared server, resulting
in a timesharing type of environment. Use resource management features to
isolate the users on the server. Then, a user who generates excess load does
not monopolize hardware resources and significantly impact others who use
the system.</para>
</sect2>
</sect1><sect1 id="rmintro-29"><title>Setting Up Resource Management (Task Map)</title><para>The following task map provides a high-level overview of the steps that
are involved in setting up resource management on your system.</para><informaltable frame="all" pgwide="1"><tgroup cols="3" colsep="1" rowsep="1"><colspec colwidth="33*"/><colspec colwidth="33*"/><colspec colwidth="33*"/><thead><row><entry><para>Task</para>
</entry><entry><para>Description</para>
</entry><entry><para>For Instructions</para>
</entry>
</row>
</thead><tbody><row><entry><para>Identify the workloads on your system and categorize each workload by
project.</para>
</entry><entry><para>Create project entries in either the <filename>/etc/project</filename> file,
in the NIS map, or in the LDAP directory service.</para>
</entry><entry><para><olink targetptr="rmtaskproj-9" remap="internal">project Database</olink></para>
</entry>
</row><row><entry><para>Prioritize the workloads on your system.</para>
</entry><entry><para>Determine which applications are critical. These workloads might require
preferential access to resources.</para>
</entry><entry><para>Refer to your business service goals.</para>
</entry>
</row><row><entry><para>Monitor real-time activity on your system.</para>
</entry><entry><para>Use performance tools to view the current resource consumption of workloads
that are running on your system. You can then evaluate whether you must restrict
access to a given resource or isolate particular workloads from other workloads.</para>
</entry><entry><para><olink targetptr="rmconsole-5" remap="internal">Monitoring by System</olink> and <olink targetdoc="group-refman" targetptr="cpustat-1m" remap="external"><citerefentry><refentrytitle>cpustat</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink>, <olink targetdoc="group-refman" targetptr="iostat-1m" remap="external"><citerefentry><refentrytitle>iostat</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink>, <olink targetdoc="group-refman" targetptr="mpstat-1m" remap="external"><citerefentry><refentrytitle>mpstat</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink>, <olink targetdoc="group-refman" targetptr="prstat-1m" remap="external"><citerefentry><refentrytitle>prstat</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink>, <olink targetdoc="group-refman" targetptr="sar-1" remap="external"><citerefentry><refentrytitle>sar</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink>, and <olink targetdoc="group-refman" targetptr="vmstat-1m" remap="external"><citerefentry><refentrytitle>vmstat</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man pages</para>
</entry>
</row><row><entry><para>Make temporary modifications to the workloads that are running on your
system.</para>
</entry><entry><para>To determine which values can be altered, refer to the resource controls
that are available in the Solaris system. You can update the values from the
command line while the task or process is running.</para>
</entry><entry><para><olink targetptr="rmctrls-4" remap="internal">Available Resource Controls</olink>, <olink targetptr="rmctrls-7" remap="internal">Global and Local Actions on Resource Control Values</olink>, <olink targetptr="rmctrls-13" remap="internal">Temporarily Updating Resource Control Values on a Running
System</olink> and <olink targetdoc="group-refman" targetptr="rctladm-1m" remap="external"><citerefentry><refentrytitle>rctladm</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> and <olink targetdoc="group-refman" targetptr="prctl-1" remap="external"><citerefentry><refentrytitle>prctl</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> man pages.</para>
</entry>
</row><row><entry><para>Set resource controls and project attributes for every project entry
in the <filename>project</filename> database or naming service project database.</para>
</entry><entry><para>Each project entry in the <filename>/etc/project</filename> file or
the naming service project database can contain one or more resource controls
or attributes. Resource controls constrain tasks and processes attached to
that project. For each threshold value that is placed on a resource control,
you can associate one or more actions to be taken when that value is reached.</para><para>You can set resource controls by using the command-line interface. Certain
configuration parameters can also be set by using the Solaris Management Console.</para>
</entry><entry><para><olink targetptr="rmtaskproj-9" remap="internal">project Database</olink>, <olink targetptr="rmtaskproj-12" remap="internal">Local /etc/project File Format</olink>, <olink targetptr="rmctrls-4" remap="internal">Available Resource Controls</olink>, <olink targetptr="rmctrls-7" remap="internal">Global and Local Actions on Resource Control Values</olink>,
and <olink targetptr="rmfss-1" remap="internal">Chapter&nbsp;8, Fair Share Scheduler (Overview)</olink></para>
</entry>
</row><row><entry><para>Place an upper bound on the resource consumption of physical memory
by collections of processes attached to a project.</para>
</entry><entry><para>The resource cap enforcement daemon will enforce the physical memory
resource cap defined for the project's <literal>rcap.max-rss</literal> attribute
in the <filename>/etc/project</filename> file.</para>
</entry><entry><para><olink targetptr="rmtaskproj-9" remap="internal">project Database</olink> and <olink targetptr="rm.rcapd-1" remap="internal">Chapter&nbsp;10, Physical Memory Control Using the
Resource Capping Daemon (Overview)</olink></para>
</entry>
</row><row><entry><para>Create resource pool configurations.</para>
</entry><entry><para>Resource pools provide a way to partition system resources, such as
processors, and maintain those partitions across reboots. You can add one <command>project.pool</command> attribute to each entry in the <command>/etc/project</command> file.</para>
</entry><entry><para><olink targetptr="rmtaskproj-9" remap="internal">project Database</olink> and <olink targetptr="rmpool-1" remap="internal">Chapter&nbsp;12, Resource Pools (Overview)</olink></para>
</entry>
</row><row><entry><para>Make the fair share scheduler (FSS) your default system scheduler.</para>
</entry><entry><para>Ensure that all user processes in either a single CPU system or a processor
set belong to the same scheduling class.</para>
</entry><entry><para><olink targetptr="rmfss.task-5" remap="internal">Configuring the FSS</olink> and <olink targetdoc="group-refman" targetptr="dispadmin-1m" remap="external"><citerefentry><refentrytitle>dispadmin</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page</para>
</entry>
</row><row><entry><para>Activate the extended accounting facility to monitor and record resource
consumption on a task or process basis.</para>
</entry><entry><para>Use extended accounting data to assess current resource controls and
to plan capacity requirements for future workloads. Aggregate usage on a system-wide
basis can be tracked. To obtain complete usage statistics for related workloads
that span more than one system, the project name can be shared across several
machines.</para>
</entry><entry><para><olink targetptr="rmacct.task-2" remap="internal">How to Activate Extended Accounting
for Processes, Tasks, and Flows</olink> and <olink targetdoc="group-refman" targetptr="acctadm-1m" remap="external"><citerefentry><refentrytitle>acctadm</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page</para>
</entry>
</row><row><entry><para>(Optional) If you need to make additional adjustments to your configuration,
you can continue to alter the values from the command line. You can alter
the values while the task or process is running.</para>
</entry><entry><para>Modifications to existing tasks can be applied on a temporary basis
without restarting the project. Tune the values until you are satisfied with
the performance. Then, update the current values in the <filename>/etc/project</filename> file
or in the naming service project database.</para>
</entry><entry><para><olink targetptr="rmctrls-13" remap="internal">Temporarily Updating Resource Control
Values on a Running System</olink> and <olink targetdoc="group-refman" targetptr="rctladm-1m" remap="external"><citerefentry><refentrytitle>rctladm</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> and <olink targetdoc="group-refman" targetptr="prctl-1" remap="external"><citerefentry><refentrytitle>prctl</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> man pages</para>
</entry>
</row><row><entry><para>(Optional) Capture extended accounting data.</para>
</entry><entry><para>Write extended accounting records for active processes and active tasks.
The files that are produced can be used for planning, chargeback, and billing
purposes. There is also a Practical Extraction and Report Language (Perl)
interface to <filename>libexacct</filename> that enables you to develop customized
reporting and extraction scripts.</para>
</entry><entry><para><olink targetdoc="group-refman" targetptr="wracct-1m" remap="external"><citerefentry><refentrytitle>wracct</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man
page and <olink targetptr="rmacct-7" remap="internal">Perl Interface to libexacct</olink></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect1>
</chapter>