Client side load balancing
To build an effective Oracle RAC system, balancing the workload coming in from the clients must also be considered.
On the client a tnsnames.ora file was set up, and the variable $TNS_ADMIN was set to the location of this file. Sample files came with the Oracle client, located in client_1/network.
There are multiple ways to configure for any set up and the elements in the example work with the parameters on the node, and the listeners.ora file.
The main element shown here is the connection descriptor for a service named OLTP, which is the database requested - not a particular instance of OLTP but the primary service. The addresses are the public VIPs. The parameter LOAD_BALANCE having been set on causes the client to randomize the use of the addresses that it places the requests on, which is called server-side load balancing. In this case, the connect descriptor is handed directly to the service handler on the server that receives it. However it is possible to have a connect descriptor in a tnsnames.ora file on the server to resolve what service type is requested.
OLTP =
(DESCRIPTION =
(ADDRESS_LIST=
(LOAD_BALANCE=on)
(FAILOVER=off)
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.10.202)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.10.203)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = oltp )
)
)On the server side, in Oracle RAC there are two types of service handlers servers and dispatchers, which generate server processes for requests handed off by listeners. In dedicated server mode, the server process (and its memory usage) is held sequentially by service requesters until the service is completed and the server process released by the requester. In contrast, in shared server mode dispatchers are the service handlers, serving server processes to a queue of requests which connect and disconnect and reconnect to service requests.
The mechanics of the dedicated or shared server process scenario are determined by the combination of the parameter SERVER=dedicated or SERVER=shared in the connection descriptor that is in effect for the service request, along with the DISPATCHERS pfile or spfile file on the database. If the SERVER parameter is not set, shared server configuration is assumed. However, the client uses a dedicated server if no dispatchers are available.