Rac Listener Load balancing,TAF, FAN,FCF


Note : Even if the client tnsnames.ora  contains list of host_vips or scan-ip to connect to the database, the local listener on any node should not use the physical address/hostname  of that server. It should always use host_vip for local listener even for default dynamic registration where LOCAL_LISTENER parameter appears blank. This is because client connections made on host_vip can failback to other surviving node  but connections on local listener will not be able to do so.

Load Balancing :


Client-side  : Takes care of the connection sharing across the Listeners.The (load_balance=yes) instructs SQLNet to progress through the list of listener addresses in the address_list section of the net service name in a random sequence. When set to OFF, instructs SQLNet to try the addresses sequentially until one succeeds.

Server-side  : With remote_listener set , listener manages and handles the connection requests to the  instance/node currently providing the best service.When you install your RAC with the DBCA, server-side load balancing is enabled by default. These are of two types
      Load Based    :  redirects connections  depending on node load.This is default.
      Session Based :  redirects connections  based on number of sessions connected to each node to balance the number of sessions across the different nodes.


10g :  Client side
=======================

Due to LOAD_BALANCE = ON , Oracle will pick out an address from the address list at random and connect to that node, thereby balancing the client connections across the cluster. 

CSLB_FAILOVER =
    (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = raclinux1-vip)(PORT = 1521))
        (ADDRESS = (PROTOCOL = TCP)(HOST = raclinux2-vip)(PORT = 1521))
        (LOAD_BALANCE = ON) # Activates load balancing
        (FAILOVER = ON)     # Activates failover
        (CONNECT_DATA =
             (SERVER = DEDICATED)
             (SERVICE_NAME = racdb)
        )
    )



10g :  Server side
=======================

#####
# Add these entries to each server's TNSNAMES.ORA file to enable Server-Side 
# Load Balancing:
#####
LISTENERS_RACDB =
    (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = TCP)(HOST = raclinux1-vip)(PORT = 1521))
        (ADDRESS = (PROTOCOL = TCP)(HOST = raclinux2-vip)(PORT = 1521))
    )

SSLB =
    (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = raclinux1-vip)(PORT = 1521))
        (ADDRESS = (PROTOCOL = TCP)(HOST = raclinux2-vip)(PORT = 1521))
        (LOAD_BALANCE = ON)
        (FAILOVER = ON)
        (CONNECT_DATA =
             (SERVER = DEDICATED)
             (SERVICE_NAME = racdb)
        )
    )

-----
-- Run this command to add the REMOTE_LISTENERS initialization parameter to
-- the common SPFILE for all nodes in the RAC clustered database:
-----
ALTER SYSTEM SET REMOTE_LISTENER = LISTENERS_RACDB SID='*' SCOPE=BOTH;


10g : Setting up Load Balancing Advisory features
=================================================

# Create, register, and start three new services with 
# Cluster-Ready Services

srvctl add service -d racdb -s ADHOC -r racdb1,racdb2
srvctl start service -d racdb -s ADHOC
srvctl add service -d racdb -s DSS   -r racdb1,racdb2
srvctl start service -d racdb -s DSS
srvctl add service -d racdb -s OLTP  -r racdb1,racdb2 
srvctl start service -d racdb -s OLTP


# Configure RAC services to use Load Balancing Advisory features

BEGIN
    DBMS_SERVICE.MODIFY_SERVICE(
        service_name => 'ADHOC'
       ,aq_ha_notifications => TRUE
       ,goal => DBMS_SERVICE.GOAL_NONE
       ,clb_goal => DBMS_SERVICE.CLB_GOAL_LONG
    );
    DBMS_SERVICE.MODIFY_SERVICE(
        service_name => 'DSS'
       ,aq_ha_notifications => TRUE
       ,goal => DBMS_SERVICE.GOAL_SERVICE_TIME
       ,clb_goal => DBMS_SERVICE.CLB_GOAL_SHORT
    );
    DBMS_SERVICE.MODIFY_SERVICE(
        service_name => 'OLTP'
       ,aq_ha_notifications => TRUE
       ,goal => DBMS_SERVICE.GOAL_THROUGHPUT
       ,clb_goal => DBMS_SERVICE.CLB_GOAL_SHORT
    );
END;
/


SELECT 
     name
    ,TO_CHAR(creation_date, 'mm-dd-yyyy hh24:mi:ss') created_on
    ,goal
    ,clb_goal
    ,aq_ha_notifications
  FROM dba_services
 WHERE goal IS NOT NULL
   AND name NOT LIKE 'SYS%'
 ORDER BY name
;



TAF (Transparent Application Failover) :
=======================================

Feature of the Oracle Call Interface (OCI) driver at client side.Automatically reconnect to a database other node on failover
Failover Mode Type can be Either SESSION or SELECT.
Select Failover which will replay queries that were in progress. It will discard the old rows which have been fetched earlier and will fetch the rest of rows.
It is not used for purpose of load balancing or for Connect Time Failover.

(CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = fokerac.wolga.com)
      (FAILOVER_MODE =
        (TYPE = SELECT)
        (METHOD = BASIC)
 (RETRIES = 180)
 (DELAY = 5)  
      )

With TAF, if a communication link failure occurs after a connection is established, the connection is moved to another active Oracle RAC node in the cluster without the application having to re-establish the connection. 

Configuring GLOBAL_DBNAME parameter in listener.ora disables TAF



Client Side TAF Configuration — PRECONNECT


PRIMARY=
(DESCRIPTION=
(ADDRESS=
(PROTOCOL=tcp)(HOST=clu-scan)(PORT=1521))
(CONNECT_DATA=
(SERVICE_NAME=RAC_TEST)
(FAILOVER_MODE=(BACKUP=SECONDARY)(TYPE=select)(METHOD=preconnect))))



SECONDARY=
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=clu-scan)(PORT=1521))
(CONNECT_DATA=
(SERVICE_NAME=RAC_TEST)

(FAILOVER_MODE=(BACKUP=PRIMARY)(TYPE=select)(METHOD=preconnect))))



Server Side TAF Configuration — PRECONNECT

$ srvctl add service -s RAC_TEST -d TESTDB -P BASIC -e SELECT -m BASIC -w 120 -z 5 -r "<preferred_list>" [-a "<available_list>"]

$srvctl status service -s RAC_TEST -d TESTDB


create a service name into TNS entry

SERVER_TAF =
(DESCRIPTION = (LOAD_BALANCE = YES )
(ADDRESS = (PROTOCOL = TCP)(HOST =CLU-SCAN)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = RAC_TEST)
)

)


FAN (Fast Application Notification) :
====================================

Mechanism that RAC uses to notify other processes about configuration and service level information such as includes service status changes, such as UP or DOWN events. 

Instead of waiting for application to check on individual nodes to detect an anomaly, the applications are notified by FAN events and are able to react immediately.



Fast Connection Failover (FCF)  :
================================


  • Provides a way for application to control failover response
  • Alternative to TAF

With fast connection failover, when a down event is received, cached connections affected by the down event are immediately marked invalid and cleaned up.


feature of Oracle clients that have integrated with FAN HA Events.
Oracle JDBC Implicit Connection Cache, Oracle Call Interface (OCI), and Oracle Data Provider for .Net (ODP.Net) include fast connection failover.