+ All Categories
Home > Documents > Oracle9i Application Server Java2 Enterprise Edition ... · PDF fileOracle9i Application...

Oracle9i Application Server Java2 Enterprise Edition ... · PDF fileOracle9i Application...

Date post: 03-Mar-2018
Category:
Upload: doankhuong
View: 245 times
Download: 3 times
Share this document with a friend
36
Oracle9i Application Server Java2 Enterprise Edition Facilities and Design Considerations May, 2001
Transcript
Page 1: Oracle9i Application Server Java2 Enterprise Edition ... · PDF fileOracle9i Application Server Java2 Enterprise Edition Facilities and Design Considerations May, ... and JavaMail

Oracle9i Application ServerJava2 Enterprise Edition Facilities and Design Considerations

May, 2001

Page 2: Oracle9i Application Server Java2 Enterprise Edition ... · PDF fileOracle9i Application Server Java2 Enterprise Edition Facilities and Design Considerations May, ... and JavaMail

page 2 of 31

EXECUTIVE SUMMARY

Oracle9iAS v1.0.2.2 represents a significant step forward in Oracle’s Java Strategy.This release provides a complete Java2 Enterprise Edition (J2EE) container writtenentirely in Java and which executes on the standard Java Development Kit (JDK)Virtual Machine (Java VM). Oracle9iAS Containers for J2EE (OC4J) has thefollowing primary features:

Pure Java Container/Runtime executing on JDK

First, OC4J is implemented completely in Java making it: (i) Lightweight - 15 MBdisk, 13 MB of Memory; (ii) Fast to install - less than 1 Minute; (iii) Easy to use -supporting standard Java Development and Profiling Tools; and (iv) Available on allstandard Operating System and Hardware Platforms including Solaris, HP-UX,AIX, Tru64, Windows NT and Linux. With Oracle9iAS v1.0.2.2 Release, it iscertified to run on the JDK 1.2.2 Java VM and will be certified on the JDK 1.3 JavaVM with the upcoming Oracle9iAS Release 2.0.

Complete J2EE 1.2 Container

Second, OC4J provides a complete J2EE container that includes a JSP Translator, aJava servlet engine, and an Enterprise JavaBeans (EJB) container. It also supportsthe Java Messaging Service, JMS, and several other Java specifications. Oracle9iASv1.0.2.2 provides full support for all of the J2EE APIs including:• Enterprise Java Beans (EJB) 1.1 and several parts of the EJB 2.0 specification

including EJB 2.0 style Enterprise Beans and Message Driven Beans.• Servlet 2.2 (and Servlet 2.3 including facilities such as Servlet Chaining and

Filters)• Java Server Pages (JSP) 1.1• Java Transaction API (JTA) 1.0.1• Java Naming and Directory Interface (JNDI) 1.2• Java Messaging Service (JMS) 1.0.1• Java Database Connectivity (JDBC) 2.0• JavaMail 1.1.2OC4J also provides implementations of the following specifications that are part ofthe J2EE 1.3 Specification: EJB 2.0 and Servlets 2.3. It also supports standardservices such as JSP Tag libraries, WAR and EAR file-based deployment, and autodeployment and “hot” deployment of J2EE Applications.

Competitive Performance/Scalability/and Availability

Oracle9iAS v1.0.2.2 provides developers a number of benefits including: (i) FastPerformance: OC4J is the fastest Java Application Server in the market - a separatedocument will provide benchmark results against the major competitors in themarket; (ii) Scalability and Availability: It also requires a significantly smallermemory footprint; has no single point of failure, and provides sophisticated IP-Multicast based clustering facilities to address both stateless and statefulapplication fail-over. In addition, OC4J provides an integrated Java-based

Page 3: Oracle9i Application Server Java2 Enterprise Edition ... · PDF fileOracle9i Application Server Java2 Enterprise Edition Facilities and Design Considerations May, ... and JavaMail

page 3 of 31

Management console providing a single point to configure, monitor, and manage asingle instance or a cluster/group of instances of the Container.

This document provides a detailed technical overview of the J2EE Facilities inOracle9iAS v1.0.2.2. First, it discusses Oracle’s Java Strategy and ProductRoadmap; second, it provides an overview of J2EE and discusses the specifics ofOracle9iAS v1.0.2.2’s support for it; and third, it provides an overview of thescalability and availability facilities of Oracle9iAS Containers for J2EE.

Page 4: Oracle9i Application Server Java2 Enterprise Edition ... · PDF fileOracle9i Application Server Java2 Enterprise Edition Facilities and Design Considerations May, ... and JavaMail

page 4 of 31

1. INTRODUCTION

During the past two years, Java has become the language of choice for developingand deploying web-based applications. Its promise of a unified portable applicationdevelopment solution that can execute on a simpler, lower cost, operating systemand hardware platform-independent, server-based information technologyinfrastructure has prompted considerable interest among the application developercommunity and among corporate Chief Information Officers. They need to extendtheir reach, reduce their costs, and lower their response times by providing easy-to-access services to their customers, employees, and suppliers. Typically, Applicationsthat provide these services must combine existing Information Systems with newbusiness functions that deliver services to a broad range of users. These servicesneed to be: (i) Highly available, to meet the needs of today’s global businessenvironment; (ii) Secure, to protect the privacy of users and the integrity of theenterprise; and (iii) Reliable and scalable, to insure that business transactions areaccurately and promptly processed.

Internet Applications are designed and implemented as multi-tier applications. Amiddle-tier Application Server provides a runtime environment for the Applicationand provides access to existing business functions, legacy systems, and data. TheJava™ 2 Platform, Enterprise Edition (J2EE) reduces the cost and complexity ofdeveloping these multi-tier applications by defining a standard application modeland standard set of programming interfaces for developing multi-tier, InternetApplications. Application Servers that support J2EE provide a standard “container”environment for executing J2EE applications allowing application developers towrite once and target server environments provided by a number of vendors.

Oracle9iAS v1.0.2.2 provides a fast, lightweight, highly scalable, easy-to-use, andcomplete Java2 Enterprise Edition (J2EE) container written entirely in Java whichexecutes on the standard Java Development Kit (JDK) Virtual Machine (Java VM).It provides a complete J2EE 1.2 Container with complete support for EnterpriseJava Beans (EJB) 1.1; Servlet 2.2; Java Server Pages (JSP) 1.1; JTA 1.0.1; JNDI1.2; JMS 1.0; JDBC 2.0; and JavaMail 1.1.2. The J2EE Container also providesnear complete implementations of the following specifications that are part of theJ2EE 1.3 Specification - EJB 2.0 and Servlets 2.3. It also supports standard servicessuch as JSP Tag libraries, WAR and EAR file-based deployment, auto deploymentand “hot” deployment of J2EE Applications; and provides advanced clusteringfacilities to support both stateless and stateful Application Failover. This documentprovides a detailed technical overview of the J2EE Facilities in Oracle9iAS v 1.0.2.2.It is organized into three sections:• First, it discusses Oracle’s Java Strategy and Product Roadmap• Second, it provides an overview of J2EE and discusses the specifics of

Oracle9iAS v 1.0.2.2’s support for it• Third, it provides an overview of the scalability and availability facilities of

Oracle9iAS Containers for J2EE.

Page 5: Oracle9i Application Server Java2 Enterprise Edition ... · PDF fileOracle9i Application Server Java2 Enterprise Edition Facilities and Design Considerations May, ... and JavaMail

page 5 of 31

2. ORACLE’S JAVA STRATEGY AND PRODUCT ROADMAP

Oracle has made a significant strategic commitment to Java and is integrating it ina number of different products and services across the company. Oracle has threeprimary objectives for Java:• Oracle is fully committed to supporting Java standards specifically the Java2

Enterprise Edition (J2EE) as a standard methodology to develop and deployenterprise Java Applications.

• Oracle provides Java developers with a complete development environment forJava - a rich set of Java tools and programmatic interfaces to make applicationdevelopment easy and productive.

• Oracle provides a high performance, scaleable, and highly available serverinfrastructure to deploy Java/J2EE applications.

The figure below illustrates Oracle’s Java strategy which is explained in greaterdetail below.

J2EE Applications

JDK VM

Oracle9iAS

StandardClients

SQLSQL

Java Java

Oracle DB

PL/SQLPL/SQL

Non-OracleDB

Java Tools(JDeveloper)Java Tools(JDeveloper)

Figure: Oracle’s Java Strategy

• J2EE Support: Oracle is fully committed to supporting J2EE Standards and iscurrently in the final stages of completing the process of certifying its J2EEContainer as 100% J2EE Compliant. Oracle9iAS v1.0.2.2 completely supports allJ2EE 1.2 standards and already supports significant parts of the upcomingJ2EE 1.3 standards - particularly servlet 2.3 and EJB 2.0. (Note that the J2EE1.3 standards have not yet been finalized and Oracle is an active participant inthe standards committee and is fully committed to supporting the standards assoon as they are released.)

Page 6: Oracle9i Application Server Java2 Enterprise Edition ... · PDF fileOracle9i Application Server Java2 Enterprise Edition Facilities and Design Considerations May, ... and JavaMail

page 6 of 31

• Tools and Database Access Interfaces: Oracle offers JDeveloper as a Javadevelopment tool (Java IDE) and two different database access interfaces -JDBC and embedded SQL in Java (SQLJ).− JDeveloper: Oracle JDeveloper is a productive development tool that provides

100% support for developing and deploying J2EE Applications. JDeveloperalso integrates an object-relational mapping - Business Components for Java- which supports 1:1 and 1:Many mappings between Java classes anddatabase schemas and allows the use of SQL for queryability.

− JDBC Drivers: It offers two different JDBC drivers: a Type 2 JDBC/OCIdriver for developers writing client-server Java applications or middle tierJava Applications; a Type 4 Thin JDBC driver for those writing Java applets.A specialized version of JDBC executes within the Oracle database allowingJava applications that execute on the server’s Java VM to access datadefined locally. Oracle also recommends the use of Merant’s JDBC drivers toaccess non-Oracle databases including IBM DB/2, Microsoft SQL-Server,Informix, and Sybase from Java. (Merant is an Oracle Partner).

− Embedded SQL in Java: Oracle also provides a standard way to embed SQLstatements in Java programs. It offers a much simpler and higher productiveprogramming API than JDBC. A user writes applications to this higher levelAPI, then uses a standard preprocessor to translate the program to standardJava source with JDBC calls. At runtime, the program can communicatewith multi-vendor databases using standard JDBC drivers. Embedded SQLin Java provides a very easy to use way with which to develop both clientside and middle-tier applications that access databases from Java and todefine stored procedures, triggers, methods etc. within the database server inJava in a portable manner.

