Installing and Administering Solaris Container Manager 3.6.1

Creating an Application-Based Project


Note –

In the Solaris 8 OS, only the user-based container type is supported.


Use an application-based project to manage the processes that run in a particular software application. You can create an application-based project that moves the processes automatically or one that enables you to move the processes manually.

If you can provide a match expression that is truly unique to the application, you can add this expression to the project. You must also provide the UNIX user ID or UNIX group ID under which the processes will run. Additional users or groups that have the right to join the project at a later time can be added as well. To automatically move processes into the project, you must provide all required project identifiers when the corresponding wizard panel appears. The software then moves all matching processes automatically for all the projects that are based on this definition.

If the application does not create truly unique identifiers, then you will want to move the processes manually or start the application inside the project. If you want to move the processes manually, create the project with only the UNIX user ID or UNIX group ID under which the processes will run. Additional users or groups that have the right to join the project at a later time can be added as well. Then move the processes with the newtask -p command. For more information, see Moving or Starting Processes in a Project.

ProcedureTo Determine the Match Expression for an Application

Use this procedure to determine the correct match expression to identify the processes corresponding to the application you want to manage. This expression is required in the New Container wizard to move processes automatically into a container.

Steps
  1. From a terminal window, start the application that the application-based container will manage.

  2. To see a list of all processes that are running, in a terminal window type:


    % ps -cafe
    
  3. In the CMD column, locate the corresponding executable name.

    Choose the expression that will uniquely identify the application's processes.


Example 4–1 Determining a Match Expression For Mozilla

The following is an example of output from the ps - cafe command in a search for Mozilla:


% ps -cafe
     UID   PID  PPID  CLS PRI    STIME TTY      TIME CMD
    ...
username  8044  7435   IA  50 19:47:09 pts/11   0:00 /bin/ksh -p /usr/sfw/lib/mozilla/mozilla

In this example, the unique executable name is mozilla. Likewise, a correct match expression is mozilla.



Example 4–2 Determining a Match Expression for Tomcat Server

When you know the name of the application, you can use the grep command in conjunction with ps -cafe to locate the correct match expression. The following is an example of output from the ps - cafe | grep tomcat command in a search for Tomcat server. This example has been condensed for space, leaving the irrelevant information.


% ps -cafe | grep tomcat
  nobody 27307  /usr/j2se/bin/java -classpath //usr/apache/tomcat/bin/bootstrap.jar:/usr/j2se/l
 

In this example, the executable name is java. However, the correct match expression is tomcat. In this case, the match expression is the argument instead of the executable name, as java does not uniquely identify the Tomcat processes.



Example 4–3 Verifying a Match Expression for Tomcat Server

The following example shows how to use the pgrep command to find the PID. The PID verifies that you have identified the unique match expression for finding the desired process:


% pgrep -f tomcat
27307

The PID for Tomcat server is 27307. This number matches the PID from Example 4–2. This match confirms that the match expression tomcat corresponds to the Tomcat server process.


ProcedureTo Create an Application-Based Project

Steps
  1. start the New Project wizard, as described in To Start the New Project Wizard.

    The Overview panel appears.

  2. Select Application as the project type for the container.

    The application-based project container tracks processes that are associated with the application. For more information about this project type, see Table 3–2.

  3. Provide a name for the project.

    The name must be unique and not exceed 32 characters. This name identifies the project in the navigation window, status tables, and resource utilization reports. If a duplicate name is typed, the creation of the project fails.

    A container name cannot be changed after the creation procedure is finished.

  4. Provide either the UNIX user names or UNIX group names under which the application's processes will run.

    The UNIX user names or UNIX group names under which the application's processes will run must be supplied. If these names are not provided, the corresponding processes will not be moved under the container until they are supplied. Separate multiple entries with a comma.

  5. Determine whether you want to move application processes under the project automatically when the container is activated or to move them manually from the command line.

    • To indicate that you want to move application processes manually from the command line, select the check box Do Not Use Match Expression.

    • To move application processes under the project automatically when the project is activated, provide an expression in the Match Expression field.

      You can use wildcards in the Match Expression field to identify the processes that are associated with an application. Examples of match expressions using wildcards are moz, cat that identify the processes associated with Mozilla and Tomcat respectively.

      Project Application Process Identifiers in New Project Wizard

      The match expression must be supplied to automatically move the application's processes to the container. This expression is case sensitive. To determine the correct match expression, see To Determine the Match Expression for an Application.

      If a match expression is not provided at this time, the application's processes will not be moved under this container until this expression is supplied.

  6. If you access the New Project wizard from the host name (without selecting a pool), assign a resource pool that supports the project's resource requirements.

    New processes that are started in a project are bound to the corresponding resource pool. After the project is activated, the new processes that are held in the container are bound to its resource pool.

    • To assign a new resource pool:

      1. Select Create a New Resource Pool.

      2. Provide a name for the resource pool.

        The name must be alphanumeric and contain no spaces. The characters dash (-), underscore (_), and dot (.) are allowed.

      3. Assign the number of CPUs.

        The number of CPUs must be an integer not less than one and cannot exceed the number of CPUs available on the host. The total number of CPUs on the host and the number that are currently available are shown.

    • To assign an existing pool:

      1. Select Use an Existing Resource Pool.

        A list of available resource pools is displayed.

      2. Select the radio button next to the pool's name in the list.

        To total number of CPUs assigned to each resource pool is given, as well as the amount of unreserved CPU still available in each pool. The project is bound to the selected resource pool.

  7. (Solaris 10 only) Select an existing zone.

    Click the button from one of the available zones.

  8. Provide the resource reservations for the project.

    The maximum CPUs, unreserved CPU shares, and memory resources that are available on the host is provided.

    The CPU reservation (CPU shares) is required and must be provided as an integer. A project with a CPU reservation of zero receives CPU resources only when no processes are running in any other container that is associated with the same host.

    The memory cap is optional and should be provided in Mbytes.

    The shared memory value is the total amount of shared memory allowed to be used by the processes that run within this project. The shared memory is also optional. The default value of the shared memory is one-quarter of the physical memory.

  9. Provide a name for the container.

    The name must be unique and not exceed 32 characters. This name identifies the container in the navigation window, status tables, and resource utilization reports. If a duplicate name is entered, the creation of the container will fail. A container name cannot be changed after the creation procedure is finished.

  10. (Optional) Provide a description for the container.

  11. Review the information in the Summary panel.

    Application Project Summary screen
  12. Click Finish.

    The selections are saved, and the container is now active. The Solaris kernel begins enforcing the container's resource reservations.