1 oracle 9i as availability and scalability margaret h. mei senior product manager, st
TRANSCRIPT
1
Oracle 9i ASAvailability and Scalability
Margaret H. Mei
Senior Product Manager, ST
2
Agenda
• Brief 9iAS Overview
• Designing and Deploying Applications– Scalability – Availability
3
Oracle9i Application Server
non-OracleData
Sources
Oracle9iAS Wireless
for wireless clients
Dat
abas
e C
ach
e
Connected Clients
Oracle Enteprise Manager Oracle Advanced Security
Manage Your Web Infrastructure
Web
Cac
he
Ora
cle
HT
TP
Se
rve
r po
wer
ed b
y A
pach
e
non-OracleApps
Oracle Internet Directory
Create Personalized Portals
Run All Your Web Sites & Applications
Developer KitsLDAP, XML, Database
Email, Unified Messaging
Collaborate With Stakeholders
DiscovererReports Services
Extract Business IntelligenceClickstreamIntelligence
Integrate Your Business
Java StoredProcedures
PSPsPLSQL
FormsServices
BC4J
XML/XSLJ2EE CORBA PerlOracle
Oracle Applications Interconnect
Oracle WorkflowOracle Gateways
Portal
Internet File System
4
Agenda
• Brief 9iAS Overview
• Designing and Deploying Applications– Scalability – Availability
5
Layered Scaling
• Scale each tier independent of the other tiers
• Middle-tier: Scale its two major components– Front-end: The web server and different plug-ins
that serve static files and route requests to the back-end servers
– Back-end: Execute application logic written in Java (JSPs, Servlets), PL/SQL (PSPs, Stored Procedures) etc.
• Data-tier: Scale the data-tier
6
Scaling Front-end
• Front-end Apache Web server: Serves static resources and acts as a dispatcher for dynamic requests– The Apache server is stateless (static,
mod_plsql...)– Scale on SMP - Apache process based architecture – Scale on Web Farm: Run multiple instances on a
web farm (exact clones) and use a load balancing solution
• Software load balancers: Oracle 9i AS Web Cache, Network Dispatcher, NLBS etc.
• Round-Robin DNS (RRDNS)• Intelligent IP or Application aware load balancing
hardware like LocalDirector, BigIP, ACEDirector etc.• Combination of one or more of the above
7
Deploying Front-end
• Front-End Web Server Scalability
Front-end Web servers
Load BalancerOracle Web Cache
Back-end servers
InternetDatabase
Shared disk
PL/SQL
PL/SQL
PL/SQL
PL/SQL
8
Deploying Front-end
• Multiple load balancers using RRDNS
Front-end Web servers
Load Balancer 1
Back-end servers
InternetDatabase
Load Balancer 2
9
Back-end Server : Application Design
• Stateless vs. stateful applications– A stateful application maintains session
state information within its runtime environment between successive client calls.
– A stateless application maintains no such information within its environment. It may persist state information in a common store such as a database or in the client browser.
10
Stateful Application Example
Node A Node A
DatabaseDatabase
Node B Node B
ClientClientLoad Load
BalancerBalancer
• Step-by-step example of client requests to a stateful application
11
Stateful Application Example
Node A Node A
DatabaseDatabase
Node B Node B
ClientClientLoad Load
BalancerBalancer
Client issues request; request gets routed for service by Node A. Node A may access db to service the request
• Step-by-step example of client requests to a stateful application
12
Stateful Application Example
Node ANode A
DatabaseDatabase
Client’s session stateClient’s session state Node BNode B
ClientClientLoad Load
BalancerBalancer
Node A services request; maintains session state for Client’s session
• Step-by-step example of client requests to a stateful application
13
Client’s session stateClient’s session state
Stateful Application Example
Node A Node A
DatabaseDatabase
Node B Node B
ClientClientLoad Load
BalancerBalancer
On any subsequent request, Client must be serviced by Node A (and not Node B) to access Client’s session
state
• Step-by-step example of client requests to a stateful application
14
Stateless Application Example
Node A Node A
DatabaseDatabase
Node B Node B
ClientClientLoad Load
BalancerBalancer
• Step-by-step example of client requests to a stateless application
15
Stateless Application Example
Node A Node A
DatabaseDatabase
Node B Node B
ClientClientLoad Load
BalancerBalancer
Client issues request; request gets routed for service by Node A
• Step-by-step example of client requests to a stateless application
16
Stateless Application Example
Node A Node A
DatabaseDatabase
Client’s session stateClient’s session state Node B Node B
ClientClientLoad Load
BalancerBalancer
Node A services request; maintains session state in Database
• Step-by-step example of client requests to a stateless application
17
Client’s session stateClient’s session state
Stateless Application Example
Node A Node A
DatabaseDatabase
Node B Node B
ClientClientLoad Load
BalancerBalancer
On any subsequent request, Client may be serviced by either Node A or Node B
and access session state
• Step-by-step example of client requests to a stateless application
18
Deploying Back-end: Stateless
• Write stateless applications that run on a cluster
• Front-end server(s) load balances across the back-end servers
Front-end servers
Load Balancer
Back-end servers
InternetDatabase
JServ
JServ
JServ
JServ
19
Load-balancing Back-end Apache JServ on a cluster
• Example: Load-balancing between multiple nodes with Apache JServ.
The HTTP Server will load-balance requests to Apache JServ instances. Bigger machines may be allocated
more requests
HTTP HTTP ServerServer
Apache Apache JServJServ
Apache Apache JServJServ
Apache Apache JServJServ
Apache Apache JServJServ
ClientClient
Apache Apache JServJServ
Load Load BalancerBalancer
20
Deploying Back-end Server: Stateful
• Stateful Applications: Use sticky routing
• Use Oracle 8i JVMFront-end servers
Load Balancer
Back-end servers
InternetDatabase
8i JVMPL/SQL
8i JVMPL/SQL
8i JVMPL/SQL
8i JVMPL/SQL
21
Load-balancing HTTP Server + Oracle8i JVM
Client Network Load
Balancer
HTTP Servers Oracle8i Listeners
Oracle8i Dispatchers
Oracle8i Shared ServersPorts Processes
The Oracle8i JVM can load-balance over multiple listener processes
22
Load-balancing HTTP Server + Oracle8i JVM
Client Network Load
Balancer
HTTP Servers Oracle8i Listeners
Oracle8i Dispatchers
Oracle8i Shared ServersPorts Processes
A listener will be chosen at random
23
Load-balancing HTTP Server + Oracle8i JVM
Client Network Load
Balancer
HTTP Servers Oracle8i Listeners
Oracle8i Dispatchers
Oracle8i Shared ServersPorts Processes
The listener will determine which Oracle8i JVM node has the lightest load, and then which dispatcher on that node is most available
24
Load-balancing HTTP Server + Oracle8i JVM
Client Network Load
Balancer
HTTP Servers Oracle8i Listeners
Oracle8i Dispatchers
Oracle8i Shared ServersPorts Processes
The dispatcher will then route the request to one of the server processes
25
Scaling Stateless Applications JDK JVM
• The JDK JVM scales by giving quick performance to many clients. This works well for stateless Java apps because the VM does not get weighted down by holding onto a lot of state.
ClientClient
Apache JServ Apache JServ
on JDK JVM on JDK JVM
HTTPHTTP
Server Server
ClientClient
ClientClient
ClientClient
Nostate
Additional clients do not contributeadditional state to be managed between
successive requests
26
Application Design: Scalability JDK JVM
• However, stateful applications force the VM to perform a lot of concurrent memory management when multiple users access the system. Managing state may inhibit the scalability of the JDK JVM.
ClientClient
Apache JServ Apache JServ
on JDK JVM on JDK JVM
HTTPHTTP
Server Server
ClientClient
ClientClient
ClientClient
Managing this memory may slow down the performance of the JDK JVM
27
Application Design: Scalability Oracle8i JVM
• The Oracle8i JVM is a session-based JVM that handles stateful applications exceedingly well. Performance does not degrade until the capacity of the hardware is reached.
ClientClient
Oracle8Oracle8i i JVM JVM
HTTPHTTP
Server Server
ClientClient
ClientClient
ClientClientNo concurrent GC because of segregated memory spaces
28
Scaling Back-end Server
• Oracle 9i AS provides scalability for both stateless and stateful applications– Stateless Java applications scale well in the JDK JVM
– Stateful Java applications scale well in the Oracle8i JVM (aka JServer)
• Oracle 9i AS also provides a highly scalable infrastructure for: Oracle Forms, Oracle Reports, PL/SQL and Perl applications
29
Scaling Data Server: Oracle 9i AS
• Middle-tier database cache– Reduces load on back-end database
– Faster access by avoiding network round trips
– Works transparently with existing applications
– Does not slow updates etc..
30
Scaling Data Server: Oracle 9i AS
• Example: Web site with catalogWithout Cache:
Static content Static content served from middle served from middle tier. All catalog tier. All catalog queries are resolved queries are resolved on back end.on back end.
With Cache:
Queries resolved at Queries resolved at cache, reducing load cache, reducing load on back end. Cache on back end. Cache data on many middle data on many middle tier nodes for higher tier nodes for higher Scalability.Scalability.
Static
content
Data readsData writes
HTTP Server
Data writesData reads
Static
content
Catalog Catalog datadata
HTTP Server Oracle8i Cache
Catalog Catalog datadata
31
Scaling Data Server: Database Cache
Front-end servers
Load Balancer
Back-end servers
Internet
OPSDatabase
iCache
iCache
iCache
iCache
jserv
jserv
jserv
jserv
OPSDatabase
Partitioned Data-tier
32
Scalability: Putting it all together
• Stateless
Front-end servers
Load Balancer
Back-end servers
Internet
OPSDatabase
iCache
iCache
iCache
iCache
jserv
jserv
jserv
jserv
OPSDatabase
Partitioned Data-tier
Apache
Apache
Apache
Apache
33
Scalability: Putting it all together
• Stateful
Front-end servers
Load Balancer
Back-end servers
Internet
OPSDatabase
iCache
iCache
iCache
iCache
OJVM
OPSDatabase
Partitioned Data-tier
Apache
Apache
Apache
Apache
OJVM
OJVM
OJVM
34
Oracle 9i AS Services for Scalability
• Oracle 9i AS enables scalable stateless and stateful applications, front-end servers, back-end servers and data servers
Oracle 9i AS makes it easy to build scalable web applications
35
Agenda
• Goals for PAS
• Designing and Deploying Applications– Scalability – Availability
36
AvailabilityDeath-detection and restart
• Oracle 9i AS will detect the failure of given threads or processes and restart them as appropriate.– Watchdog in HTTP Server– PMON in Oracle8i JVM, Oracle8i PL/SQL, and Oracle8i
Cache– HTTP Server will detect death of Apache JServ
instance and not route requests to it. Restart of remote Apache JServ in a future release.
37
Availability Redundancy & Failover
• For web server failure, Oracle 9i AS web cache can reroute requests to other web server instances.
• For failure of stateless services, Oracle 9i AS will failover a request to an alternate instance of the service. This is similar to connection re-routing.
38
Oracle 9i AS: High Availability
• Oracle 9i AS can be deployed to create a system with no single point of failure
HTTP Server
Client
Network load-
balancer
HTTP Server
HTTP Server
Apache JServ
Apache JServ
Apache JServ
Oracle8i
Oracle8i Cache
Oracle8i Cache
Oracle8i Cache
HTTP Server
Oracle8i
No single point of failure in database
tier with OPS
Network load-
balancer
39
Oracle 9i AS: Session Isolation
• There is no session isolation in a typical JDK JVM. The failure of one user’s session may cause all users’ sessions to fail.
ClientClient
Apache JServ Apache JServ
on JDK JVM on JDK JVM
HTTPHTTP
Server Server
ClientClient
ClientClient
ClientClient
One client may encounter a buggy sessionOne client may encounter a buggy session
BUGBUG
40
Oracle 9i AS: Session Isolation
• There is no session isolation in a typical JDK JVM. The failure of one user’s session may cause all users’ sessions to fail.
ClientClient
Apache JServ Apache JServ
on JDK JVM on JDK JVM
HTTPHTTP
Server Server
ClientClient
ClientClient
ClientClient
The one bug could bring down all users’ sessionsThe one bug could bring down all users’ sessions
41
Oracle 9i AS: Session Isolation
• JServer isolates sessions from one another. In the case that one fails, the others are unaffected.
ClientClient
Oracle8Oracle8i i JVM JVM
HTTPHTTP
Server Server
ClientClient
ClientClient
ClientClientOne client may encounter a One client may encounter a
buggy sessionbuggy session
BUGBUG
42
Oracle 9i AS: Session Isolation
• JServer isolates sessions from one another. In the case that one fails, the others are unaffected.
ClientClient
Oracle8Oracle8i i JVM JVM
HTTPHTTP
Server Server
ClientClient
ClientClient
ClientClientOnly the buggy session is lost. Only the buggy session is lost. Other sessions are unaffectedOther sessions are unaffected
43
• In the case of failure of a stateless service of Oracle 9i AS, requests can be re-routed to alternate instances of the service.
• If a client is accessing a stateful application, the client may be re-routed to the instance of the application through an alternate route
• Let’s look at an example with the HTTP Server and a stateful application running in Oracle8i JVM...
Oracle 9i AS: Connection Re-routing
44
Oracle 9i AS: Connection Re-routing
• Example: Failure of an HTTP Server node. Subsequent requests can be re-routed through alternate nodes.
HTTP ServerHTTP Server
on Node Aon Node A
ClientClient Network Network load-load-
balancerbalancerHTTP ServerHTTP Server
on Node Bon Node B
Oracle8Oracle8i i JVMJVM
Oracle8Oracle8ii JVM JVM
Oracle8Oracle8i i JVMJVM
45
Oracle 9i AS: Connection Re-routing
• Example: Failure of an HTTP Server node. Subsequent requests can be re-routed through alternate nodes.
HTTP ServerHTTP Server
on Node Aon Node A
ClientClient Network Network load-load-
balancerbalancerHTTP ServerHTTP Server
on Node Bon Node B
Oracle8Oracle8i i JVMJVM
Oracle8Oracle8i i JVMJVM
Oracle8Oracle8ii JVM JVM
A client request comes in and is routed to an HTTP Server instance and an Oracle8i JVM instance
46
Oracle 9i AS: Connection Re-routing
HTTP ServerHTTP Server
on Node Aon Node A
ClientClient Network Network load-load-
balancerbalancerHTTP ServerHTTP Server
on Node Bon Node B
Oracle8Oracle8ii JVM JVM
Oracle8Oracle8i i JVMJVM
Oracle8Oracle8i i JVMJVM
The application in Oracle8i JVM is stateful, and session state is retained in the instance. Also, a cookie may be returned to the client’s browser
• Example: Failure of an HTTP Server node. Subsequent requests can be re-routed through alternate nodes.
47
Oracle 9i AS: Connection Re-routing
• Example: Failure of an HTTP Server node. Subsequent requests can be re-routed through alternate nodes.
HTTP ServerHTTP Server
on Node Aon Node A
ClientClient Network Network load-load-
balancerbalancerHTTP ServerHTTP Server
on Node Bon Node B
Oracle8Oracle8i i JVMJVM
Oracle8Oracle8i i JVMJVM
Oracle8Oracle8i i JVMJVM
Now, in between requests, the HTTP Server on Node A goes down
48
Oracle 9i AS: Connection Re-routing
HTTP ServerHTTP Server
on Node Aon Node A
ClientClient Network Network load-load-
balancerbalancerHTTP ServerHTTP Server
on Node Bon Node B
Oracle8Oracle8ii JVM JVM
Oracle8Oracle8i i JVMJVM
Oracle8Oracle8i i JVMJVM
The next request can be routed to the destination Oracle8i JVM instance through an alternate HTTP Server
• Example: Failure of an HTTP Server node. Subsequent requests can be re-routed through alternate nodes.
49
Oracle 9i AS: Connection Re-routing
HTTP ServerHTTP Server
on Node Aon Node A
ClientClient Network Network load-load-
balancerbalancerHTTP ServerHTTP Server
on Node Bon Node B
Oracle8Oracle8ii JVM JVM
Oracle8Oracle8ii JVM JVM
Oracle8Oracle8ii JVM JVM
If it were just an HTTP Server process that went down, Oracle 9i AS would detect this and restart it
• Example: Failure of an HTTP Server node. Subsequent requests can be re-routed through alternate nodes.
50
Oracle 9i AS: Failover
• Oracle8i Cache features transparent application failover (TAF). In the case that a cache node goes down, client sessions will be automatically recreated on an alternate instance.
Client HTTP Server
OJVM
Oracle8i Cache
Oracle8i Cache
A client has a stateful session with a cache instance
51
Oracle 9i AS: Failover
• Oracle8i Cache features transparent application failover (TAF). In the case that a cache node goes down, client sessions will be automatically recreated on an alternate instance.
Client HTTP Server
OJVM
Oracle8i Cache
Oracle8i Cache
The cache instance may go down
52
Oracle 9i AS: Failover
• Oracle8i Cache features transparent application failover (TAF). In the case that a cache node goes down, client sessions will be automatically recreated on an alternate instance.
Client HTTP Server
OJVM
Oracle8i Cache
Oracle8i Cache
The session automatically re-connects to the new instance. The cache session is
transparently recreated on the alternate instance
53
Availability
• Minimize planned downtime
• No Single Point of Failure
• Session Isolation
• Automatic Death Detection And Restart
• Redundancy and Automatic Failover
Oracle 9i AS makes it easy to build highly available web applications