Using CGroups and Memory Limits

Manage CPU Usage

In terms of managing CPU usage, you can specify a TKMPI_CGROUP setting in the resource.settings file like the following:
# Cgroup to associate with TKGrid jobs.
export TKMPI_CGROUP="cgexec -g cpu:50"
By itself, specifying the option does not do anything. You need to create a cgroup, in this case, named 50 and assign CPU shares to the group. If you are not familiar with assigning CPU shares, you can use the SAS High-Performance Computing Management Console for managing the cgroups.

Manage Memory

There are two settings in the resource.settings file that are related to memory usage.
# VM limit (in KBytes). Default is unlimited
export TKMPI_ULIMIT="-v 50000000"

# Memory allocation limit (in MBytes). Excludes mmapped files. 
# Default is unlimited.
export TKMPI_MEMSIZE=2097152
Some choices for using these settings are as follows:
TKMPI_ULIMIT
Sets a limit for the entire process. For SAS LASR Analytic Server, this includes the memory that is required to run the server itself, all tables, and memory that is used for processing actions. Specifically, the memory that is used when loading SASDHAT tables to memory is included in the limit.
TKMPI_MEMSIZE
Sets a limit to the size of in-memory tables and memory that is used for processing actions. SASHDAT tables that are loaded to memory are not included in the limit.
If you use these options for managing memory, be aware that the server uses memory for temporary operations like identifying distinct counts of values or grouping observations. If your goal is to limit the amount of memory that is used for in-memory tables, then include some overhead.
Also keep in mind that the default behavior for a server is to reject requests add tables or append data after 75% of memory is used on the machine. This percentage is configurable with the TABLEMEM= option to the SERVERPARMS statement for the IMSTAT and VASMP procedures. As with the TKMPI_MEMSIZE setting, the TABLEMEM= percentage does not apply to SASHDAT tables.