Overview of Load Balancing

What Is Load Balancing?

Load balancing distributes SAS sessions across a cluster of servers. You can add or subtract servers to accommodate changes in peak demand.
You can create load-balancing clusters of SAS Workspace Servers, SAS Stored Process Servers, SAS Pooled Workspace Servers, and SAS OLAP Servers. For all clusters except OLAP, load balancing is handled by the object spawners that are associated with each server. SAS OLAP Servers do not use object spawners, so OLAP servers handle load balancing directly.
Pooled workspace servers are deployed in load-balancing clusters when you install them with the SAS Deployment Wizard. You can create clusters of the other server types at initial deployment, or at any time thereafter, without having to restart your SAS Metadata Server.
Load-balancing clusters use a peer-to-peer connection. One of the peers in the cluster acts as the parent for the cluster.
The following diagram depicts how peers read cluster metadata at initialization.
Cluster Initialization
Cluster Initialization and Client Assignment
1 Peers connect to and read configuration from the metadata server.
2 Peers attempt to connect to each other. One peer is designated to accept connections only from the other peers. This peer is known as the parent peer. Other peers are known as child peers. (Peers can be either object spawners or OLAP servers.)
The parent peer runs a load-balancing algorithm to determine the server that is best suited to accept another client. When the parent receives a client request, the parent either begins the session itself or redirects the client to a specific child peer.
If a child peer receives a connection request directly from a client, the child peer routes the request to the parent peer for assignment to the server with the least load.
The following diagram depicts how clients are assigned to a server in the cluster for workspace servers and stored process servers.
Client Assignment to Server (Workspace and Stored Process Servers)
Client Assignment to Server (Workspace and Stored Process Servers)
1 The parent receives a client request, applies it to its load-balancing algorithm, and redirects the client to connect to a specific peer.
2 In the case of a workspace server or a stored process server, the object spawner creates new server instance.
3 The client connects to that peer server.
The following diagram depicts how clients are assigned to a server in the cluster for OLAP servers.
Client Assignment to Server (OLAP Servers)
Client Assignment to Server (OLAP Servers)
1 The parent receives a client request, applies it to its load-balancing algorithm, and redirects the client to connect to a specific peer.
2 The client connects to that peer server.
During operation, if the parent peer terminates, one of the child peers assumes the role of parent peer. When you restart the former parent peer, it restarts as a child peer instead of the parent peer. The new parent peer remains the parent until that peer is restarted.
If a child peer terminates, load balancing continues across the remaining peers. When a child peer is restarted, the parent peer includes that peer in its routing of client requests with no interruption of service.
When you add or remove servers from a cluster, restart all of the peers (object spawners and OLAP servers) in the cluster to ensure that all servers read the latest metadata.
The following display shows how load balancing clusters are defined under a single application server and logical server in SAS Management Console.
Clustered Workspace Servers in SAS Management Console
Clustered Workspace Servers in SAS Management Console

Overview of Planning, Installation, and Configuration

To create a load-balancing cluster, you need to plan the configuration, create server metadata, install server and spawner software, configure the server software, and start the servers on their respective hosts.
In the planning stage, you select an application server, a logical server, separate server hosts, unique port numbers, a load-balancing algorithm, and server login credentials.
In the metadata creation stage, you use SAS Management Console to create metadata objects for each server and spawner in the cluster. You then convert the servers and spawners to load balancing.
In the server installation and configuration stage, you use the SAS Deployment Wizard in Install Only mode to install server software (without configuration files) on host computers. For clusters of workspace servers, stored process servers, and pooled workspace servers, you then use the SAS Deployment Wizard to install a spawner on each host. (SAS OLAP Servers do not use spawners.)
After software installation, you copy server configuration files from the cluster's logical server to the new servers that reside on different hosts. You then edit the configuration files and refresh the spawners or servers.

MultiBridge Connections (SAS Stored Process Servers Only)

When you configure load balancing for SAS Stored Process Servers, you must define at least one MultiBridge connection for each server in the cluster. A MultiBridge connection is a specialized bridge connection that is used for stored process servers. Each MultiBridge connection represents a separate server process and runs on a specific port.
The bridge connection for a stored process server is used only for the initial server request. After the spawner determines which server process has the least load, the client is redirected to the appropriate MultiBridge connection. That is, a client requests the bridge connection for a stored process server, and then the spawner redirects the client to the appropriate MultiBridge connection.

Overview of the Initial Load Balancing Setup for Stored Process Servers

