lab guide active gridlink
DESCRIPTION
Guide Active GridlinkTRANSCRIPT
WebLogic Active GridLink Workshop
August 2011
Introduction
WebLogic Server has been optimized with a new feature called Active GridLink for RAC since 10.3.4.
This feature integrates WebLogic Server data sources in a new architectural approach with Oracle RAC.
Specifically, Oracle RAC supports an event based client notification mechanism to disseminate
information about the state of an Oracle RAC cluster. The Active GridLink for RAC feature, manifested in
WebLogic Server as a GridLink data source type, further optimizes the proven WebLogic Server data
source infrastructure by leveraging the information within these RAC notifications to provide better
overall connectivity in the form of significantly faster response to RAC node failures or maintenance
activities, better utilization of RAC cluster resources and improved runtime monitoring and management.
Perhaps most importantly, the intelligent runtime processing of this RAC event information has resulted
dramatically improved performance results for WebLogic based OLTP database workloads on Web Logic
and Exalogic.
Single Data Source
Interestingly the Active GridLink for RAC feature also dramatically simplifies and consolidates WebLogic
Server data source configuration and administration. It provides a single data source that is enhanced to
support the capabilities of Oracle RAC. This is significantly different and easier to administer than the
traditional Multi Data Source model, still supported, which has a combination of one data source per
RAC node and then an additional logical data source as a proxy layer representing the resulting
collection of RAC data sources. To get a sense of this, in a 4 node Oracle RAC cluster on Exadata, the
WebLogic Server data source configuration would decline from five distinct data sources with Multi Data
Sources (one for each RAC node and one proxy data source) to one with Active GridLink for RAC.
Fast Connection Failover
Oracle Notification Service (ONS) is used by the Oracle RAC database to broadcast events that describe
changes in its state. With Active GridLink for RAC, WebLogic Server registers to receive notifications
from ONS and quickly becomes aware of any state changes in a RAC database. This approach on
Exalogic can be orders of magnitude faster as compared to the multi data source polling approach or in
worst case TCP/IP timeouts. Using these state change notification events, WebLogic Server can
intelligently adapt its connection pools at runtime so that it provides continuous and reliable access to
the Oracle RAC database as changes occur.
Runtime Connection Load Balancing
To provide better throughput and more efficient use of resources, the Oracle Database provides a
runtime load balancing service to distribute connections across the Oracle RAC instance based on
performance goals set by a database administrator. The load balancing advisory service issues Fast
Application Notification events that advise clients on the current state of the cluster including advice on
where to direct connections.
WebLogic Server receives load balancing advisory events issued by the database, and distributes
connections to the Oracle RAC nodes accordingly. This has been made available as a Runtime Load
Balancing configuration option on the Active GridLink for RAC data source. Enabling it dictates that the
pool dispatch connections based on the advisories it has received from the database achieving an
outcome where the connections are directed to a specific database node to satisfy a performance goal
the database administrator has set.
XA Affinity
XA affinity is a performance feature that ensures that all database operations performed on an Oracle
RAC cluster within the context of a global transaction are directed to the same Oracle RAC instance.
Affinity will be established based on the global transaction id, instead of by individual data source, to
ensure that connections obtained from different data sources that are configured for the same Oracle
RAC cluster are all associated with the same RAC instance.
Database Graceful Shutdown
A graceful planned shutdown occurs when a database node/service is targeted for a shutdown
operation, with the corresponding issuance of a database event indicating the shutdown has been
requested. To support graceful planned shutdown of a database, Active GridLink for RAC does not
immediately abort connections that are in use when it detects that the database shutdown target is no
longer accepting new connections. Instead, the GridLink data source allows any in progress transactions
to complete before closing and recreating the physical connections, while cleaning up idle connections
so that new requests for connections are not sent the database target in active shutdown mode.
Objectives
� Create database Service to access RAC database.
� Configuration of GridLink data source.
� Deployment of GridLink demo application.
� Running of demo application to show fast connection failover, load balancing and XA Affinity.
Prerequisites 1. WebLogic 10.3.5 is required for this workshop. If it’s not installed already, here it’s the
download url:
http://www.oracle.com/technetwork/middleware/fusion-middleware/downloads/index.html
2. Oracle Database RAC 11gR2 is required for this workshop. A physical or VM installation works.
Here it’s for more information regarding RAC:
http://www.oracle.com/technetwork/database/clustering/overview/index.html
3. Knowledge of Java EE and Oracle RAC is required.
Configuring 11gR2 Database and Real Application Cluster Assume you have an 11gR2 RAC installation. And you have the following valued set up:
� Oracle DB name: orcl
� Host 1: rac1
� Instance 1: orcl1
� Host 2: rac2
� Instance 2: orcl2
� SCAN: rac-scan
� Listener port: 1521
� ONS port: 6200
� User: oracle
� Password: oracle
1. Check the status
srvctl status database –d orcl
2. Create a new service:
srvctl add service -d orcl -s demosvc -r orcl1, orcl2 -q TRUE -j SHORT -B SERVICE_TIME -z
60 -w 10
3. Start the service
srvctl start service -s demosvc -d orcl
4. Check the service status
srvctl status service -s demosvc -d orcl
5. Try to start and stop database instances or services.
6. Create an user account on the RAC database:
sqlplus sys/oracle@orcl
sqlplus> create user oowdemo identified by oowdemo default tablespace users
temporary tabelspace temp;
sqlplus> grant connect, resource to oowdemo;
sqlplus> exit
7. Start em dbconsole
emctl start dbconsole
8. Check the status:
emctl status agent
9. Start dbconsole: https://rac1:1158/em
• Check the services page under ‘Availability’ tab.
• Select new created service ‘demosvc’
• Check service properties to make sure that:
o Enable Load Balancing Advisory is set to ‘Service Time’
o Connection Load Balancing Goal is set to ‘Short’ . The difference between short
and long is that or short, the connection load balancing is based on service time;
and for long, the connection load balancing is based on number of sessions.
o Make sure to NOT select ‘Enable Distributed Transaction Processing’; which is
for 10g old behavior.
10. Go back to front home page for Database on dbconsole, the ‘shutdown’ button could be used
for starting and shutting down database instances.
Configuring WebLogic Server GridLink Data Source Assume you have installed Web Logic 10.3.5 and have the domain configured using config wizard.
1. Start WebLogic: %WLS_HOME%/user_projects/domains/%your_domain%/startWebLogic.cmd
2. Start Admin Console: http://localhost:7001/console
3. Click Services/Data Sources
4. Click ‘New’
5. Select GridLink Data Source. Enter the following value:
Name: racDS
JNDI Name: jdbc/racDS
Select ‘XA Driver’
Click ‘Next’
6. Click ‘Next’ at this page:
7. Click ‘Next’ with choosing option of ‘Enter individual listener information’
8. At this page:
Enter following valued:
Service Name: ‘demosvc.localdomain’ or the service you have created in your RAC database.
Host and Port: enter the SCAN address and listener port. For example:
rac-scan:1521
Database User Name: the user name you have created in the RAC database, for example,
‘oowdemo’
Password: the password you have created in the RAC database, for example,
‘oowdemo’
Then click ‘Next’
9. Test All Listeners at this page:
Connection test succeeded.
Click ‘Next’.
10. At this page:
Select ‘FAN Enabled’
Enter the following values for ONS host and port:
SCAN address: ONS port
For example, rac-scan:6200
Click ‘Next’
11. Test All ONS Nodes
Click ‘Next’
12. Select WebLogic Server Target
Click ‘Finish’
Repeat step 3-12 to configure multiple GridLink Data Sources. We will use the following for the
workshop:
� Name: racDS
� Jndi name: jdbc/racDS
� Name: racDS1
� Jndi name: jdbc/racDS1
� Name: racDS2
� Jndi name: jdbc/racDS2
Deploy and Run the application demonstrating Active GridLink features
13. Click ‘Deployments’ from left pane
Click ‘Install’
Upload your application:
Locate the application for deployment
Install as an application
Click ‘Finish’ to deploy the application:
The application ‘gridlinkdemo’ should be successfully deployed:
14. Run and Verify Active GridLink features:
Open browser with the url: http://localhost:7001/gridlinkdemo/
This application demonstrates GridLink functionality in WebLogic using a personal asset
management scenario.
Stock purchase batch processing
Demonstrates load balancing and fast connection failover by processing stock purchases under
different scenarios such as RAC node shutdown.
Demonstrates RAC Runtime Connection Load-Balancing by processing stock purchases under
different load and the requests would send to different backend RAC instances.
Purchase stocks
Demonstrates RAC transaction affinity by allowing users to order a combination of stocks both
inside and outside a global transaction)
15. Click ‘Stock purchase batch procession’
This application can be used to demonstrate the Load Balancing and Fast Connection Failover
RAC features used in WebLogic (Active GridLink).
In order to demonstrate Load Balancing submit the form below and notice stock purchases are
made using different RAC nodes.
In order to demonstrate Fast Connection Failover shutdown one of the RAC nodes in the cluster
(for example by issuing 'srvctl stop instance -d ORCL -i ORCL1') during this process and notice the
connection pool is cleaned and connections are directed to remaining node. Then restart the
node that was shutdown and notice the pool is once again populated with connections from
restarted node in order to resume load balance capability.
Enter the number of stock purchases of ABCD to process (each insert uses a separate database
connection)
100
Enter the number of stock purchases of ABCD to process per batch (connections are closed at
the end of each batch)
10
Enter location of datasource to use (such as jdbc/racDS)
jdbc/racDS
Click ‘submit’
Runtime Connection Load-Balancing:
The connection requests are load-balanced to different backend instances at runtime:
High Availability with Fast Connection Failover
Planned or un-planned shutdown backend.
For example, shutdown one of RAC instance with following command:
srvctl stop instance -d orcl -i orcl1
(this could be done by dbconsole as well)
From bottom of this page, the connections shown are routed to instance 2 - wlsqadb2
Bring instance 1 –wlsqadb1 backup:
srvctl start instance -d orcl1 -i wlsqadb1
(or could be done by dbconsole)
i: instance name
d: database name
s: service name
From bottom of this page, you could see that the connections are balanced to both instances
again.
This shows fast connection failover and re-join case.
16. Purchase stocks
Go back to the front page of the application:
Click ‘Purchase stocks’
This application can be used to demonstrate the global transaction RAC affinity feature in Active
GridLink.
In order to demonstrate global transaction RAC affinity, submit the form with the option to
purchase shares in a global transaction and notice both the bank account datasource and
brokerage account datasource use the same RAC node.
You will need to use two different GridLink Data Sources for this application.
Option 1:
Select ‘Yes’ for ‘Purchase shared in global transaction’ option.
Click ‘submit’
You will see the connections are routed to same RAC instance. This leverages XA Affinity for
performance by saving cluster wait time at backend.
Option 2:
Select ‘No’ for ‘Purchase shared in global transaction’ option.
Click ‘submit’
You will see the connections are routed to both RAC instances without XA Affinity.
This completes the lab.
Enjoy!!