Beruflich Dokumente
Kultur Dokumente
in Oracle RAC?
RTLB has come into existence from 10gR2 which can be either set
to SERVICE_TIME or THROUGHPUT. CLB can be configured at Client-Side
or at Server-Side. Of which, Server-Side load balancing is recommended and
have better functionality over Client-Side.
Is RTLB a client-side or server-side load balancing? Well, it is
combination of both and majorly on the client side. Connection and
performance statistics is collected on server side and transferred to the
application server recursively by using ONS (Oracle Notification Service)
infrastructure. It might not be applicable to all the application setups, by
default JDBC based applications can use this RTLB feature.
What is the role of LBA? LBA is the key for Run-time Load Balancing. Both
these configurations completely rely on the statistical data provided by LBA
(Load Balancing Advisory).
Functionality of RTLB: For a fixed time period the performance statistics
collected by LBA (with the help of PMON of all instances) are pushed into
application server through ONS service and we call them as LBA events.
Every time a new connection request triggers from application it will pass
through the connection cache/pool on the client side and picks up the best
instance to connect based on the service level goal configured.
Yes, now you might agree that Run-Time Load Balancing is more preferred
than Connection Load Balancing as major and important decisions are taken
at the client side before connection request reaches SCAN listener. In this
blog, let us run through the process of creating a service, understand the
weightage of LBA and if that can be disabled.
Case study:
Here is our case study, to create a default service on a 2-node RAC
environment and verify the parameters of load balancing. We will take this
study ahead by changing the parameters to understand the importance of
LBA.
1. Creating a default service without specifying the type of load balancing.
[oracle@RAC1 ~]$ srvctl add service -s LBASRV1 -d RACDB -g
RACPOOL
[oracle@RAC1 ~]$ srvctl start service -s LBASRV1 -d RACDB
[oracle@RAC1 ~]$ srvctl config service -s LBASRV1 -d RACDB
CLB_G
NONE
LONG
But as soon as we restart the service using srvctl GOAL has come back
to THROUGHPUT.
[oracle@RAC1 ~]$ srvctl stop service -s LBASRV1 -d RACDB
[oracle@RAC1 ~]$ srvctl start service -s LBASRV1 -d RACDB
SQL> select GOAL,CLB_GOAL from dba_services where name=LBASRV1;
GOAL
CLB_G
THROUGHPUT
LONG
You can call this as bug as the configuration changes done in SQL prompt will
not be updated in OCR. So let us try doing it using srvctl.
[oracle@RAC1 ~]$ srvctl stop service -s LBASRV1 -d RACDB
[oracle@RAC1 ~]$ srvctl modify service -s LBASRV1 -d RACDB -B
NONE
[oracle@RAC1 ~]$ srvctl config service -s LBASRV1 -d RACDB
<top lines removed>
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
<next lines removed>
This has come back to the default configuration when we created this service.
Yes, RTLB is now disabled but will it not use LBA according to the Oracle
document?
4. Let us connect to the database now using this service from the client
server and check if LBA is used by SCAN listener.
Client server: C:\Users\Administrator>sqlplus
system/########@//192.168.122.#/LBASRV1
Database server:
SQL> select user_data from sys.sys$service_metrics_tab order by
enq_time;
Last row of the output:
SYS$RLBTYP(LBASRV1, VERSION=1.0 database=RACDB service=LB
ASRV1 { {instance=RACDB_2 percent=50 flag=UNKNOWN aff=FALSE}
{instance=RACDB_1 percent=50 flag=UNKNOWN aff=FALSE} } times
C:\Users\Administrator>sqlplus
system/########@//192.168.122.#/LBASRV1
Database server:
SQL> SELECT user_data
1 ;
FROM sys.sys$service_metrics_tab
ORDER BY
SQL> !date
Thu Mar 17 16:54:46 IST 2016
Even with SHORT goal we dont see any LBA events generated by Oracle
RAC. Does it mean that LBA is not used by SCAN listener when only
CLB is configured? Hold on!!! Let us clear this road block.
6. Let me try to connect from multiple client sessions and see if load is
distributed across RAC instances.
SQL> select inst_id,username from gv$session where
username=SYSTEM';
INST_ID USERNAME
-
1 SYSTEM
2 SYSTEM
2 SYSTEM
Woooh!!!, there is load balancing on server side. Is it with the help of LBA?
We have disabled it before this step, isnt it?
One of the Oracle documents shown above says that LBA can be disabled by
setting GOAL to NONEand this document says that server-side load balancing
uses LBA even when Run-time Load Balancing is disabled. It is not surprising
if you have got confused now
Summary of our case study:
Server-side CLB is better over Client-side CLB and RTLB is best over
Server-side CLB.
Application should be able to read LBA events published by RAC to
make the most out of RTLB. Mostly JBDC, ODBC, Oracle Data Provider for
.NET (ODP.NET) can be configured to handle RTLB.
We can enable (SERVICE_TIME/THROUGHPUT) or disable(NONE) RTLB
PMON of all the instances without which service goal metrics cannot be
met.
Now, I understand that LBA is definitely mandatory for SCAN
listener in Oracle RAC.