In the initial load balancing SAS Stored Process Server configuration, three MultiBridge connections are set up for the stored process server so that the object spawner can start up to three stored process server processes. The object spawner balances the work load across these processes. The object spawner runs on the server host, listens for client requests, and redirects clients to the appropriate server process.
The metadata server's foundation repository contains the spawner, server, and security metadata for the load balancing stored process server configuration. The object spawner must connect to the metadata server, and the metadata must be configured appropriately, in order for the spawner to start the load balancing stored process server processes.
Note: On Windows, all user IDs are host or domain qualified, for example (domain-name\sastrust).
The object spawner obtains the metadata that it needs to start a load balancing stored process server as follows:
  1. When the spawner is started, it reads a metadata configuration file named metadataConfig.xml that contains information that is required to access the metadata server. This metadata configuration file specifies the following information:
    • the location of the metadata server
    • the user ID that the spawner will use to connect to the metadata server
    By default, the metadataConfig.xml file contains the user ID sastrust, which is owned by the SAS Trusted User (in the metadata).
  2. The object spawner connects to the metadata server with the user ID that is specified in metadataConfig.xml. This user's credentials are authenticated by the metadata server's authentication provider.
  3. On the metadata server, the connection from the object spawner is associated with the user that owns the sastrust user ID, SAS Trusted User. The spawner, as the SAS Trusted User, reads the metadata for the server and spawner configuration.
    Note: The SAS Trusted User can view the stored process server's multi-user login credentials (sassrv) because the SAS Trusted User is a member of the SAS General Servers group. The SAS General Servers group owns the server's multi-user login credentials.
At this point, the object spawner has the necessary metadata to launch a stored process server.
When a client requests a server, the client connects to the spawner and is authenticated using the token that the client received when it connected to the metadata server.
If the object spawner needs to launch a new stored process server, then the object spawner uses the server's multi-user login credentials (sassrv) to launch the load-balancing stored process server.
Note: Because the stored process server runs under the multi-user login credentials that are specified in the stored process server definition, each client can access information that only sassrv has permission to access.
In your initial load balancing stored process server configuration, you must ensure that the following security is set up properly:
  • Ensure that the SAS Trusted User's credentials are specified in the metadata configuration file metadataConfig.xml.
  • Using the Authentication Manager in SAS Management Console, ensure that, in the foundation metadata repository, the SAS Trusted User is a member of the SAS General Servers group.
  • Ensure that the SAS Trusted User has access to the metadata definitions for the object spawner and any servers that it manages.
  • Ensure that, in the foundation metadata repository, the group login that is owned by the SAS General Servers group is specified in the stored process server definition. The server login credentials are provided on the Options tab of the server's Properties window.
  • Ensure that the user ID and password of the group login for the SAS General Servers group match the credentials in a user account that is defined in the stored process server's host authentication provider.

Security

With load balancing, every connection to the server is authenticated with the credentials of the client. Also, every client must have ReadMetadata permission on the server.
The credentials that the server runs under depend on the type of the server:
  • SAS Workspace Servers run under the credentials of the client.
  • SAS Stored Process Servers and SAS Pooled Workspace Servers run under the multi-user login credentials that are specified in the stored process server definition.
    Note: Because the load-balancing stored process server runs under the multi-user login credentials, the operating system account for these credentials must have access to any operating system resources used by stored processes that are hosted on the stored process server.
  • SAS OLAP Servers run under credentials of whoever launches it. If it is launched as a service on Windows, this is the local system account by default.

Load-Balancing Algorithms

The parent peer in a load-balancing cluster runs a load-balancing algorithm to evaluate server load and select child peers for new SAS sessions. Five algorithms are available: Cost, Response Time, Grid, Most Recently Used, and Least Recently Used. SAS OLAP Servers are required to use the Least Recently Used or the Grid algorithms. Other types of load-balancing clusters enable you to select between two or more available algorithms.

Log Files

At installation, clustered servers are configured to generate the same error log files that are generated by default on servers that are not clustered, as described in the chapter “Administering Logging for SAS Servers” in the SAS Intelligence Platform: System Administration Guide.
Clusters of SAS OLAP Servers, SAS DATA Step Batch Servers, and SAS/CONNECT Servers generate separate ARM log files in addition to their error log files. You should enable ARM logs only when you are tuning and testing your clusters.
CAUTION:
To ensure the accuracy of your ARM log files, be sure to configure your cluster so that each server writes to a separate ARM log file.
Log files are configured as described in Edit logconfig.xml.