• Java Server Environments: Oracle recognizes that users partition their InternetApplication code into three layers - web presentation logic, business logic, anddata manipulation logic.− J2EE Container: In J2EE applications, the web presentation logic is

developed using Java Server Pages (JSPs) or servlets; the business logic isdeveloped as Enterprise JavaBeans (EJBs). To support J2EE Applications,Oracle9iAS provides a standards compliant J2EE container that executes onany JDK Java Virtual Machine (the Java VM provided on each operatingsystem and hardware platform).

− Database Java Environment: For data manipulation in Java, Oracle providesa Java Virtual Machine (that is compatible with the JDK) and serverenvironment in the database that is tightly integrated with SQL andPL/SQL. The Oracle Database environment will allow users to writetraditional database stored procedures, triggers, and Abstract Data Type(ADT) methods in Java. The Java Environment in the database allows usersto use Java as a programming language to manipulate data in the Oracledatabase rather than fetching that data to the middle-tier thus improvingapplication performance.

Now that we have understood Oracle’s Java strategy, let us examine Oracle9iASContainers for J2EE and review the J2EE facilities in Oracle9iAS v1.0.2.2 ingreater detail.

Page 7: Oracle9i Application Server Java2 Enterprise Edition ... · PDF fileOracle9i Application Server Java2 Enterprise Edition Facilities and Design Considerations May, ... and JavaMail

page 7 of 31

2. - ORACLE9iAS CONTAINERS FOR J2EE (OC4J) Oracle9iAS v1.0.2.2 provides a complete Java2 Enterprise Edition (J2EE)environment with Oracle9iAS Containers for J2EE (OC4J). OC4J is writtenentirely in Java and executes on the standard Java Development Kit (JDK) VirtualMachine (Java VM). The primary features of OC4J are::• Pure Java Container/Runtime executing on JDK: First, OC4J is

implemented completely in Java making it: (i) Lightweight - 15 MB disk, 13 MBof Memory; ii) Fast to install - less than 1 Minute; (iii) Easy to use - supportingstandard Java Development and Profiling Tools; and (iv) Available on allstandard Operating System and Hardware Platforms including Solaris, HP-UX,AIX, Tru64, Windows NT and Linux. With Oracle9iAS v1.0.2.2 , it is certified torun on the JDK 1.2.2 Java VM and will be certified on the JDK 1.3 Java VMwith the upcoming Oracle9iAS Release 2.

• Complete J2EE 1.2 Container: Second, it provides a complete J2EEcontainer that includes a JSP Translator, a Java servlet engine, and anEnterprise JavaBeans (EJB) container. Oracle9iAS v 1.0.2.2 provides completesupport for all the J2EE 1.2 APIs including Enterprise JavaBeans (EJB) 1.1;Servlet 2.2; Java Server Pages (JSP) 1.1; JTA 1.0.1; JNDI 1.2; JMS 1.0; JDBC2.0; and JavaMail 1.1.2.

In this section we will examine the Oracle9iAS Containers for J2EE in greaterdetail. For readers who are not familiar with J2EE we provide a brief overview ofeach programming interface or service in J2EE and then discuss OC4J’s support forthe service. The figure below summarizes Oracle9iAS’ J2EE Facilities.

JSP Servlet EJB

JTA

JMS

JND

I

Java Mail

JDB

C

RM

I

JDK VM

Oracle9iAS

Browser(HTML, XML)Browser

(HTML, XML)

Java(RMI, IIOP)

Figure: Oracle9iAS Containers for J2EE - J2EE facilities in v.1.0.2.2

A. Java Servlets

Page 8: Oracle9i Application Server Java2 Enterprise Edition ... · PDF fileOracle9i Application Server Java2 Enterprise Edition Facilities and Design Considerations May, ... and JavaMail

page 8 of 31

A Java servlet is a program that extends the functionality of a Web server. A servletreceives a request from a client, dynamically generates the response (possiblyquerying databases to fulfill the request), and then send the response containing anHTML or XML document to the client. Servlets are similar to CGI but much easierto write, since servlets use Java classes and streams. They are also faster to executebecause servlets are compiled to Java Byte code and at run time the servlet instanceis kept in memory – each client request spawns a new thread. Servlets make it easyto generate data to an HTTP response stream in a dynamic fashion. The issuefacing servlets is that HTTP is a stateless protocol. That is, each request isperformed as a new connection, so flow control does not come naturally betweenrequests. Session tracking or session management maintains the state of specificclients between requests.

OC4J’s Servlet Engine executes on the JDK Java VM and provides:• Support for Servlet 2.3: The OC4J Servlet Engine provides complete support for

the Servlet 2.2 and also supports the Servlet 2.3 specification (the Servlet 2.3specification is part of the upcoming J2EE 1.3 Specification).

• 100% Compatible with Tomcat: The OC4J Servlet Engine is 100% compatiblewith the Tomcat Servlet Engine delivered by the Apache consortium. As a result,developers who have used Apache and Tomcat to develop their applications caneasily deploy them to Oracle9iAS.

• Complete Support for Filters: Oracle9iAS v1.0.2.2 supports simple and complexfilters which are part of the Servlet 2.3 specification. Specifically, a filter is acomponent that is invoked when a client requests a resource that the Filter ismapped to such as a URL pattern or a Servlet Name. Normally a filter is used towrap and manipulate a request, response, or header values before or after theexecution of the original request target and does not itself return any responseto the client. Filters can be simple where they are configured to act upon a singlerequest, complex where they act upon multiple requests, parameterized wherethey can receive input and output arguments; and chained where they can beplaced into a chain where are a number of Filters can be invoked one after theother.

• Full WAR file-based Deployment: Servlets are packaged and deployed to J2EEContainers using a standard format called a Web Application Archive (WAR)file. OC4Jprovides: (i) A WAR file Packaging Tool that takes several servlets(and JSPs see below) and packages them into a WAR file; (ii) A WAR fileDeployment Tool that takes the resulting WAR and deploys it to one or moreOracle9iAS instances. The WAR Deployment Tool also supports clusterdeployment enabling a specific archive to be simultaneously deployed to all theOracle9iAS instances defined to constitute a “cluster”.

• Auto-Compile, Auto-Deployment of Servlets: OC4J also provides automaticcompilation of servlets and automatic deployment where the server receives a.WAR archive and automatically decompresses it and installs the application.Both of these features substantially shorten the develop, compile, deploy cycle ofbuilding J2EE Applications.

• Stateful Failover and Cluster Deployment of Servlets: A cluster is a group ofOracle9iAS servers that coordinate their actions in order to provide scalable,

Page 9: Oracle9i Application Server Java2 Enterprise Edition ... · PDF fileOracle9i Application Server Java2 Enterprise Edition Facilities and Design Considerations May, ... and JavaMail

page 9 of 31

highly-available services in a transparent manner. Servlets make use of theHTTP session object to save their state between method requests - for instance,the contents of a Web shopping cart or travel itinerary. OC4J supports an IP-multicast based clustering mechanism that allows servlets to transparently (i.e.without any programmatic API changes) replicate servlet session statespecifically HTTP session objects to other Oracle9iAS instances. (For moreinformation, see section 3 below).

B. Java Server Pages

Java Server Pages (JSPs) are a text-based, presentation-centric way to developservlets. JSPs allow web developers and designers to rapidly develop and easilymaintain, information-rich, dynamic web pages that leverage existing businesssystems. JSPs separate the content presentation from content generation enablingweb designers to change the overall page layout without altering the underlyingdynamic content. JSPs use XML-like tags and scriptlets written in the Javaprogramming language to encapsulate the logic that generates the content for thepage. Additionally, the application logic can reside in server-based resources, suchas JavaBeans, that the page accesses with these tags and scriptlets. All formatting(HTML or XML) tags are passed directly back to the response page. By separatingthe page logic from its design and display and supporting a reusable component-based design, JSP technology makes it faster and easier than ever to build web-based applications. A JSP page looks like a standard HTML or XML page, withadditional elements that the JSP engine processes and strips out. Typically, the JSPelements create text that is inserted into the results page.

Both JSP pages and servlets are more desirable than Common Gateway Interface(CGI), because CGI is not platform-independent, uses more overhead, and does nothave an easy way to access parameter data and pass it to a program. There areseveral ways an application developer can use JSPs: (I) JSP pages can be used withJavaBeans classes to define Web templates for building a Web site made up of pageswith a similar look and feel. The JavaBeans class render the data allowing yourtemplate to have no Java code which means that it can be maintained by an HTMLeditor. (ii) For simple Web-based applications using JSP pages, content can bebound to the application logic using custom tags or scriptlets instead of a JavaBeansclass.

A JSP page consists of the following elements:• JSP Directives: A JSP Directive passes information to the JSP engine. There

are several types of JSP Directives including: Page Directives whichcommunicate page-specific information, such as buffer and thread informationor error handling; Language Directives which specify the scripting language,along with any extensions; Include Directives which can be used to include anexternal document in the page; and Taglib Directive which indicate a library ofcustom tags that the page can invoke.

• JSP Actions or Tags which implement JSP processing through JSP-specificXML-based tags. A tag is used to encapsulate functionality that can be usedfrom a JSP Page - examples might include conditional logic, database access,

Page 10: Oracle9i Application Server Java2 Enterprise Edition ... · PDF fileOracle9i Application Server Java2 Enterprise Edition Facilities and Design Considerations May, ... and JavaMail

page 10 of 31

and iterations. JSP 1.0 includes a number of standard tags, referred to as thecore tags and JSP 1.1 includes additional standard tags. The advantage of tagsis that they are easy to use and share between applications.

• Scriptlets: JSP pages can also includes include small scripts, called scriptlets, ina page. A scriplet is a code fragment, executed at request time processing.Scriptlets may be combined with static elements on the page (as in the exampleabove) to create a dynamically-generated page. Scripts are delineated within <%and %> markers. Anything within those markers will be evaluated by thescripting language engine, in our example the Java virtual machine on the host.The JSP specification supports all of the usual script elements, includingexpressions and declarations.

OC4J provides a JSP 1.1 Compliant Translator and Runtime Engine. It has severalimportant features:• Full Support for JSP 1.1: The JSP Translator and runtime provides full support

for JSP 1.1 including support for all JSP Directives and all core/standard JSPTags.

• Simple, Body, Parameterised, and Collaboration Tags: OC4J supports simpleJSP tags where the body of the tag is evaluated only once; Body Tags where thebody of the tag may be evaluated multiple times (as in an iterator loop);Parameterised Tags where the Tag can accept and display parameters; andCollaboration Tags which are a special kind of Parameterised Tag where twotags are designed to collaborate on a task. For example, one Tag could add acertain value to the page scope and another Tag can then look for this value forfurther processing.

