Resource-aware scheduling for sessions

This feature provides a means for the application developer to state a resource preference for host attributes that provide the best match for the workload in a session.

Scope


Applicability

Details

Operating system

  • Windows

  • Linux

  • Solaris

Limitations

Not applicable to Symphony DE


About resource preference

In a typical cluster environment, all machines are not identical. Some machines may be slower and some machines may have less memory than others. If you configure a resource requirement at the application level, all sessions for that application have to use the same set of resources. However, it may not be the case that all sessions are the best match for the resources. Some sessions may benefit from special resources so that results can be computed in the most optimal way.

With the resource preference feature you can specify a preferential association between a session and a host that possesses the attributes best suited to process the workload. The association is based on the evaluation of a user-defined expression containing resource attributes capable of being monitored. The evaluation of this expression is carried out against the attributes of each host available to the session. Typically, a resource attribute may be a preferred attribute of host machines that you want the service to be running on when it processes the workload. These resource attributes are made available to the middleware on a continuous basis whether or not there are sessions that make use of this information.

When you state a resource preference, there is no guarantee that you will receive the hosts with the preferred attributes; this depends on the resources available at the time the workload is being scheduled.

The following example illustrates the concept of resource preference for sessions. Resources are assigned to the session based on the resource preference at the session level. In this case, it is determined that session 1 prefers to run on hosts with the most memory (-mem). Host A, B, and C have 16 GB memory while host D has 4 GB. The SSM collects metadata (host attributes) from all the resources available to session1 at that moment and selects Host A, B and C since they represent the best match for the session according to the specified preference. Note that if session 2 had been created before session 1 and it had no resource preference, any of the four hosts could have been allocated to session 2. In that case, session 1 would only have the three remaining hosts available.

How preference is considered

When no preference is specified, there will not be any preference evaluation when assigning a service to a session. Once a service is assigned, tasks will be dispatched in the usual manner.

When a preference is specified, there are two opportunities for the preference evaluation to be done:

  1. Upon initial assignment of an idle or new host. In this case, preferences are evaluated before ordering the available hosts for assignment. Services that have been pre-started, or in standby and idle will most likely have enough information collected to make the best assignment decision.

  2. Reassignment of services due to rebalancing of resources. In this case, if a service can be reassigned to multiple sessions, an evaluation can be done to determine which session the service has the best affinity with.

Expressing resource preference

Specifying attributes in a preference expression

Attributes take the form of identifiers and can be applied with the +, -, *, and / operators within an expression. An example of an expression would be "-mem", meaning that it is preferred to send workload to a host that possesses the most memory. The “/” and “*” operators can be used to normalize the preference string if you are setting preference for disparate types of attributes such as mem and cpu factor in the same expression. The “- “operator can be used to reverse the direction of the attribute. For example, since the best preference is the expression that resolves to the lowest value then if you want the most memory you can use the “-“ to reverse the direction so that the hosts with the most memory will have the most negative value and hence will be more favorable.

Attribute names can only contain alphanumeric and underscore characters; if you want to use resource attributes with names that do not comply with these rules, aliases must be defined. A resource attribute definition can be used to define an alias and to override the default value for an attribute should the session level default or system default be inappropriate.

The following out-of-the-box attributes are related to the host the service is running on and are available for use in a resource preference expression. See the Load Indices topic in the Symphony Reference guide for details.


Attribute

Description

Range

Preference Representation

Run queue length

The number of processes running on the host over the last 15 seconds

0.0 - MAX Float

r15s

Run queue length

The number of processes running on the host over the last minute.

0.0 - MAX Float

r1m

Run queue length

The number of processes running on the host over the last 15 minutes.

0.0 - MAX Float

r15m

CPU utilization

The percent of the overall processing power that is currently being used on the host averaged over the last minute.

0.0 - 1.0

ut

Paging activity

The number of pages being swapped in and out of memory per second averaged over the last minute.

0.0 - MAX Float

pg

Logins

The number of users logged into the host.

0.0 - MAX Float

ls

Idle time

The amount of time the host been idle for.

0.0 - MAX Float

it

Available swap space

The number of megabytes of swap space available on the host.

0.0 - MAX Float

swp

Available memory

The number of megabytes of physical memory available on the host.

0.0 - MAX Float

mem

Available temporary file space

The number of megabytes of disk space available in the temporary file directory.

0.0 - MAX Float

tmp

I/O activity

The number of kilobytes being written to disk per second averaged over the last minute.

0.0 - MAX Float

io


How Symphony handles the result of the expression

The result of each expression is a numeric value that is obtained by applying the operators to the attributes in the expression. Once the result is obtained for each resource being evaluated, it is be used to sort the resources in ascending order. This means the resource that evaluates to the lowest value is the most preferred.

When no information is available for a resource attribute that is involved in a resource evaluation, the resolution of the expression still proceeds. In such cases, Symphony attempts to substitute a default value for each attribute that it cannot resolve. The value of the attribute is resolved by the system in the following manner, in the given order:

  1. attempt to find any collected value

  2. retrieve the configured default for the session (if defined)

  3. retrieve the system default (1.0E+300)

Configuring resource preference

Enabling resource preference for sessions

Resource preference is enabled at the application level with the schedulingAffinity attribute in the Consumer element of the application profile. When the attribute is set to ResourceAware, metadata is collected by the SSM and the resource preference is applied.

Example:

<Consumer applicationName="SharingDataCPP" ...schedulingAffinity="ResourceAware" />

The schedulingAffinity attribute can be configured through the PMC or by manually editing the application profile.

Configuring resource preference for sessions

Resource preference is configured in the SessionTypes element of the application profile. The preference expression is specified with the preference attribute. The default value for the preference expression, in the event that the value of the attribute in the expression is not known, is configured with the defaultResourceAttributeValue attribute.

Example:

<SessionTypes>
<Type name="typeA" ... preference="-mem"
defaultResourceAttributeValue="1.0" />
</SessionTypes>

The preference and defaultResourceAttributeValue attributes can be configured through the PMC or by manually editing the application profile.

Client API

Resource preference for sessions can be configured using the client-side API. This configuration overrides the setting in the application profile. For more information about the API, refer to the API reference documentation.

Defining default attribute values for the session

You can define a substitute value for attributes in a preference expression in the event that those attributes are unknown at the time of evaluation. If this default value is not specified, the system default, i.e., the 1.0E+300 value, is substituted.

Example:

SessionCreationAttributes.setDefaultResourceAttributeValue (float)

Specifying resource preference

You can programmatically describe any preference for resources.

Example:

ResourcePreference rp ("-mem")

This expression means that it is preferred to run this workload on a host that has the most memory.

Associating a resource preference with a session

A resource preference is associated with a session by binding it to a SessionCreationAttributes object.

Example:

ResourcePreference rp (“-mem”);
SessionCreationAttributes sessionAttributes();
sessionAttributes.setResourcePreference(rp)