Wednesday, June 17, 2009

All about Oracle RAC HA Networking

We will see what are the available Oracle Networking options within RAC environment.

1.Client side Load Balancing (CSLB)
2.Server side Load Balacing (SSLB)
3.Client connect time Fail Over (CTFO)
4.Client side Load Balancing (CSLB)
5.TAF at client level and Server level
6.FAN


1.client side Load Balancing

Randomly the connection gets routed to the available listeners.

DisAdvantage -

Connections are completely unaware of the existing load on different
servers and a CPU-saturated server can still continue to get connections.


Example -

Oms.blue.com =
(DESCRIPTION =
(LOAD_BALANCE = yes) --> Which is default.
(ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip)(PORT = 1530)
(ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip)(PORT = 1530))
(CONNECT_DATA =
(SERVICE_NAME = oms.blue.com)
)
)

2.Server-side connection load balancing (PREFER_LEAST_LOADED_NODE) -It Improves performance.

Balance the connections among available listeners based on CPU's workload.It is at listener level.So each listener knows other instanaces workload (via dispatcher and PMON registration).This is achieved via Local_listener and remote_listener parameters.Load balancing at Dispatcher level in case if MTS is used.

PMON registers itself with listener.
PMON computes metrics every 2-3 seconds
PMON checks the listener status every 1 second

See the PMON dynamic registration between nodes.


LSNRCTL> status LISTENER_10G_rac1
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=rac1-vip)(PORT=1530)(IP=FIRST)))
STATUS of the LISTENER
------------------------
Alias LISTENER_10G_rac1
Version TNSLSNR for Linux: Version 10.2.0.4.0
Start Date 11-JUN-2009 16:04:37
Uptime 0 days 4 hr. 53 min. 19 sec
Trace Level off
Security OFF
SNMP ON
Listener Parameter File /u01/oracle/product/10g/asm/network/admin/listener.ora
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.132.1.95)(PORT=1530)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.132.1.96)(PORT=1530)))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "+ASM1" has 1 instance(s).
Instance "+ASM1", status UNKNOWN, has 1 handler(s) for this service...
Service "+ASM_XPT" has 1 instance(s).
Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "OMS" has 2 instance(s).
Instance "oms1", status READY, has 2 handler(s) for this service...
Instance "oms2", status READY, has 1 handler(s) for this service...
Service "oms" has 2 instance(s).
Instance "oms1", status READY, has 1 handler(s) for this service...
Instance "oms2", status READY, has 1 handler(s) for this service...
Service "oms_XPT" has 2 instance(s).
Instance "oms1", status READY, has 2 handler(s) for this service...
Instance "oms2", status READY, has 1 handler(s) for this service...
The command completed successfully

PREFER_LEAST_LOADED_NODE_=ON/OFF - As the name says , the connection always goes to the least loaded node(CPU and connections). Please be aware that connections bursts (large number of connections initiated very quickly one after another) may not be properly balanced due to statistics update latency.


Connect time fail over (CTFO) -

This is not same as TAF. TAF is for connected sessions only (application level).It is specified via failover_mode option.CTFO is used only when the intial connection is attempted and it is specified via failover option.

3.Client side connect time fail Over - Fail Over Option for oracle clients.

It enables the clients to connect to another listener if the initial connection to the first listener fails.Address list specified in the service determines how many services (address) are tried.Without this option , only one listener is tried.

fail over is ON by default for Oracle clients.


eg.,


CTFO -

oms.blue.com=
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip)(PORT = 1530)) ==> Attempts for the first node,if it fails it goes to the next node
(ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip)(PORT = 1530))
)
(CONNECT_DATA =
(SERVICE_NAME = oms.blue.com)
)
)

4.client side Load Balancing (CSLB) - Oracle clients randomly connects to the nodes listed in the address list.
Now you can identify that CTFO is always sequential and CSLB is random.


