Description of Fast Application Notification and Fast Connection Failover Technologies

Description of Fast Application Notification and Fast Connection Failover Technologies Igor Melnikov Senior Consultant, Oracle CIS Agenda • Intro...
Author: Dinah Eaton
28 downloads 1 Views 603KB Size


Description of Fast Application Notification and Fast Connection Failover Technologies Igor Melnikov Senior Consultant, Oracle CIS

Agenda • Introduction to Fast Application Notification • Fast Connection Failover [FCF] • Load Balance Advisory and runtimebalancing for connection pools • Comparison of TAF and FAN





Fast Application Notification

Fast Application Notification What is FAN • Technology for sending messages about the condition of RAC components: • •

Status change of node, service, instance, RDBMS Recommended load balancing

• In Data Guard environment •

Status change of DB after switchover/failover transactions

• The FAN event includes the event information: what has changed, where and when • It is possible to determine server side FAN-callback • Subscribers receive FAN messages via AQ or ONS • FAN is integrated in JDBC, OCI, ODP.Net, Listeners

Fast Application Notification History • FAN API release 10.1 10.2

Server Side Callback ONS API AQ API Load Balancing Advisory

• Products Integrated with FAN 10.1 10.2

JDBC Implicit Connection Cache Connection Manager (CMAN), Listener OCI Connection Pool, OCI Session Pool, TAF, standalone OCI ODP.NET Connection Pool Data Guard

Fast Application Notification Architecture In Oracle Database 10gR2 and higher .NET app

C app

C app

Java app

Java app

ODP.NET

OCI API

ONS OCI API

ONS Java API

JDBC

ONS

ONS

AQ Proxy app Callout script Callout exec

HA Events

HA Events

CRS

HA Events

ONS

HA Events

EMD

Node1

DB Control

FAN Event Format VERSION= [service=] [database=] [instance=] [host=] status= reason= [card=] timestamp=

SERVICE VERSION=1.0 service=ERP.oracle.com database=RACDB status=up reason=user card=4 timestamp=16-Mar-2004 19:08:15 NODE VERSION=1.0 host=strac-1 status=nodedown timestamp=16-Mar-2004 17:35:53

FAN for Developers Using FAN in Applications •

There are three ways to use FAN: •

An application may enjoy the advantages of FAN without any programming, if it uses FAN integrated Oracle Clients (clients using JDBC, ODP.NET, and Oracle Call Interface (OCI)).



Developers may create FAN event handlers in the client application with Oracle Notification Service Application Programming Interface (ONS API) – on Java or C/C++.



To Develop server FAN event handler (FAN server side callouts)

Using FAN in OCI-applications • • • •

OCI connection pool, OCI session pool, TAF Set the HA_AQ_Notification service parameter with DBMS_SERVICE package Set OCI_EVENTS attribute with the call ( OCIEnvCreate(...) ) If necessary – using API ОС for multithread processing (the application is now multithreaded!)



Fast Connection Failover

Fast Connection Failover In 10gR2 and higher • Works for connection pools • The connections to DB are equally divided among all preferred RAC instances • The DB connection failures are discovered immediately and the connection stops • New connection requests are forwarded to available instances.

Mid-Tier

Database Tier

CACHES SERVICE 1

INST X

SERVICE 2

INST Y

SERVICE 3 INST Z

JDBC, ODP.NET, OCI

Fast Connection Failover Operating Principles • Analysis of FAN-messages UP/DOWN • Closing “dead” connections and establishing new ones • The application definitely gets an “alive” connection

Example Connection Pool

C1 C2 C3 C4 C5 C6 C7 C8 C9

Instance 1 Instance 2 Instance 3 The service runs on 3 nodes

Example Node Failure Connection Pool

C1 C2 C3 C4 C5

Node 3 Down

C6 C7 C8 C9

Instance 1 Instance 2

The service runs on 3 nodes

Example Automatic failover to active nodes Connection Pool

C1 C2 C3 C4 C5 C6 C7 C8 C9

Instance 1 Instance 2

The service runs on 2 nodes

FCF-aware Products • Oracle Call Interface •