• JSP Caching Tags: Since JSPs are a dynamic web page generation technology,caching can be used to improve the performance and scalability of web sites builtwith JSPs. Oracle’s JSP Translator provides standard syntax which allows aJSP developer to indicate whether a specific JSP tag is cacheable either in ashared Java cache (when additional XSL-T transformations for instance mayneed to be applied) or in a Web cache (where the final pages are cached foraccess from clients). By indicating at the tag level using standard JSP tagsyntax whether specific JSP tags are cacheable, Oracle9iAS simplifies howcaching can be used by application developers and also improves the fine-granularity at which components of web pages can be cached (even if the entirepage itself cannot be cached). Using the standard scripting extensions, thecached JSP pages can not only be served from Oracle9iAS Web Cache but alsofrom Internet Content Delivery Networks such as Akamai.

• Mail, Search and other Tags: Oracle9iAS provides a number of additional JSPTag libraries to send and receive e-mail, access files (including in Oracle’sInternet File System), embed XML result sets into JSP pages, and execute websearches/queries.

• Full WAR file-based Deployment: Oracle9iAS also provides tools to: (i) PackageJSP Pages and servlets into J2EE standard Web Application Archive (WAR)files; and (ii) A deployment tool that takes the resulting WAR file and deploys itto one or more Oracle9iAS instances. The WAR Deployment Tool also supports

Page 11: Oracle9i Application Server Java2 Enterprise Edition ... · PDF fileOracle9i Application Server Java2 Enterprise Edition Facilities and Design Considerations May, ... and JavaMail

page 11 of 31

cluster deployment enabling a specific archive to be simultaneously deployed toall the Oracle9iAS instances defined to constitute a “cluster”.

C. Enterprise JavaBeans (EJB)

Enterprise JavaBeans (EJB) components are designed to encapsulate business logic,so that the developer does not have to worry about programming code for suchmundane things as database access, transaction support, security, caching, andconcurrency. In the EJB specification they are the responsibility of the EJBcontainer. An enterprise bean consists of interfaces and classes. Clients accessenterprise bean methods through the enterprise bean's home and remote interfaces.The home interface provides methods for creating, removing, and locating theenterprise bean and the remote interface provides the business methods. Atdeployment time, the container creates classes from these interfaces that it uses toprovide access to clients seeking to create, remove, locate, and call business methodson the enterprise bean. The enterprise bean class provides the implementations forthe business methods, create methods, and finder methods; and if the bean managesits own persistence, provides implementations for its lifecycle methods as well.There are two types of enterprise beans - session beans and entity beans.• Session Beans: A session bean represents a transient conversation with a client,

and might execute database reads and writes. A session bean might invoke theJDBC calls itself, or it might use an entity bean to make the call, in which casethe session bean is a client to the entity bean. A session bean's fields contain thestate of the conversation and are transient. If the server or client crashes, thesession bean is lost. Session beans can be stateful or stateless.− Stateful Session Beans: A stateful session bean contains conversational state

on behalf of the client. The conversational state is the session bean's instancefield values plus all objects reachable from the session bean's fields. Statefulsession beans do not represent data in a persistent data store, but they canaccess and update data on behalf of the client.

− Stateless Session Beans: Stateless session beans do not have any stateinformation for a specific client. They typically provide server-side behaviorthat does not maintain any particular state. Stateless session beans requirefewer system resources. A business object that provides a generic service orrepresents a shared view of stored data is a good candidate for a statelesssession bean.

• Entity Beans: An entity bean represents data in a database and the methods toact on that data. In a relational database context for a table of employeeinformation, there is one bean for each row in the table. Entity beans aretransactional and long-lived - as long as the data remains in the database, theentity bean exists. Entity Beans can support either Container Managed or BeanManaged Persistence.− Container Managed Persistence (CMP): With CMP, an application developer

does not need to explicitly map the Entity Bean to the persistent databasestore since the EJB container transparently maps and manages the EntityBean’s interaction with the persistent store. As a result, an entity bean using

Page 12: Oracle9i Application Server Java2 Enterprise Edition ... · PDF fileOracle9i Application Server Java2 Enterprise Edition Facilities and Design Considerations May, ... and JavaMail

page 12 of 31

CMP does not require the developer to use any JDBC 2.0 APIs for databaseaccess, making CMP simpler and easier to use - however, it limits theapplication developer’s control of the interaction between the ApplicationServer and database and, therefore, may introduce some performanceoverhead.

− Bean Managed Persistence (BMP): In contrast, BMP can be used bydevelopers who want maximum control between the way an enterprise beanwrites and reads state from a persistent store. BMP is more complex thanCMP since the application developer will have to implement the bean'slifecycle methods with JDBC 2.0 API code to handle loading and storing dataand maintaining consistency between the run time and persistent databasestorage. BMP should be used by developers looking for maximum controlover the EJB and also when an EJB is being backed up in a non-relationaldatabase.

OC4J provides a JDK-based EJB Container that provides:• Full Support for EJB 1.1 and Significant Parts of EJB 2.0: The EJB Container

provides complete support for the EJB 1.1 specification including full support forsession beans and entity beans, and full support for Bean Managed Persistence(BMP) and Container Managed Persistence (CMP). OC4Jalso implementssignificant aspects of the EJB 2.0 specification (that is part of the upcomingJ2EE 1.3 specification) such as the standard O-R mapping and message-drivenbeans.

• Complete Container Managed (CMP) and Bean Managed Persistence (BMP)Implementation: Oracle9iAS provides complete CMP and BMP for Entity Beanssupporting both its own object-relational mapping (O-R) and the O-R mappingspecified in the EJB 2.0 specification. There are a number of important featuresin OC4J’s Entity Bean support:− Simple O-R Mapping: OC4J supports both 1:1, Many:1, and 1:Many object-

relational mappings. It provides a simple facility to automatically map fieldsof an entity bean to corresponding database table. Additionally, it allowsusers to specify object-relational mappings between EJBs allowingdevelopers to use 1:1 Mappings in EJBs with zero work (this is a feature thatis part of the EJB 2.0 specification).

− Complex O-R Mappings: A common problem is that it is hard to mapanything but a simple bean with simple fields to a database table withoutwriting custom code to do the mapping. As a result, most entity beandevelopment is divided into two categories - simple (1:1) object models thatuse CMP; and practical (more complex) object models that use BMP. OC4Jincludes an O-R mapping system that allows complex object models to bemapped to database tables with ease allowing practical object models to useCMP. Specifically, it allows the following types of fields to be mapped withinentity beans: simple objects and primitives (eg. INT, CHAR); objects(compound objects); serializable objects (compound objects that can beserialized and stored in BLOBs and CLOBs); entity reference (a reference toanother entity bean); and collections. Further, it provides an isolation layer

Page 13: Oracle9i Application Server Java2 Enterprise Edition ... · PDF fileOracle9i Application Server Java2 Enterprise Edition Facilities and Design Considerations May, ... and JavaMail

page 13 of 31

that captures the SQL that is automatically code generated allowing theCMP facilities to target Oracle and non-Oracle databases.

• Dynamic EJB Stub Generation: With OC4J, an application developer does notneed to pre-compile EJB stubs using ejbc, rmic or other such facilities into theclient application. Rather, the Oracle9iAS EJB container generates EJB stubson demand as it needs them - this makes application and system maintenancesignificantly simpler than competitor products.

• Full EAR File-based Deployment: OC4J provides tools to: (i) Package WAR andEnterprise JavaBeans into standard J2EE Compliant Enterprise ApplicationArchives (EAR files); and (ii) A deployment tool that takes the resulting .EARfile and deploys it to one or more Oracle9iAS instances. The EAR DeploymentTool also supports cluster deployment enabling a specific archive to besimultaneously deployed to all the Oracle9iAS instances defined to constitute a“cluster”.

• Simplified and Automatic Deployment of EJB Applications: In J2EEApplications, there are two kinds of deployment descriptors or module-configuration files. The generic J2EE deployment files that all applicationservers support and vendor specific ones - the generic ones are used by theapplication developer or component assembler and the vendor specific ones bythe application deployer. OC4J supports Application Server specific deploymentinformation in two ways:− Auto-Deployment: In the auto-deployment scenario, the Oracle specific

deployment information is automatically generated when the J2EE EAR fileis deployed on the server.

− Simplified Configuration Customization: In addition, any Oracle-specificconfiguration information can be customized by manually editing a simpleset of XML configuration files that capture Application Server-specificdeployment and configuration information. They include settings to: auto-create and auto-delete tables for CMP; security role mappings; JNDINamespace access; session persistence and timeout settings; transaction-retry settings; CMP and O-R mappings; buffering, character sets; locales;virtual directories; cluster configuration; session-tracking; and developmentand debugging mode settings.

− Hot Deployment: When an application developer changes an EJB modulethat has already been deployed, the developer does not need to either re-deploy the EJB or restart the server. The user needs to simply edit theserver.xml configuration file, the server reads the file, and automaticallypicks up the changes.

D. Java Database Connectivity Services (JDBC)

JDBC is essentially a portable bridge to relational databases. It is modeled onODBC (Open Database Connectivity) specification and is thus fairly simple and wellunderstood. It decouples the database from the program code through the use ofdrivers. Oracle9iAS v 1.0.2.2 offers JDBC Drivers to access both Oracle and non-Oracle Databases from Java:

Page 14: Oracle9i Application Server Java2 Enterprise Edition ... · PDF fileOracle9i Application Server Java2 Enterprise Edition Facilities and Design Considerations May, ... and JavaMail

page 14 of 31

• Oracle Database Access via JDBC: With Oracle9iAS v1.0.2.2, Oracle providestwo JDBC drivers to access Oracle8.0, 8i, and 9i Databases from Java. Thesetwo JDBC Drivers are:− Oracle JDBC-OCI Driver: JDBC-OCI is a Type 2 Oracle JDBC driver which

communicates with the Oracle Database using the Oracle OCI library. It iscurrently used both for developers building client-server applications and isalso the default JDBC driver used to communicate from J2EE Applicationsexecuting in the Oracle9iAS mid-tier to the Oracle Database. It does requireinstallation of the Oracle client libraries in the mid-tier.

− Oracle Thin JDBC Driver: Oracle Thin JDBC is a 2 MB pure Java (Type 4)JDBC driver which is implemented completely in Java and communicateswith the Oracle Database using the SQL*Net (Net8) protocol which has beenimplemented in Java. From an application development point of view, thethin JDBC driver can be used during development and testing - the thindriver’s pure Java call stack facilitates end-to-end debugging. It can also bedownloaded with Java applets which are communicating directly with anOracle Database. The thin JDBC driver is a 100% compatible with theOracle JDBC-OCI driver - the only changes that a user needs to make arethe connect strings used to connect to the Oracle DB.