oms.blue.com=
(DESCRIPTION =
(ADDRESS_LIST =
(LOAD_BALANCE = yes)
(ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip)(PORT = 1530))
(ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip)(PORT = 1530))
)
(CONNECT_DATA =
(SERVICE_NAME = oms.blue.com)
)
)




5.Transparent Application Failover (TAF) - It can be at client level or server level.

You can leave the TAF to be decided either at client or at server level.

It enables the client to reconnect to other available instances if the current connected database instance fails.

Fail over_mode Options

Backup - service name for backup connections.It should be used with preconnect option.Could be an overhead having duplicate connections in the backup server.
type - fail over type.It can be at session or select statement level.
session - automatically connect to available instances,but recovery of select statement is not possible.
select - automatically connect to available instances, recovery of select statement is possible - But Overhead
Method - Method of connection.
Basic - It can establish connection fail over connection to available instances.No overhead
Preconnect - use pre established connections.Overhead
Retries - Number of times to attempt to connect after a fail over. 5 if delay is specified.

Delay - In seconds - before it tries to re attempt connection.

Eg.,


oms.blue.com =
(DESCRIPTION=
(LOAD_BALANCE=on) --> client Load Balance
(FAILOVER=on) ---> No need to specify.It is always default.
(ADDRESS=
(PROTOCOL=tcp)
(HOST=rac1-vip)
(PORT=1521))
(ADDRESS=
(PROTOCOL=tcp)
(HOST=rac2-vip)
(PORT=1521))
(CONNECT_DATA=
(SERVICE_NAME=oms.blue.com)
(FAILOVER_MODE=
(TYPE=select) ----> Failover is at statement level
(METHOD=basic)))) ---> Connection method is simple.No reduendent connections established in the backup server.


TAF at server side -
--------------------

This option can be set at server level.If specified then no need at client level.It could be a additional overhead at server level due to the additional latency involved between servers.But the Oracle clients are restricted to use only the TAF options specified at the server level.

srvctl add service -d oms2 -s omsservice -r "rac1,rac2" -P BASIC --> Adding a service with BAISC fail over.
srvctl start service -d oms -s omsservice --> starting the omsservice.
srvctl config service -d omsservice --> checking the configuration
srvctl status service -d oms --> checking the status of database and services.


To see the TAF information at database level use the following query -

select FAILOVER_METHOD,FAILOVER_TYPE,FAILOVER_RETRIES,FAILOVER_DELAY,ENABLED,NETWORK_NAME from dba_services where service_id =< service ID>;

5. FAN

The Fast Application Notification mechanism (FAN) is a high-availability mechanism
that lets the applications know about server or node events (for example,
up and down events). It uses user-written programs or shell scripts that are
automatically executed in case of status change. The 10g version of the
JDBC driver is a subscriber of FAN (both the thin and thick driver) and will
automatically rebalance connections across existing and new nodes. To use
FAN, the application must use the JDBC Implicit Connection Cache.

Eg., of thin JDBC connection

url="jdbc:oracle:thin:@(DESCRIPTION=(LOAD_BALANCE=on)
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=TCP)(HOST=rac1-vip) (PORT=1530))
(ADDRESS=(PROTOCOL=TCP)(HOST=rac2-vip)(PORT=1530)))
(CONNECT_DATA=(SERVICE_NAME=oms)))"
CRM=(DESCRIPTION=
(ADDRESS=(PROTOCOL=TCP)(HOST=rac3-vip)(PORT=1530))
(CONNECT_DATA=(SERVICE_NAME=oms)))
CRM= (DESCRIPTION=
(ADDRESS_LIST=
(LOAD_BALANCE=on)
(ADDRESS=(PROTOCOL=TCP)(HOST=rac1-vip)(PORT=1530))
(ADDRESS=(PROTOCOL=TCP)(HOST=rac2-vip)(PORT=1530))
)
(CONNECT_DATA=(SERVICE_NAME=oms)))

No comments:

Post a Comment