Load balancing means “to distribute load among multiple entities”. In Oracle RAC ,Load Balancing feature is very well maintained. Load is distributed among all instance.
However we need to take care of some things , like creating service based on group of users connecting database.Assigning number of backup instance if service fails on preferred instance etc.
Load Balancing can be configured in two ways :
- Load Balancing at connection time.
- Load Balancing at run time.
1.Connection Time Load Balancing[CTLB] :
We can do connect time load balancing at Client level and Server Level.
Client Level Load Balancing :
In single instance database oracle net connects to the host specified in tnsnames.ora file that is single connection. In Oracle RAC we can specify LOAD_BALANCE parameter in tnsnames.ora file to enable load balancing at client level.
We can use following tnsnames.ora entry to enable client level load balancing.
(ADDRESS= (PROTOCOL=TCP) (HOST=rac1-vip) (PORT=1521))
(ADDRESS= (PROTOCOL=TCP) (HOST=rac2-vip) (PORT=1521))
(CONNECT_DATA= (SERVICE_NAME= orcl)
Server Level Load Balancing :
For Server Side load balancing , when SCAN listener receives a connection request , it will use LOAD BALANCING ADVISER and identifies load in each node in the cluster and routes the request to least loaded node.
To know more about SCAN: SCAN Listener
The REMOTE_LISTENER parameter ensures cross registration of the instance with listener on other nodes.Oracle Database 11g release 2 RAC instances registers with SCAN listener only as remote listeners.The REMOTE_LISTENER parameter must be set to SCAN:PORT in all the instance.
For each service we can define connection goal using clbgoal parameter with SHORT or LONG value.
- Short :Connections are distributed across instances based on the amount of time that the service is used. Use the short connection load-balancing goal for applications that have connections of brief duration.
- Long :Connections are distributed across instances based on the number of sessions in each instance, for each instance that supports the service. Use the long connection load-balancing goal for applications that have connections of long duration.
We can set clbgoal parameter with srvctl .
srvctl add service -db demo -service reporting -serverpool mypool -clbgoal short
2.Run Time Load Balancing [RTLB] :
Stay tuned for More articles on Oracle RAC
Thank you for giving your valuable time to read the above information.
If you want to be updated with all our articles send us the Invitation or Follow us:
Skant Gupta’s LinkedIn: www.linkedin.com/in/skantali/
Joel Perez’s LinkedIn: Joel Perez’s Profile
Anuradha’s LinkedIn: Anuradha’s Profile
LinkedIn Group: Oracle Cloud DBAAS
Facebook Page: OracleHelp