• Full JDBC 2.0 Support: Additionally, Oracle’s JDBC Drivers are fully JDBC 2.0compliant providing:− Complete Data Type Support: Support for advanced data types, such as

BLOBs, CLOBs, Character Streams; Abstract Data Types; Collections; andwith the Oracle9I Database Release support for Abstract Data Types withInheritance

− JDBC 2.0 Connection Pooling: They also provide full support for the JDBC2.0 Connection Pooling facilities.

− Advanced Features: They also provide a number of advanced features such assupport for Transparent Application Failover which allows the mid-tier toredirect connections to a “failed-over” node when an Oracle Databasefailsover; scrollable result sets; batch updates; Unicode support; and severalother advanced capabilities.

− Oracle8.0,8i.9I Support: Oracle9iAS v 1.0.2.2 JDBC Drivers are certifiedwith Oracle8.0, 8i, and 9i Database Release 1.

• Merant JDBC Drivers: To access non-Oracle Databases from OC4J, Oracle alsorecommends Type 4 JDBC Drivers from Merant (an Oracle Partner). Merantprovides JDBC Drivers to access Informix, Sybase, Microsoft SQL-Server, andIBM DB/2 Databases from Oracle9iAS.

E. Java Naming and Directory Interface (JNDI)

JNDI is the standard interface to naming and directory services. J2EE applicationsuse JNDI to find other distributed objects. The JNDI Interface has two parts: anapplication-level interface that is used by application programs to access namingand directory services and a service provider interface to attach a provider ofnaming and directory services.

Page 15: Oracle9i Application Server Java2 Enterprise Edition ... · PDF fileOracle9i Application Server Java2 Enterprise Edition Facilities and Design Considerations May, ... and JavaMail

page 15 of 31

Oracle9iAS v1.0.2.2 provides a complete JNDI 1.2 implementation. Servlets andEnterprise JavaBeans access names using the standard JNDI programminginterfaces. The JNDI service provider is implemented in an XML-based file system.Oracle9iAS Release 2.0, will maintain the file system-based JNDI implementationbut also provide capabilities to use LDAP as an alternative JNDI Service Provider.

F. Java Transaction API (JTA)

The J2EE transaction model lets an application developer specify at deploymenttime relationships among methods which comprise a single transaction, so allmethods in one transaction are treated as a single unit. The J2EE Standardrequires such support because a transaction is a series of steps that must either allcomplete or all be backed out. For example, you might have a series of methods inan enterprise bean that move money from one account to another, by debiting thefirst account, and crediting the second account. You want the entire operation to betreated as one unit, so if there is a failure after the debit and before the credit, thedebit is rolled back. Transaction attributes are specified on an applicationcomponent during assembly. This lets you group methods into transactions acrossapplication components, which means you can easily change application componentswithin a J2EE application and reassign the transaction attributes without changingcode and recompiling.

The Java Transaction API (JTA) and Java Transaction Service (JTS) form the basisof the transactional support in J2EE and more specifically for EJB and JDBC 2.0.JTS is a low-level API for transaction management that basically maps Java to theObject Management Group (OMG) Object Transaction Service. JTA is a high-levelAPI that consists of two parts:• Transaction Interface that allows transaction demarcation. This enables work

done by distributed components to be bound by a global transaction. It’s a way ofmarking groups of operations to constitute a transaction.

• XA Resource Interface based upon the X/Open/ XA interface that enables thehandling of distributed transactions. These are sometimes referred to as TwoPhase Commit transactions and involve coordination of a transactions acrossmore than one resource, such as a database or queue. With J2EE, developers donot need to be concerned about programming explicit transactions with JTA,since that work is done through the JDBC and EJB APIs handled by thecontainer and configured by the application deployment descriptor. Applicationdevelopers can focus on the design of the transaction rather than itsimplementation.

OC4J provides a complete implementation of the JTA 1.0.1 specification.Oracle9iAS Release 2.0 will integrate the JTA facilities with a middle-tierDistributed Commit Coordinator based on the Oracle Database’s CommitCoordinator that provides highly scalable 1PC and 2PC (Two Phase commit)facilities across Oracle and non-Oracle XA compliant Resource Managers.

G. Java Messaging Service (JMS)

Page 16: Oracle9i Application Server Java2 Enterprise Edition ... · PDF fileOracle9i Application Server Java2 Enterprise Edition Facilities and Design Considerations May, ... and JavaMail

page 16 of 31

JMS is the J2EE mechanism to support the exchange of messages between Javaprograms. This is how Java supports asynchronous communication – where thesender and receiver don’t need to be aware of each other and thus can operateindependently. JMS supports two messaging models:• Point to point is based on message queues. A message producer sends a message

to a queue. A message consumer can attach itself to a queue to listen formessages. When a message arrives on the queue, the consumer takes it off thequeue and responds to it. Messages can be sent to just one queue and will beused by just one consumer. Consumers have the option to filter messages tospecify the exact message types they want.

• Publish and subscribe is a model in which producers send messages to a topicand all the registered consumers for that topic retrieve those messages. In thiscase, many consumers can receive the same message.

OC4J provides a complete implementation of the JMS 1.0 specification. Oracle9iASRelease 2.0 will integrate the JMS Interface with Oracle’s Advanced QueuingMessaging Service.

H. Java Security Services

Application behavior such as security and transaction management can beconfigured at deployment time on Web and enterprise bean components. Thisfeature decouples application logic from configuration settings that might vary withthe assembly. The J2EE security model lets you configure a Web or enterprise beancomponent so system resources are accessed only by authorized users. For example,a Web component can be configured to prompt for a user name and password. AnEnterprise Bean component can be configured so only persons in specific groups caninvoke certain kinds of its methods. Alternatively, a servlet component might beconfigured to have some of its methods accessible to everyone and a few methodsaccessible to only certain privileged persons in an organization. The same servletcomponent can be configured for another environment to have all methods availableto everyone, or all methods available to only a select few.

OC4J has a very powerful Access Control List (ACL) mechanism that allows forfine-grained control of the usage of components running on the server. You candefine what can or cannot be executed by which user or group of users right down tothe Java method level. This ACL mechanism covers anything that runs onOC4Jexcept for EJBs. These have their own access control mechanism defined in theEJB specification. Security realms allow the administrator to import informationfrom existing authorization or authentication systems into the ACL. You can thusimport information from the NT security system, from an LDAP system, from theUnix password file, or from the database. Oracle9iAS v1.0.2.2 is fairly completewith respect to security. It includes all of the classes for: (I) Secure Sockets Layer(SSL) version 3; (ii) RSA Encryption; and (iii) Support for X.509 certificates, version3. Another related security topic is the functionality of firewall tunneling.Oracle9iAS v1.0.2.2 provides the ability to go through firewalls and proxies viaHTTP and HTTPS tunneling. With Oracle9iAS Release 2.0, the J2EE security

Page 17: Oracle9i Application Server Java2 Enterprise Edition ... · PDF fileOracle9i Application Server Java2 Enterprise Edition Facilities and Design Considerations May, ... and JavaMail

page 17 of 31

facilities will support the Oracle Login Server for single-sign on and single stationadministration of security.

I. RMI and HTTP Tunneling Services

When J2EE Applications are deployed, they are typically divided into two or threetiers: the Web Server Tier where the HTTP Listeners are deployed; the WebPresentation Tier where the JSPs and Servlets are deployed; and the EJB Tierwhere the Business Logic defined as EJBs is deployed. Smaller web sites combinethese different tiers into one physical mid-tier; larger web sites divide thesedifferent tiers into 2 or 3 separate physical tiers for security, scalability, and loadbalancing purposes. Oracle9iAS takes these architectural issues into considerationsand is designed to meet these needs:• Web Server to JSP/Servlet Engine Connectivity: The web server can either use

the Apache ajp protocol or HTTP to direct requests to the JSP/servlet engine. Asa result, the web server can even be placed outside a firewall and can directrequest to the servlet engine which is placed behind the firewall.

• JSP/Servlet-to-EJB and EJB-to-EJB Connectivity: Communication from thePresentation Logic Tier to Business Logic Tier and between EJBs is done usingstandard RMI which gives any client or Web tier program accessing an EJBdirect access to the services in the EJB tier. These services include JNDI forlooking up and referencing EJBs, Java Messaging Service (JMS) for sending andreceiving asynchronous messages, and JDBC for relational database access.

• HTTP and HTTP-S Tunneling: Oracle9iAS also supports the ability to tunnelRMI over HTTP and HTTP-S protocols. RMI over HTTP/HTTP-S tunneling canbe used for Java-based clients when they need to communicate with Oracle9iASand the only option is to use the HTTP protocol. Typically, HTTP tunnelingprovides a way to simulate a stateful socket connection between a Java clientand Oracle9iAS and to "tunnel" this socket connection through an HTTP port ina security firewall. HTTP is a stateless protocol, but Oracle9iAS providestunneling functionality to make the connection appear to be a regular statefulRMI Connection. Under the HTTP protocol, a client may only make a request,and then accept a reply from a server. The server may not voluntarilycommunicate with the client, and the protocol is stateless, meaning that acontinuous two-way connection is not possible. Oracle9iAS’s HTTP tunnelingsimulates an RMI Connection via the HTTP protocol, overcoming theselimitations.

As a result, the various J2EE components in Oracle9iAS v1.0.2.2 can be eitherdeployed on a single physical tier (typically to optimize performance) or on separatephysical tiers (for redundancy such as connection rerouting for high availability).

J. Summary

In summary, Oracle9iAS v1.0.2.2 with OC4J, represents a significant step forwardin Oracle’s support for J2EE providing a complete J2EE container that includes aJSP Translator, a Java servlet engine, and an Enterprise JavaBeans (EJB)container.

Page 18: Oracle9i Application Server Java2 Enterprise Edition ... · PDF fileOracle9i Application Server Java2 Enterprise Edition Facilities and Design Considerations May, ... and JavaMail

page 18 of 31

J2EE Required Standard Interfaces 9iAS v 1.0.2.2Support

Java Server Pages (JSP) 1.1Servlets 2.2

Enterprise JavaBeans (EJB) 1.1Java Transaction API (JTA) 1.0.1

Java Messaging Service (JMS) 1.0Java Naming and Directory Interface

(JNDI)1.2

Java Mail 1.1.2Java Database Connectivity (JDBC) 2.0

Figure: Oracle9iAS v 1.0.2.2 J2EE Support

OC4J provides complete support for all the J2EE 1.2 APIs including EnterpriseJava Beans (EJB) 1.1; Servlet 2.2; Java Server Pages (JSP) 1.1; JTA 1.0.1; JNDI1.2; JMS 1.0; JDBC 2.0; and JavaMail 1.1.2. Oracle9iAS is in the final stages ofbeing certified to be 100% J2EE compliant.

