SAS 9.1.3 Integration Technologies » Server Administrator's Guide


Pooling and Load Balancing
Pooling
Planning and Configuring Pooling
Load Balancing
Planning and Configuring a Load-Balancing Cluster
Planning the Load-Balancing Algorithm
Reference Materials
Fields for the Server Definition
Fields for the Pooling Logical Server Definition
Fields for the Load-Balancing Logical Server Definition
Pooling and Load Balancing

Planning the Load-Balancing Algorithm Properties

Overview of Load-Balancing Algorithms

SAS 9.1 Integration Technologies supports the following load-balancing algorithms:

Note: The Cost algorithm is recommended for both SAS Workspace Servers and SAS Stored Process Servers.


Cost Algorithm

Overview of the Cost Algorithm

The Cost algorithm uses a cost value to represent the workload that is assigned to each server (or server process) in the load-balancing cluster. Each time a client connects or a stored process is executed, the load-balancing spawner updates the cost value for the appropriate server. When a client requests a connection to the load-balancing cluster, the spawner examines the cost values for all of the servers in the cluster, and then redirects the client to the server that has the lowest cost value.

The Cost algorithm works differently for SAS Workspace Servers and SAS Stored Process Servers:

  • SAS Workspace Servers. When a new client requests a connection, the load-balancing spawner redirects the client to the server that has the lowest cost value. When the client connects to the designated server, the spawner will increment that server's cost by a specified value (cost per client). When that client disconnects, the spawner will decrement that server's cost by the same value (cost per client).

  • SAS 9.1.3 Stored Process Servers. When a new client requests a connection, the load-balancing spawner redirects the client to the server process that has the lowest cost value. When the client connects to the designated server process, the spawner will decrement the cost for that process by the same value (cost per client).

    Additionally, the stored process server process dynamically adjusts its cost by a fixed value (101) each time it begins or finishes running a stored process.

  • SAS 9.1.2 (and earlier) Stored Process Servers. When a new client requests a connection, the load-balancing spawner redirects the client to the server process that has the lowest cost value. When the client connects to the designated server process, the spawner will increment the cost for that process by a specified value (cost per client). Load balancing does not decrement the cost when the client disconnects. The stored process server dynamically updates its cost each time it begins or finishes running a stored process, so that the cost is equal to the number of stored processes that are running, multiplied by 101. This updated cost is not affected by the number of clients.

Cost Algorithm Parameters

The Cost algorithm uses the following cost parameters, which are treated as weighted values:

Cost Per Client (field on the load-balancing logical server definition)
specifies the default amount of weight (cost) that each client adds (when it connects) or subtracts (when it disconnects) to the total cost of the server.

Startup Cost (field on the server definition)
specifies the startup cost of the server. When a request is made to the load-balancing spawner, the spawner assigns this startup cost value to inactive servers. A new server is not started unless it is determined that its cost (the startup cost) is less than that of the rest of the servers in the cluster. This field enables the administrator to control the order in which servers are started. After a server is started, the cost value is 0. When a client connects to the server, the server's cost value is increased.

Maximum Cost (field on the server definition)
specifies the maximum cost value that each server can have. After a server reaches maximum cost, the load-balancing spawner will not redirect any more clients to the server until its cost value decreases.

Cost Algorithm Examples

SAS Workspace Server Example

A load balancing cluster contains two workspace servers on two different machines, Machine A and Machine B:

Initial Cluster Status
Workspace Server A
Clients3
Maximum Cost500
Cost to Connect300
Workspace Server B
Clients2
Maximum Cost200
Cost to Connect200
Cost Per Client100

At the start of the example, five clients have connected to the cluster and the client connections are balanced between the two servers. Workspace Server A has three clients and Workspace Server B has two clients.

The following figure illustrates what happens when an additional client requests a connection:

workspace server diagram

1   The client requests a connection to Workspace Server B. The spawner on Machine B examines the cost values of all of the servers in the cluster. Workspace Server B has the least cost, but it has reached its Maximum Cost value and cannot accept any more clients. The spawner redirects the client to Workspace Server A.

2   The client requests a connection to Workspace Server A. The spawner on Machine A creates a server connection for the client, and then increments the cost value for Workspace Server A by the cluster's Cost Per Client value (100).

Final Cluster Status
Workspace Server A
Clients4
Maximum Cost500
Cost to Connect400
Workspace Server B
Clients2
Maximum Cost200
Cost to Connect200
Cost Per Client100

At the end of the example, the cost to connect to Workspace Server A is 400, because there are four clients and the Cost Per Client value is 100.

SAS 9.1.3 Stored Process Server Example

A load balancing cluster contains one stored process server with two server processes (MultiBridge connections), Server Process A and Server Process B:

Initial Cluster Status
Server Process A
StatusRunning
Clients2
Stored Processes2
Startup Cost300
Cost to Connect402
Server Process B
StatusNot Running
Clients0
Stored Processes0
Startup Cost300
Cost to Connect300
Cost Per Client100

At the start of the example, Server Process A is running, and has two clients. Each client on Server Process A is running one stored process, so the current cost for Server A is 402 (2 clients * 100 + 2 processes running * 101). Server Process B has not started yet, so the cost to connect to Server Process B is the Startup Cost (300).

The following figure illustrates what happens when an additional client connects:

stored process server diagram

1   The client requests a connection to the stored process server. The load-balancing spawner examines the cost values of all of the servers in the cluster, and determines that Server Process B has the lowest cost. The spawner redirects the client to Server Process B.

2   The client requests a connection to Server Process B. The spawner starts the server process, and then provides a connection to the client. The spawner increments the cost value for Server Process B by the cluster's Cost Per Client value (100).

Final Cluster Status
Server Process A
StatusRunning
Clients2
Stored Processes2
Startup Cost300
Cost to Connect402
Server Process B
StatusRunning
Clients1
Stored Processes0
Startup Cost300
Cost to Connect100
Cost Per Client100

At the end of the example, the cost for Server Process B is 100, because there is one client and the Cost Per Client value is 100. There are no stored processes running, and the Startup Cost value does not apply because the server process has been started. If the client submits a stored process, the cost will increase by 101 (the standard cost per stored process).


Response Time Algorithm (SAS Stored Process Server only)

The Response Time algorithm uses a list of server response times in order to determine which server process has the least load. For each server process in the load-balancing cluster, the load-balancing spawner maintains an ordered list of servers and their average response times. Each time the spawner receives a client request, it redirects the client to the server process at the top of the list. The spawner updates the server response times periodically. You can specify the update frequency for the response time (Response Refresh Time) in the metadata for the load-balancing cluster.

The Response Time algorithm uses the following parameters:

Response Refresh Rate (field on the load-balancing logical server definition for SAS Stored Process Servers only)
specifies the length of the period in milliseconds that the load-balancing spawner will use the current response times. At the end of this period the spawner updates the response times for all of the servers in the cluster, and then reorders the list of servers.

Note: If this field is set to 0, the load-balancing spawner does not use the response time list to redirect clients to servers; instead, the spawner redirects clients to server sequentially, in the order that the servers are defined in the metadata.

Max Clients (field on the server definition for SAS Stored Process Servers only)
specifies the maximum number of clients that a server can have. After a server reaches its maximum number of clients, the spawner will not redirect any more clients to the server until a client disconnects.