Any type of connection (ordinary, TAF, connection pool and session pool) are automatically closed at the time of node failure and the TAF-callback (if defined) is called immediately

• JDBC •

No need to change the existing Java-applications additionally except for the flag setting setFastConnectionFailoverEnabled

• ODP.NET • •

FAN notifies ODP.NET on the node condition and on need to failover In the connection line, “HA Events=true” must be specified

• The service has to have the subscription flag to the FAN (ODP.Net) messages: • aq_ha_notifications=>true

TAF and FCF For JDBC-applications • Metalink: Note 334471.1 “Understanding TAF and FCF” • “Do not configure Transparent Application Failover (TAF) with Fast Connection Failover for JDBC thick clients as TAF processing will interfere with FAN ONS processing”

RAC Load Balancing Advisory

RAC Load Balancing Advisory Basic Principles • Tracing active service load on any cluster instances • Analyzing service performance level on each instance in accordance with service goal (response time or throughput) • Publishing FAN-events for applications recommending the amount of work for each instance and the instance quality flag

Load Balancing Advisory

• Using 2 minutes AWR metrics • Generating advice on load balancing in percentage • Resulting percents are approximated to avoid drastic fluctuations

Load Balancing Advisory Goals • None – default value, “advice” is disabled • THROUGHPUT – queries are distributed based on the throughput. • It is used when the queries to perform tasks are sent regularly. For example, the package tasks which run step by step.

• SERVICE_TIME – queries are distributed based on the response time. • It is used when the queries are sent not regularly. For example: an internet-shop

Load Balancing Advisory Service Setup • Enabling LBA and defining the service quality criterion:

begin dbms_service.modify_service( service_name =>'OLTP', aq_ha_notifications => true, goal => dbms_service.GOAL_THROUGHPUT); end;

Load Balancing Advisory Example Message SYS$RLBTYP('test.oracle.ru', 'VERSION=1.0 database=racdb service=test.oracle.ru { {instance=racdb1 percent=50 flag=GOOD} {instance=racdb2 percent=50 flag=GOOD}} timestamp=2008-02-10 10:01:17')

Runtime Connection Load Balancing Load Balancing for Connection Pools • Connection pool on the client is integrated with RAC load balancing advisory • When the application requests the connection pool, it gets the connection to the node providing for the best service quality • It is essential to have tuned Connection Load Balancing • Works only for connection pools ODP.Net and JDBC

Runtime Connection Load Balancing For Application Developers • Do not rewrite the application – load balancing works transparently • No need to install and to purchase additional software • Enabling with the attribute in the connection line • Supported in JDBC and ODP.NET

Runtime Connection Load Balancing Example CRM requests connection ? 60%

connection cache “CRM is bored”

30%

10%

“CRM is very busy”

Instance 1

Instance 2

Instance 3

“CRM is busy”

D E M O N S T R A T I O N

Runtime Connection Load Balancing

Comparison of TAF and FAN

What FAN gives us? • No reliance on connection time-outs required • Events on resource availability or insufficiency events are published without delay • Designed for production applications enabling to use system resources effectively • Is good for tracking and registration of failures and component availability/unavailability • A reliable distributed system • Discovers component availability/unavailability in proper time • Transfers the notification directly to the application

• Closely integrated with: • Applications using connection pools Oracle JDBC/ODP.Net • Enterprise Manager • Data Guard Broker

TAF and FAN • Attention: an application using FAN-callback becomes multithreaded unlike TAF-callback. • TAF disadvantage: delayed reaction to the unavailability (until the next access to OCI)

TAF and FAN For OCI-applications • Supporting FAN-events starting from Oracle Client 10.2 • TAF may be used “above” FAN – immediate reaction to the connection loss without need to do massive amount of work again • Attention: in this case application using TAF-callback becomes multithreaded, maybe it has to be rewritten.

Questions Answers



Igor Melnikov Senior Consultant, Oracle CIS Email : [email protected] Phone : +7 (495) 641 14 00 Direct: +7 (495) 641 14 42 Mobile: +7 (915) 205 26 27