3. USABILITY, PERFORMANCE, SCALABILITY, AND AVAILABILITY

Now that we have a clear understanding of the capabilities of OC4J, let us examinethe usability, performance, scalability and availability of the environment.

A. Footprint/Usability of OC4J

Oracle9iAS v1.0.2.2 substantially reduces the disk and memory footprint of theJ2EE Container/Server. As a result, it significantly reduces the cost of thehardware required to install and run the J2EE Environment and enhances theusability of developing and deploying J2EE Applications. There are three importantfactors that make Oracle9iAS v1.0.2.2 extremely easy-to-use to develop and deployJ2EE Applications - (i) Lightweight Product Footprint; (ii) Simplified Deploymentand Configuration of Applications; and (iii) Simplified Application Debugging.• Lightweight Product Footprint: OC4J is deployed completely on the JDK Java

Virtual Machine and, as a result, has a radically lower disk and memoryfootprint than the preceding Oracle9iAS Java environment and competitive JavaApplication Servers. The chart below summarizes the footprint requirements forOracle9iAS v1.0.2.2.

Page 19: Oracle9i Application Server Java2 Enterprise Edition ... · PDF fileOracle9i Application Server Java2 Enterprise Edition Facilities and Design Considerations May, ... and JavaMail

page 19 of 31

Area Oracle9iAS

v1.0.2.2 WebLogic 5.0 IBM

Websphere Download File Size 10 MB 76.5 MB 100 MB Disk Footprint 15 MB 134 MB 120 MB Minimum MemoryFootprint

13 MB 128 MB 48 MB

Figure: OC4J Footprint vs Competitors

• Simplified Deployment and Configuration of the Server: OC4J is very easy to setup and configure. The installation and configuration requires installing ordownloading a standard zip file - once the zip file is downloaded, installation isas simple as uncompressing it and copying a JAR (Java ARchive) file into aspecified root directory. A single command is sufficient to get the server, a J2EE1.2 Application Server up and running. Further, it is extremely easy to configurethe Java Container for even relatively complex system architectures. All of theinformation required to configure the J2EE Container itself are captured as 6XML files - as a result, developers can change the configuration of both the J2EEContainer and the J2EE Applications that are deployed on the container bysimply editing a set of XML property files. The 6 XML Configuration Files are:− server.xml: The server.xml file contains the configuration information for the

application server itself including the library path name; the globalapplication name; the maximum number of connections the server allows;logging settings; Java compiler settings; cluster ID; transaction timeout andSMTP host. The server.xml file also contains references to otherconfiguration files and is also the place where you add your own applications.

− web-site.xml: The web-site.xml file contains the configuration for a web sitespecifically the hostname and virtual host settings for the site; the access logformat; SSL configuration information; and settings for user webapplications.

− principals.xml: The principals.xml file is the location of user and groupconfiguration information for security purposes.

− data-sources.xml: The data-sources.xml file contains configurationinformation for the data sources used. A data source has the followingsettings: the JDBC driver; the JDBC URL; the JNDI paths used to bind thedata source; the database schema to use; the inactivity timeout; and themaximum number of connections allowed by the database. Databaseschemas are used to make auto-generated SQL used for Container ManagedPersistence work with different database systems.

− rmi.xml and jms.xml: The rmi.xml and jms.xml files set up the configurationinformation for the JMS and RMI systems allowing a user to specify: thehostname/port that the RMI (and JMS) servers bind to and logging settings.In addition, the jms.xml file allows specification of queues and topics to bebound to the JNDI tree, and the RMI server allows specification of theremote servers to communicate to; and the clustering settings to be used.

Page 20: Oracle9i Application Server Java2 Enterprise Edition ... · PDF fileOracle9i Application Server Java2 Enterprise Edition Facilities and Design Considerations May, ... and JavaMail

page 20 of 31

• Simplified Application Deployment and Configuration: As described in theprevious section, OC4Jprovides a simple set of XML configuration files that canbe edited to configure the J2EE application that is being deployed on Oracle9iASitself. Oracle9iAS provides a number of tools to package and deploy J2EEApplications including:− Assembly Tools: Oracle9iAS provides a number of assembly tools to configure

and package J2EE Applications. The output from these tools are compliantwith J2EE Standards and are not specific to the Oracle9iAS J2EE Container.These include: (I) A WAR File Assembly Tool to assemble JSP, Servlets, TagLibraries and Static Content into WAR files; (ii) EJB Assembler whichpackages an EJB Home, Remote Interface, Deployment Descriptor and theEJB itself into a standard JAR file; (iii) EAR File Assembly Tool whichassembles WAR Files and EJB JARs into standard EAR files; and (iv)Taglibrary Assembly Tool which assembles JSP Tag Libraries into standardJAR files.

− Administration Tools: Oracle9iAS also provides two different administrationfacilities to configure, monitor, and administer OC4J. (I) A Command LineTool which helps perform administrative tasks locally or remotely from acommand prompt. (ii) A Graphical Management Console built in Java whichprovides a single point of administration across one or more, local or remoteJ2EE containers. The graphical console will be integrated with OracleEnterprise Manager.

• Simplified Application Debugging: While modern Application Servers automatea great number of tasks for the application developer improving the developer’sefficiency, it becomes more difficult for developers to isolate errors if they arethrown by the underlying Server Environment. Even sophisticated Javadebugging tools may give you information on where the problem occurs but nothelp you to understand why it occurs. To simplify this entire process, OC4Joutputs error and event information into log files where events can be stored forfuture reference and analysis. It uses 5 different log files:− Web Access Log: The Web Access Log is primarily used to determine what

user/visitor activity took place on the web site or Internet Application.− Application Log: This is the most important log file for error diagnosis - there

is one application log file per application and it contains all events related toa specific application. A typical application log can look like:

2001-03-11 17:01 Started 2001-03-11 17:01 Auto-deploying shop-ejb… done. 2001-03-11 17:01 shop-web: 1.3.3 Started 2001-03-11 17:01 shop-web: Servlet error java.lang.SecurityException: JSPFactory already set atjavax.servlet.jsp.JSPFactory.setDefaultFactory(JSPFactory.java) at /shop/listProducts.jsp._jspService (/shop/listProducts.jsp.java:47) 2001-03-11 17:03 Stopped

The log file contains information to help the developer identify the specificpoint in the application’s execution that an error was thrown.

Page 21: Oracle9i Application Server Java2 Enterprise Edition ... · PDF fileOracle9i Application Server Java2 Enterprise Edition Facilities and Design Considerations May, ... and JavaMail

page 21 of 31

− Server Log: The Server Log contains all events that are not associated with aspecific application or subsystem and contains logs of server startup, servershutdown and internal Application Server errors.

− RMI and JMS Logs: The RMI and JMS Logs capture and log RMI and JMSevents and errors respectively. The most common kinds of errors for theselogs are related to the failed marshaling of an object.

All of the Log Files have a common file format allowing application developersto build automated scripts and tools against them to identify and analyze errors.Finally, since OC4J is itself implemented in Java, it can be set into severaldifferent kinds of debugging modes by simply setting a property into theproperties file - standard Java profiling and debugging tools can then be used todebug the server itself.

B. OC4J Performance

OC4J is the fastest Java Application Server in the industry. Oracle is providing inseparate whitepapers:• Comparable Servlet Engine Benchmarks: Benchmark numbers that compare

OC4J’sServlet Engine with Servlet Engines from competitor ApplicationServers.

• Comparable J2EE Container Benchmarks: Benchmark numbers that compareOC4J, including both Servlets and EJBs, with J2EE containers from competitorApplication Servers. Oracle is also active on the ecPerf Specification StandardsProcess - ecPerf is being discussed as a standard mechanism and benchmark tocompare the performance of J2EE Containers.

C. OC4J Scalability

A key issue related to the performance of a web site or Internet Application builtusing J2EE is how well the J2EE Container performs as concurrent user loads onthe system increases - this is typically referred to as the scalability of the J2EEcontainer. The scalability issues related to OC4J fall into four areas:• Hardware Scalability: How OC4Jleverages various hardware platforms to

improve scalability• Resource Pooling and Management: How Oracle9iAS optimizes the use of scarce

resources such as threads, memory, and database connections to improvescalability

• Cluster Support: How Oracle9iAS configures a set of servers to share state sothat they can service requests from clients as a single “virtual server” or“cluster”

• Load Balancing: How Oracle9iAS can distribute requests from clients to variousJ2EE Containers that are operating as a single virtual server efficiently

Hardware Scalability The scalability of a system is typically limited either by any bottleneck that impedesthe ability of the system to service multiple concurrent client requests as loads on

Page 22: Oracle9i Application Server Java2 Enterprise Edition ... · PDF fileOracle9i Application Server Java2 Enterprise Edition Facilities and Design Considerations May, ... and JavaMail

page 22 of 31

the system increase. From a hardware point of view, the two typical scalabilitybottlenecks are CPU-constraint (where a hardware system becomes constrainedbecause its processor becomes completely consumed) and memory-constraint (wherethe hardware system becomes constrained because it is memory bound). To addressthese issues, administrators typically migrate the application server to a higher endhardware configuration (if a system is CPU-bound) or add more memory (if asystem is memory-bound). Oracle9iAS allows developers to write J2EE Applicationswhich can be transparently scaled as the underlying hardware configuration isupgraded with no change to the application. Specifically:• Availability on Broad Range of OS/Hardware Platforms: OC4J is available on a

broad range of hardware platforms scaling from low end uniprocessor machinesto high-end SMP clusters and on all major Operating Systems including Solaris,HP-UX, AIX, Tru64, Windows NT, and LinUX.

• Single Node or Multi-Node Clusters: OC4J also provides “cluster” supportindependently of the hardware platform or OS being used (i.e. its clustercapability does not require a specific SMP hardware configuration). This allowsJ2EE Developers and Administrators to be able to leverage these featureswithout being tied to any OS/hardware platform.

Resource Pooling and Management Oracle9iAS optimizes the use of scarce resources such as threads, memory, EJBinstances, and database connections in order to improve how many concurrent J2EEusers it can support on a single box. From a scalability perspective, scarce resourcesare categorised by examining the difficulties in aquiring the resources, as opposed tothe the general lack of numbers of the resource. Applications require access toresources to execute, and this is determined byt the logic of the application. WithOC4J, resources that are in constant demand are managed so that they can becontinuously and optimally re-used amongst all concurrently executing applications.Oracle9iAS v1.0.2.2 transparently and efficiently manages this resource allocationprocess through a number of key capabilities:

