Client and Server side load balancing in RAC

Client & Server Side Load Balancing in RAC Environment

Load Balancing is a feature used in RAC Environment to share the Workload between the all the nodes present in RAC Environment to obtain maximum performance/throughput.

Load Balancing of two type:
1. Connect time load balancing
– On Client Side
– On Server Side
2. Run time load balancing
– On Server Side

Connect time load balancing
In connect time load balancing, when user tried to connect with service, then user is connected to the instance supporting by service. Connection stay with the instance util user disconnect it.

Configure the connect time load balancing on Client Side
When user tired to connect then oracle net service pick the connection between the instance/nodes configured in tnsnames.ora randomly. Then user remain connected with that instance until disconnected/killed.
Disadvantage: No idea which instance is choose may be it is already overloaded.

Following are the steps to configure client side connect time load balancing

1. Go to the Client side machine and check the TNS Entry which application is used to connect in tnsnames.ora file.

Go to $ORACLE_HOME\network\admin\tnsnames.ora
check the TNSNAMES.ORA file for TNS entry.
OR
TNSPING command to check the entry in tnsnames.ora file.
#tnsping racdb

2. Edit entry as follows if not exists in tnsnames.ora files.
Add an entry in tnsnames.ora file at client side with Load_balance parameter:(Load_balance=yes)
In 11g and above, scan name is never change through out the RAC Environment, it resolve three scan IP’s

-- In 11g or above version use the scan IP address
racdb=
(description= (load_balance=yes)
(address=(protocol=TCP)(host=rac-Scan.local.in)(port=1521))
(connect_Data = (service_name=RACDB_SERVICE))
OR
-- In 10g use the virtual ip address
OLDracdb=
(description= (load_balance=on)
(address=(protocol=TCP)(host=racmc1-vip.local.in)(port=1521))
(address=(protocol=TCP)(host=racmc2-vip.local.in)(port=1521))
(connect_Data = (service_name=RACDB_SERVICE))

Configure the connect time load balancing on Server Side
In Server Side, We have two option LONG or SHORT for configure the service configuration with srvctl command. After a listener receives the connection request, it can forward the request to instance based on (CLB_GOAL) Parameter specified for the service. CLB_GOAL can be :
LONG: Listener will load balance on number of sessions. Used for application connections that are connected for a long period. It is default setting.(used for batch process)
SHORT: Listener uses Load Balancing Advisory (LBA) to make the connection based on CPU utilization on the node. Used for application connections that are short in duration. Main used in run time load balancing

1. Check the default configuration of the Scan Service

srvctl config service -db orcl -service scan01.cluster.com

2. Check whether it is used long or short connection load balancing
Connection load balancing goal: LONG is the default setting. which need to established in this mode.
 
3. Change from long to short for configure Connection load balancing goal:

srvctl modify service -db orcl -service scan01.cluster.com -clbgoal SHORT

4. Check the Service connect load balancing goal from sqlplus:

select name,clb_goal from dba_services;

Run Time load Balancing (RTLB)
Listener determines the connection distribution depending on statistics provided by PMON Background process. The higher the load on the node, PMON process update the load profile.
With server side load balancing, the listener directs a connection request to the least busy instance with help of load balancing advisory.

Configure Run time Server side load balancing
Note: For configure run time load balancing our connect time load balancing must be set to SHORT

1. Set the parameters LOCAL_LISTENER and REMOTE_LISTENER.
LOCAL_LISTENER parameter is set to the listener name in local node.
REMOTE_LISTENER is set to the listeners name running on other nodes.
Note: Same as tnsentries in tnsnames.ora file

In 11g and above, used scan listener.
REMOTE_LISTENER parameter is defined as SCAN LISTENER.

In all node:
REMOTE_LISTENER=SCAN-RAC-Listener:1521
In Node1
Local_listener=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP) HOST=NODE1-vip)(PORT=1521))))
In Node2
Local_listener=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP) HOST=NODE2-vip)(PORT=1521))))

In 10g, used VIP address, so need to mention vip address in Remote listener.

In Node1:
Local_listener:
(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP) HOST=NODE1-vip)(PORT=1521))))
Remote_listener:
(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP) HOST=host02-vip)(PORT=1521)
In Node2
Local_listener:
(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP) HOST=NODE2-vip)(PORT=1521))))
Remote_listener:
(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP) HOST=NODE1-vip)(PORT=1521))))

2. Change Scan Service CLBGLOAL to SHORT:

srvctl modify service -db orcl -service scan01.cluster.com -clbgoal SHORT

3. Verify the changed setting of srvctl command.

srvctl config service -db orcl -service scan01.cluster.com

4. Configure the Service for run time load balancing
In this we have three option:
NONE:Default setting, you are only changing to short but not using run time load balancing.
THROUGHPUT: Load balancing advisory analyzes the service for each instance based on the service time and is based on the rate that work is completed in the service plus available bandwidth to the service.
SERVICE_TIME: Load balancing advisory data is based on elapsed time for work done in the service plus available bandwidth to the service.

srvctl modify service -s orcl_serv database -d orcl -B throughput

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.