• Provides a pool of resources• Employs advanced scheduling/allocation algorithms for queuing and waiting• • Delivers and denies resources as appropriate• The figure below highlights conceptually how Oracle9iAS addresses the use ofscarce resources for improved scalability.

Page 23: Oracle9i Application Server Java2 Enterprise Edition ... · PDF fileOracle9i Application Server Java2 Enterprise Edition Facilities and Design Considerations May, ... and JavaMail

page 23 of 31

J2EE App(Thread 3)

J2EE App(Thread 1)

J2EE App(Thread 2)

J2EE App(Thread 4)

JDK VM1

JDK VM2

J2EE Container

Oracle9iAS - Instance 1

Hardware Instance 1

Hardware Instance 2

Oracle9iAS - Instance 2Load

BalancingLoad

BalancingState

ReplicationState

Replication

ConnPool

ConnPool

Figure: Oracle9iAS v 1.0.2.2 Scalability Architecture • Threading Model: OC4J’s threading model has been designed to effectively

share resources amongst competing applications. Specifically OC4J creates andmanages a hierarchy of J2EE Containers as follows:

A single hardware instance (box) can run multiple Oracle9iAS instances− A single Oracle9iAS instance can run multiple Java Virtual Machines

(JDKs)− A single Java Virtual Machine or JDK can start and maintain multiple

threads− Each thread can run a single J2EE Application module (JSP, servlet or EJB).

Additionally, OC4J pre-starts and maintains a pool of threads to processrequests. When a specific request is received from a J2EE client, an idle threadis selected and the specific J2EE module is loaded and executed on that thread.When the J2EE module has completed servicing that request, the thread is freedup and placed back in the pool.

• Inbound Request Pooling (Connection Pooling): Oracle9iAS also maintains a poolof socket connections to handle requests coming from a J2EE client, a WebServer, a Load Balancer, or another J2EE Application module. When a specificconnection request is received, OC4J selects an idle socket to handle the request.If the request can be serviced in a request-response fashion (as in a stateless,HTTP 1.0 fashion), the socket is reused when the response is written back outon the socket. If the socket needs to be “kept-alive” (as in HTTP 1.1 or forclustering purposes), the J2EE container maintains the socket across multiplerequests until it can be freed up or a timeout occurs.

Outbound Request Pooling (Database Connection Pooling): It is most common tosee resource pooling exhibited for managing database connections. During thedatabase connection establishment phase, several context parameters need to beestablished - security, globalization, protocol version - which makes this process a

Page 24: Oracle9i Application Server Java2 Enterprise Edition ... · PDF fileOracle9i Application Server Java2 Enterprise Edition Facilities and Design Considerations May, ... and JavaMail

page 24 of 31

fairly costly exercise. To address this, OC4J pre-starts and maintains a pool ofJDBC connections to a database. On specific requests, it selects/reuses an idleJDBC connection from the pool - when it is complete, it places the connection backinto the pool to be reused by other clients. Performance is often drastically improvedvia connection pooling because the connection has already been established and isimmediately available when the client requests it. Further, connection pooling alsoimproves mid-tier and database scalability since it allows multiple clients to bemultiplexed onto fewer database connections. (The server is used much moreefficiently as each active client does not maintain a dedicated database connection -instead resources are utilized as and when required which reduces resourceconsumption as database usage is in fact often infrequent and intermittent.) Load Balancing Load distribution or load balancing essentially means how requests from clients canbe distributed across multiple instances of OC4J so that: (i) Client request areserviced efficiently; (ii) Multiple Oracle9iAS servers appear to the client asoperating as a single virtual server. Efficient load balancing helps to maximizescalability between a system and optimize the use of its processing resources. OC4Jsupports very sophisticated load balancing across threads and processes on a singlenode and between nodes on a multi-node deployment.• Load Balancing at HTTP Server: The web server uses a simple but efficient

mechanism to load balance between HTTP server processes within a singleinstance of the service. The master HTTP server process does not service clientrequests itself but spawns and monitors a group of child processes which taketurns accepting HTTP requests from a shared socket by using a mutex. Once achild receives a request but before it begins servicing it, it releases the mutexwhich can be acquired by another child - as a result, access to the socket isserialized but children may service requests in parallel. Additionally, OracleHTTP servers can be run on multiple nodes where client requests can be loadbalanced over the separate host instances using a variety of techniquesincluding DNS round-robin or a dedicated hardware load balancer (see below).

• Load Balancing at OC4J: Servlet and EJB container instances load balancerequests either across instances on a single node or across multiple nodes. Theyuse a variety of load balancing algorithms including: round-robin, random, first,and weighted round robin where requests get distributed to different containersbased on a weighted algorithm where the system administrator provides weightsfor the various container instances. In this way, containers running on morepowerful hardware can support more requests than instances on less powerfulhardware.

• Integration with Third Party Load Balancing Products: Finally, OC4J (andOracle9iAS as a whole) can be combined with load balancing Appliances such asCisco Local Director, BigIP, and Alteon for even more sophisticated loadbalancing.

• Connection Re-direction: While Oracle9iAS’ load balancing algorithms can beused to determine which instance to direct either a request from a new client ora stateless request from an existing client, Oracle9iAS also supports standardfacilities such as cookies and dynamic URL-rewriting to bind and redirect clientsto an existing session on a specific instance. Session IDs are packaged into

Page 25: Oracle9i Application Server Java2 Enterprise Edition ... · PDF fileOracle9i Application Server Java2 Enterprise Edition Facilities and Design Considerations May, ... and JavaMail

page 25 of 31

either a cookie or a dynamic URL - when the client sends back a subsequentrequest, the load balancers and the HTTP server can redirect the request acrosstiers to the specific instance.

Cluster Support Clustering with Oracle9iAS essentially means the use of a group of Oracle9iASservers that coordinate their actions in order to provide scalable, highly-availableservices in a transparent manner.• Stateless Clustering: Clustering different application server instances together

to service stateless requests is trivial. Since the requests are stateless Oracle’sHTTP server or an external load balancer can simply direct the request to a newOracle9iAS instance either on the same node or on a different node.

• Stateful Clustering: The far more difficult problem is to address how you clustersystems together when the requests are stateful. For instance, an e-commerceservlet is making use of the HTTPSession Object to save the state of a shoppingcart between method requests. When the client adds another item to theshopping start the servlet servicing the original request may not be accessibleeither because the load on that instance is too high or because the instance isnot available (i.e. has failed). In this case, the request needs to be redirected to adifferent J2EE container to which the HTTPSession Object’s state has beenreplicated from the first container. Oracle9iAS’ clustering capability supportsthis requirement without requiring any change to the application program code.Since the solution addresses both scalability and availability requirements, wediscuss more details of the clustering facilities in the availability section below.

Note that the use of the term “clustering” with OC4J should not be confused withOracle9i Database Clustering (Real Application Clusters). We use the term in thispaper in the context of Oracle9iAS only because it is used by other ApplicationServer vendors to define the same capability as provided by Oracle9iAS.

D. High Availability Support in OC4J

The High Availability issues related to OC4J fall into four areas:• No Single Point of Failure: How Oracle9iAS instances can be deployed in an

architecture where even if one or more nodes in the system fail, Oracle9iAS willcontinue to function and service J2EE client requests

• Automatic Connection Rerouting: How Oracle9iAS can transparently re-routeclient requests to an alternate server when a specific instance fails

• Automatic Death Detection and Restart: How Oracle9iAS can detect thedeath/failure of a specific instance and restart it in order to minimize Mean-Time-to-Recovery for that instance

• Transparent Application Failover and Cluster Support: How Oracle9iAS cantransparently replicate session state between instances of the J2EE Containerand how it addresses Application Failover for state managed in the OracleDatabase

Page 26: Oracle9i Application Server Java2 Enterprise Edition ... · PDF fileOracle9i Application Server Java2 Enterprise Edition Facilities and Design Considerations May, ... and JavaMail

page 26 of 31

No Single Point of Failure OC4J has a flexible deployment model which allows it to be deployed in anarchitecture that exposes no single point of failure. This means that despite thefailure of any node in the system, Oracle9iAS will continue to function and serviceclient requests. The figure below illustrates an example deployment of Oracle9iASand the Database with no single point of failure across the entire system includingapplication server and database. The load balancer can send requests to any ofmultiple Oracle HTTP servers. The Oracle HTTP servers, in turn, can dispatchrequests to any servlet engine instance. The Servlet Engines can in turn dispatchrequests to any EJB instance. The EJB instances can in turn access the databaseacross any database connection. Note that the network Load Balancer is a hardwareappliance such as Cisco Local Director which is itself deployed in a redundant(mirrored) configuration for high availability.

Figure: Oracle9iAS - No Single Point of Failure

Automatic Connection Rerouting In the section on load balancing above, it was clear that every tier in an Oracle9iASJ2EE deployment can route requests to other tiers using an appropriate loadbalancing scheme and also re-route connections from a “stateful” client to anexisting session on a specific Oracle9iAS instance. What happens when a clientattempts to access an executing session in OC4J when the process or node servicingthe request suddenly fails? Oracle9iAS can automatically transparently re-route therequest to alternate servers.

Page 27: Oracle9i Application Server Java2 Enterprise Edition ... · PDF fileOracle9i Application Server Java2 Enterprise Edition Facilities and Design Considerations May, ... and JavaMail

page 27 of 31

• Stateless Connection Rerouting: In a completely stateless environment, theclient essentially looks like a “new client”. Every tier in Oracle9iAS knows whenan instance on the next tier has failed and, using a load balancing algorithm,selects another instance on the next tier and routes the connection to it. Thefigure below illustrates an example of how this is done.

HTTP Server

on Node A Client Network

Load - Balancer

HTTP Server on Node B

Oracle J2EE

Oracle J2EE

Oracle J2EE

A. A client request comes in and is routedto an HTTP Server instance and an OracleJ2EE container.

HTTP Server

on Node A Client Network

Load - Balancer

HTTP Server on Node B

Oracle J2EE

Oracle J2EE

Oracle J2EE

B. The application in the Oracle J2EEcontainer is stateful, and session state isretained in the instance. Also, a cookiemay be returned to the client’s browser.

HTTP Server

on Node A Client Network

Load - Balancer

HTTP Server on Node B

Oracle J2EE

Oracle J2EE

Oracle J2EE

C. In between requests, the HTTP Serveron Node A goes down.

HTTP Server

on Node A Client Network

Load - Balancer

HTTP Server on Node B

Oracle J2EE

Oracle J2EE

Oracle J2EE

D. The next request can be routed to thedestination Oracle J2EE containerthrough an alternate HTTP Server.

Figure: Oracle9iAS - Connection Rerouting

• Stateful Connection Rerouting: When a client attempts to re-connect to anexisting session in an Oracle9iAS instance which has failed, there are threedifferent scenarios that are supported:− Session State maintained in the Database: The majority of J2EE Application

Developers maintain all session state in a recoverable, persistent store - anOracle database. Oracle recommends storing all session state in databases inwhich case the middle-tier Oracle9iAS instances are completely stateless andconnection re-routing happens in the same manner as described above. Theapplication essentially uses a specific cursor on a new JDBC connection torecover the session state from the database. (For more information read thesection on clustering below).

− Session State maintained in the Mid-Tier: Several application developers alsomaintain session state in the middle-tier but are comfortable with havingusers lose their session state in the case of an instance failure. In this case,

Page 28: Oracle9i Application Server Java2 Enterprise Edition ... · PDF fileOracle9i Application Server Java2 Enterprise Edition Facilities and Design Considerations May, ... and JavaMail

page 28 of 31

Oracle9iAS attempts to route the connection to the specific J2EE containerinstance but when it detects a failure, it simply uses its load balancingalgorithm to route the connection to another instance (which does not haveaccess to the session state).

− Session State Replicated in a Cluster Setting: Finally, if OC4J has beenconfigured to support clustering, it is registered along with a group of otherinstances as a cluster with a common cluster ID. In the case of an instancefailure, the load balancer recognizes the instance failure, identifies otherservers with the same cluster ID, and routes the connection to one of thoseservers using the load balancing algorithm. The session state from the failedJ2EE container has already been replicated across all instances in thecluster, and, as a result, the client is able to access the session again.

Automatic Death Detection and Restart If a server process fails, Oracle9iAS takes appropriate action - cleaning up memoryand restarting the failed processes. As a result, Oracle9iAS sharply reducesunplanned downtime in the event of an Oracle9iAS instance failure. Specifically:• HTTP Server: The watchdog process in the Oracle HTTP Server monitors the

HTTP child processes and restarts a failed process.• J2EE Container: OC4J can detect the failure of a J2EE Container and ceases to

route requests to the instance. If the container has been deployed in a clusterconfiguration, Oracle9iAS can automatically re-route connections to anotherinstance within the cluster based on the load balancing algorithm chosen. In afuture release, Oracle9iAS will provide a general fault monitoring service thatdetects any failed Oracle9iAS instance and automatically restarts the instance.

Stateful and Stateless Application Failover and Cluster Support While HTTP is a stateless protocol, as complex applications have been deployed onthe Internet, developers have typically added session semantics to the way theybuild and deploy these applications. In general with any Internet Application, thereare three kinds of state which are differentiated by their duration i.e. how long thestate needs to be maintained. They are:• Page Duration State: Page duration state essentially refers to short lived objects

that exist for the duration of a single request - they are typically passed back tothe client either as cookies or dynamic URLs in the page itself.

• Session Duration State: Session duration state refers to session state that islonger lived than a single page but exists only for the duration of a session i.e. itdoes not cross session boundaries. In an e-commerce example, as a customerplaces items into a shopping cart, session duration state tracks the user’ssession and specifically captures all the items that have been placed in theshopping cart.

• Long-lived, Inter-Session State - Persistent State: State that persists acrosssession boundaries is persistent state. In the e-commerce example, once thecustomer has proceeded to checkout and submitted the order, the customer hasfinished completed the session and the shopping cart’s state must now be

Page 29: Oracle9i Application Server Java2 Enterprise Edition ... · PDF fileOracle9i Application Server Java2 Enterprise Edition Facilities and Design Considerations May, ... and JavaMail

page 29 of 31

retained persistently for future sessions. For instance, if the customer comesback to check on the order’s status, he or she must have access to the specificorder that was submitted and, as a result, the

When considering the Availability of a Web Site or Internet Application, anApplication Server is only one part of an Internet Infrastructure that consists ofclients (typically browsers), Application Servers, and Database Servers all of whichneed to work in concert to maintain state and recover efficiently from failure. Anapplication designer should not consider an Application Server in isolation whenaddressing high availability issues. From a high availability point of view, there arethree broad requirements for the Internet Infrastructure:• Maintain Application/User State: First, the Internet Infrastructure consisting of

the client, the Application Servers, and Database Servers must together retain100% of the user’s state whether it is page duration state, session duration state,or persistent state. Different kinds of state are more optimally maintained indifferent parts of the Internet infrastructure but the complete infrastructuremust maintain all of the user’s state (i.e. all Application State).

• Reduce Application Recovery Time: Additionally, the most important factor thatcontributes to the availability of an application is the total recovery time for theapplication after a failure. Therefore, the infrastructure should provide threefacilities: (I) Detect all system failures quickly; (ii) Re-route or failover users to anew system efficiently; and (ii) Recover all the necessary Application State fromdifferent parts of the infrastructure to allow the Application to continueexecution and to allow users to resume their sessions. We use the termApplication Recovery Time to capture the total time it takes to detect a failure,recover any state, retry the operation, and bring the system back to the samespeed that it was running at the point of failure.

• Avoid Degradation of Application Performance and Scalability: Finally, inattempting to address high availability considerations the InternetInfrastructure should not degrade the Application’s overall performance orscalability. Several leading Application Servers use “clustering” techniques thathave been poorly designed introducing instability in the system, loweringapplication performance, and impeding efficient load balancing. We will contrastOracle’s approach with these approaches later in this section.

State Management Recommendations Recognizing these goals, Oracle strongly recommends the following designguidelines for managing state and high availability with Oracle9iAS.• Page Duration State belongs on the client: Very short lived state that exists only

for the duration of a single browser to Application Server interaction (i.e. for theduration of a page) should only be maintained on the client.

• Persistent State belongs in the Database: State that persists across sessionboundaries should be written to a highly available, recoverable persistent store -a Database. Databases are very good at caching objects in memory and doingefficient disk I/O necessary to provide transactional protection which guaranteesno loss of data in the face of hardware outages and even non-redundant disk

Page 30: Oracle9i Application Server Java2 Enterprise Edition ... · PDF fileOracle9i Application Server Java2 Enterprise Edition Facilities and Design Considerations May, ... and JavaMail

page 30 of 31

failures. For instance in J2EE Applications, the transactional Enterprise Beanof record should always have its state maintained in database. This means thatif ever an Oracle9iAS Server or Application were to fail, the transactional stateof your application is fully recoverable out of your existing database(s). OC4Jalso permits the capture of more important state data (such as the contents of acomplex Web order constructed over a 30 minute session) to be captured in atransactional manner so that even multiple server failures do not result in auser losing any significant work..

• Session Duration State can be either stored in the Database or Replicated inMemory: State that exists only for the duration of a single session can be storedeither in a database or replicate din memory. There are tradeoffs in performanceand scalability to using either approach.− Storing Session Duration State in the Database: Most large e-commerce sites

store session duration state in the database. For instance, each time acustomer adds or takes out an item from his shopping cart, the Applicationwrites the state to the database. There are two important benefits ofmaintaining this state in the database: (i) First, even session state can berecovered from a durable store in the event of a failure of one or moreApplication Servers providing the best quality of service to the user. (ii)Second, the middle-tier Application Servers are maintained completelystateless making it easy to scale the middle-tier by adding more ApplicationServers - “horizontal scalability”. The biggest concerns that are typicallyraised about storing session duration state in the database are the following:(I) First, writing session state to a database unnecessarily increasesdatabase overhead and specifically database/disk I/O. Users must recognizethat if they want to back up their session state in a recoverable persistentstore, they will need to perform disk I/O and they are trading off databasescalability with quality of service. (ii) Second, writing session state to adatabase introduces performance overhead specifically network latencybetween the mid-tier and database (typically small when most mid-tier todatabase connectivity is over 100-Base T networks); connectionestablishment overhead (typically eliminated through the use of connectionpools); and type conversions (going from Java shaped objects in the mid-tierto SQL shapes in a database).

− Redundant memory storage: Oracle recognizes the need to address the twoconcerns above and, as a result, Oracle9iAS provides a competitive mid-tier“clustering solution”. The specifics of how this is architected is discussed indetail below but it essentially allows a group of Oracle9iAS instances to beconfigured to share session state captured as Java objects through a highspeed IP-multicast facility. It addresses the concerns of database I/O andoverhead, shares state as Java objects (eliminating type conversionoverhead) and uses redundant memory rather than a shared disk subsystemto share state. It should not be used to share persistent state but can beused efficiently for more transient session state (e.g., security context, Webshopping cart contents) that does not need to be protected from multiple,simultaneous server failures.

Oracle9iAS Clustering Goals

Page 31: Oracle9i Application Server Java2 Enterprise Edition ... · PDF fileOracle9i Application Server Java2 Enterprise Edition Facilities and Design Considerations May, ... and JavaMail

page 31 of 31

From a design point of view, Oracle9iAS v1.0.2.2 clustering was guided by severalprincipals to address specific customer requirements which are discussed below:• Make High Availability Transparent to J2EE Application Programmer: Several

Application Servers attempt to provide high availability by having users writetheir state to a shared memory infrastructure using proprietary programmingAPIs. Oracle recognizes that users do not want their J2EE Application to betied to a specific Application Server vendor’s infrastructure and, as a result,designed our clustering facilities to be completely transparent to the application.The only changes that need to be made in order to use clustering are to configurethe Application Servers in a “cluster” configuration which is completelyindependent of the Applications deployed on the Application Server itself.

• Make High Availability independent of OS/Hardware Platform: Since theOracle9iAS v1.0.2.2 Server is written entirely in Java, Oracle9iAS clusters areindependent from the underlying hardware and operating system (OS). Thus anOracle9iAS cluster can be composed of Intel machines running Microsoft NT orLinux or large-scale, more complex Unix multiprocessors. In contrast, otherApplication Servers use platform-specific clustering solutions which typicallyrequire that every node run the same operating system and are limited tocertain hardware and OS platforms. To provide platform independent clusteringfacilities, Oracle9iAS uses highly-optimized protocols based on new commoditytechnologies such as IP multicast.

• Make High Availability independent of Deployment Architecture: OtherApplication Servers require the use of a specific web server or network loadbalancer to support clustering. The clustering solution should not mandate aWeb server. Although we provide Apache as the default HTTP server,Oracle9iAS clustering facilities can also work well with Microsoft IIS andNetscape web servers.

• Make Cluster Definition Configurable and Scalable: Further, ApplicationServers from competitors claim to provide clustering for session failover buthave two significant limitations in their design:− Identically Configured Application Servers: Some Application Servers from

competitors support clustering but it is not configurable. As a result, in orderfor their cluster solutions to be used to provide session failover, all theApplication Servers need to be configured identically and the entire middle-tier represents a single cluster. While this provide the highest degree ofavailability, every single Application Server will attempt to replicate itssession state to all the machines in the cluster. This leads to tremendouschattiness between the different machines as every machine attempts tomaintain consistency with all the other Application Servers impedingperformance, scalability, and availability as the number of concurrentsessions on the system grow.

− Back-up System limits Scalability: In an attempt to resolve this limitation,other Application Servers that support clustering have moved to a “buddy”system where every machine uses only one other machine (i.e. a “buddy”) towhich to replicate its state. Using a buddy system reduces the chattinessbetween machines but has two significant limitations: (I) First, it impedes

Page 32: Oracle9i Application Server Java2 Enterprise Edition ... · PDF fileOracle9i Application Server Java2 Enterprise Edition Facilities and Design Considerations May, ... and JavaMail

page 32 of 31

availability - if both machines fail concurrently all session state on bothmachines are lost. (ii) Second, even if the two machines are configured asbuddies, one of the machines is always configured as the primary stateserver. All of the servers in the cluster “bottleneck” on their access to theprimary state server which they each hit on every user request. Thisarchitecture eliminates the use of load balancing techniques and, as a result,hurts scalability.

− Static IP-based Multicast Facilities: Finally, Application Servers fromcompetitors that use clustering use IP-multicast for state replication usestatic IP addresses to publish and receive state. Binding failover to static IPaddresses also eliminates the use of any form of load balancing techniquesand hurts scalability.

Oracle9iAS clustering facilities addresses all these design limitationssimultaneously - for clustering purposes it allows middle-tier ApplicationServers to be configured into different clusters. While every server in the servercluster is homogeneous, all the middle-tier machines do not necessarily belongto the same cluster. By making clustering configurable, Oracle9iAS addressesthe chattiness concerns of having all the machines configured identically whileallowing load balancing to continue to operate across all the machines in thecluster. Further, Oracle9iAS also uses dynamic IP and not static IP addressesallowing the use of load balancing and scalability techniques while providinghigh availabilty. Finally, Oracle9iAS’ automatic routing facilities frees systemadministrators to dynamically re-partition the business processing within thecluster as desired.

• Combine Clustering and Transparent Application Failover: Finally, while allother Application Servers only address stateful failover for state maintained onthe mid-tier, Oracle9iAS is the only Application Server that providesTransparent Application Failover for session state managed in the mid-tier withfailover for persistent state managed in the Oracle Database, thereby, providingtrue 100% end-to-end high availability.

• Make Clustering and High Availability Cheap and Easy-to-Use: All otherApplication Server vendors require users to either: (I) Purchase specialized andmore expensive hardware for clustering purposes; (ii) Purchase a specific, moreexpensive version of their product for clustering purposes; (iii) Use very complexconfiguration set-up and architecture to configure clustering. In contrast, theclustering facilities in Oracle9iAS are provided out-of-the-box as part ofOracle9iAS Standard Edition. It does not require the use of any specializedhardware, and can be configured by setting up three parameters in aconfiguration file and using five easy steps.

Oracle9iAS Clustering Facilities Now that we have explained the design points used to structure Oracle9iAS sessionfailover facilities, let us briefly examine its architecture in more detail.• Web-Presentation and Web Server Failover: An Oracle9iAS cluster may be

located behind standard Web Servers such as Apache, Netscape, or Microsoft IISWeb Servers. HTTP requests from Web Browsers may be handed by the Web

Page 33: Oracle9i Application Server Java2 Enterprise Edition ... · PDF fileOracle9i Application Server Java2 Enterprise Edition Facilities and Design Considerations May, ... and JavaMail

page 33 of 31

servers to Oracle9iAS Servlet/JSP engines. The first line of clustering uses “DNSRound Robin” between the Web clients and the Web Servers. DNS, theInternet’s Domain Name Service, resolves a Web site’s name to a list of IPaddresses for the site’s Web servers. Each time it gets a lookup request, DNSshuffles the list of addresses it returns. A Web client generally contacts the firstweb server on the list provided by DNS. After some timeout period, or if thisserver fails, the client makes another DNS request and continues with a newserver. This provides a simple form of load balancing and failover. It is possibleto install more sophisticated IP-level load balancing and failover schemes that,for example, take into account Web server load, remove failed servers from thelist returned by DNS, and to ensure that a specific client’s requests are alwaysredirected to the same Web/Application Server (modulo failures). Oracle9iAS iscertified to work with standard load balancing appliances such as Cisco LocalDirector and BigIP which provide such capabilities.

• Session State Replication and Cluster Failover: The second line of clustering isfor dynamically generated pages from the Application Servers (for example theservlet engines). The following steps occur:− Configure a Cluster of Oracle9iAS Servers: A set of Oracle9iAS Application

Servers are registered as a “cluster island” i.e. all the Application Serversneed not be configured identically but a set of 3-4 Application Servers can beconfigured to be homogeneous and provide failover facilities for each other.The entire middle-tier can be configured into a set of different cluster islandsas appropriate. Configuring an Application Server to belong to a cluster isvery simple with Oracle9iAS v1.0.2.2 requiring editing an XML configurationfile with three cluster parameters.

− Load Balancing and Routing: When a client first contacts the load balancer,the request is directed to one of the Application Servers in the cluster. Asession is created on that Application Server - the session lasts until aconfigurable timeout setting expires and the load balancer knows to redirectsubsequent requests from the client to the same Application Server instancefor the duration of the session. Should the first/primary Application Serverfail, the load balancer recognizes that the instance has failed, andtransparently redirects the client to another Application Server in thecluster. It can continue to use standard load balancing algorithms todistribute requests across different nodes in the cluster.

− Replicated Session State: Two kinds of session state are replicated over IP-Multicast from the first Application Server to the other servers in the cluster- the HTTPSession Data and the ServletContext Data. As an example,consider an e-commerce scenario where the state of a customer’s shoppingcart is maintained as a HTTPSession object in a Servlet on the firstApplication Server. Should the first Application Server fail, the client’srequest is transparently rerouted to another Application Server in thecluster and the shopping cart state is failed-over from one Application Serverto another using in-memory replication. The replication system is efficientand only transports an update delta from the primary server to other serversin the cluster.

Page 34: Oracle9i Application Server Java2 Enterprise Edition ... · PDF fileOracle9i Application Server Java2 Enterprise Edition Facilities and Design Considerations May, ... and JavaMail

page 34 of 31

• Transparent Application Failover (TAF) and Database State Management:Finally, every Oracle9iAS middle-tier communicates with Oracle DatabaseServer using a connection pool which multiplexes multiple clients on a smallernumber of connections to the database improving performance and scalability.Every Application writes its long-lived state persistently to the Oracle Database.When the Oracle Database is deployed in a cluster configuration and a specificnode in the Database fails, all state maintained in the Database is transparently“failed-over” to another node in the cluster. When Oracle9iAS is used incombination with the Oracle Database, the middle-tier servers have the abilityto transparently re-route JDBC connections and database requests to the failed-over node. Depending on the way in which the connections are set-up,Oracle9iAS can provide various degrees of TAF with the database - cold, warm,and hot failover of persistent state.

5. CONCLUSIONS

To summarize, Oracle9iAS v1.0.2.2 represents a significant step forward in Oracle’sJava Strategy. This release delivers OC4J, a complete Java2 Enterprise Edition(J2EE) container written entirely in Java and executing on the standard JavaDevelopment Kit (JDK) Virtual Machine (Java VM). The primary features of OC4Jinclude:• Pure Java Container/Runtime executing on JDK: First, OC4J is implemented

completely in Java making it: (i) Lightweight - 15 MB disk, 13 MB of Memory;(ii) Fast to install - less than 1 Minute; (iii) Easy to use - supporting standardJava Development and Profiling Tools; and (iv) Available on all standardOperating System and Hardware Platforms including Solaris, HP-UX, AIX,Tru64, Windows NT and Linux. With the v 1.0.2.2 Release, it will be certified torun on the JDK 1.2.2 Java VM and will be certified on the JDK 1.3 Java VMwith the upcoming Oracle9iAS v 2.0 Release.

• Complete J2EE 1.2 Container: Second, it provides a complete J2EE containerthat includes a JSP Translator, a Java servlet engine, and an EnterpriseJavaBeans (EJB) container. It also supports the Java Messaging Service, JMS,and several other Java specifications. OC4J provides full support for all of theJ2EE APIs including: Enterprise Java Beans (EJB) 1.1, Servlet 2.2, Java ServerPages (JSP) 1.1, JTA 1.0.1, JNDI 1.2, JMS 1.0, JDBC 2.0, and JavaMail 1.1.2.OC4J also provides implementations of the following specifications that are partof the J2EE 1.3 Specification: EJB 2.0 and Servlets 2.3. It also supportsstandard services such as JSP Tag libraries, WAR and EAR file-baseddeployment, and auto deployment and “hot” deployment of J2EE Applications.

• Competitive Footprint, Performance/Scalability/and Availability: Finally, OC4Jprovides developers a number of benefits including: (i) Footprint: OC4Jhas asmall disk and memory footprint making it very easy to install, configure, anduse. (ii) Fast Performance: OC4J is the fastest Java Application Server in themarket - a separate document will provide benchmark results against the majorcompetitors in the market; (iii) Scalability and High Availability: It alsorequires a significantly smaller memory footprint; has no single point of failure,

Page 35: Oracle9i Application Server Java2 Enterprise Edition ... · PDF fileOracle9i Application Server Java2 Enterprise Edition Facilities and Design Considerations May, ... and JavaMail

page 35 of 31

and provides sophisticated IP-Multicast based clustering facilities to addressboth stateless and stateful Application Failover and combined with TransparentApplication Failover provides unmatched High Availability.

Page 36: Oracle9i Application Server Java2 Enterprise Edition ... · PDF fileOracle9i Application Server Java2 Enterprise Edition Facilities and Design Considerations May, ... and JavaMail

page 36 of 31

Oracle9i Application ServerJava2 Enterprise Edition Facilities and Design Considerations

May 2001

Copyright © Oracle Corporation 1997All Rights Reserved Printed in the U.S.A.

This document is provided for informational purposesonly and the information herein is subject to changewithout notice. Please report any errors herein toOracle Corporation. Oracle Corporation does notprovide any warranties covering and specificallydisclaims any liability in connection with this document.

Oracle and SQL*Net are registered trademarks of Oracle CorporationJDBC and Java are registered Trademarks of JavaSoft CorporationCORBA, IIOP are registered Trademarks of the Object Management Group

Oracle CorporationWorld Headquarters500 Oracle ParkwayRedwood Shores, CA 94065U.S.A.

Worldwide Inquiries:650.506.7000Fax 650.506.7200

Copyright © Oracle Corporation 1997All Rights Reserved


Recommended