HomeDigital EditionSys-Con RadioSearch Java Cd
Advanced Java AWT Book Reviews/Excerpts Client Server Corba Editorials Embedded Java Enterprise Java IDE's Industry Watch Integration Interviews Java Applet Java & Databases Java & Web Services Java Fundamentals Java Native Interface Java Servlets Java Beans J2ME Libraries .NET Object Orientation Observations/IMHO Product Reviews Scalability & Performance Security Server Side Source Code Straight Talking Swing Threads Using Java with others Wireless XML

Over the past few years, maturity of the Internet, as well as the introduction of a host of other technologies, has led to the development of highly complex Web solutions that test the functionality and scalability of even the most versatile application servers.

Oracle Corporation was among the first enterprise software vendors to offer an application server for developing Web-based solutions. The servers of today, however, must support the caching of data for better availability and scalability. They also have to support integration with disparate applications at both the logic and the data layers, and support mobile and intermittently connected devices. And they must have up-to-date support for the Java development model.

With its new Internet application server (see Figure 1) Oracle responds to the increasingly complex nature of the new breed of solutions by delivering everything the original Oracle application server (OAS) product offered, plus. The pluses include essential features from Java 2 APIs, a wide range of integration technologies such as JMS and XML, and efficient database caching for improved scalability. This article describes the benefits of the new server for Java programmers and how they can fully use the Oracle Internet Platform for e-business solutions.

Figure 1
Figure 1:

Oracle Internet Platform
This platform is based on two server products with a common Java runtime environment: the Oracle Internet Application Server for middle-tier solutions and the Oracle8i database for data-tier requirements.

When developing Web applications backed by an Oracle8i database, you can use a variety of languages, application frameworks and tools. These range from 3GL offerings such as Java, C and PL/SQL to highly declarative frameworks such as Oracle Business Components for Java, Oracle Forms and Oracle Portal-to-Go. You'll typically use these languages and frameworks with the Oracle Internet Application Server to deploy multitier Web applications served by one or several Oracle8i instances holding your data. For applications with well-defined scalability requirements, such as a predictable user base or a development environment, or simply when a two-tier solution fits your application architecture, you can deploy the same components, without the new server, on a single system running only the Apache Web server and Oracle8i. Many developers find these configurations adequate for deployment of intranet Web applications. Because both the Internet Application Server and Oracle8i use a common infrastructure, application components can be moved seamlessly between the tiers without any changes to your code. This flexibility allows you to test various configurations for optimum performance. It also gives you the scalability needed to accommodate rapid growth as user demand escalates.

Web Applications
The Oracle Internet Platform focuses on the development of Web applications - applications that are accessed primarily through HTTP - including applications for live Web users accessed from Web browsers or mobile devices, as well as applications accessed by other applications across the Internet, as is the case for many business-to-business applications. The packaging of an XML development kit with the Oracle Internet Application Server and the advanced capabilities of the Oracle AQ asynchronous communication mechanisms using JMS APIs are necessary building blocks for such applications.

Oracle HTTP Web Server, Powered by Apache
The Oracle Internet Application Server has many components. One of them, the Apache Web server, is the HTTP entry point into Oracle Internet Application Server applications. Apache benefits from the contributions of the best programmers of the Internet and is a proven, scalable and robust Web server. The other components are integrated with Apache either through Apache "mods" supplied by Oracle or through servlets or cgi-bin gateways.

Some of the Apache extensions offered by Oracle - the mods - are standard Apache features; others have been developed specifically for the Oracle Internet Application Server. Oracle supports all these extensions and ports them to every operating system on which Oracle8i is available. For Java programmers the server leverages mod_jserv, which enables you to run servlets and JSPs. It can use any Java Virtual Machine (JVM) running on your system. On Solaris, Oracle bundles Sun's JDK. Oracle has also developed a stand-alone JSP compiler (Oracle JSP) that you can download from http://otn.oracle.com. Oracle JSP 1.1 supports tag libraries without requiring a servlet 2.2 environment, enabling you to use tag libraries on an Apache Web server with mod_jserv. The Oracle Internet Application Server comes with mod_plsql, which enables you to delegate the handling of HTTP requests to PL/SQL and Java stored procedures running in an Oracle database. Running Web applications in the database has proved very scalable for many OAS-powered Web sites. This ability, which was carried over from OAS to the new server, provides a good migration path for OAS customers.

Starting with Release 3, Oracle8i comes with an embedded servlet engine and the same Apache bundle as the Internet Application Server. The engine enables you to run servlets 2.2 and JSPs with the Oracle8i JVM (formerly known as Oracle JServer) directly in the database address space. A new Apache mod, mod_8i, delegates the handling of URLs to the database, thereby providing a more scalable, robust and secure environment for running servlets than does mod_jserv. In addition, SQL-intensive servlets running in the database benefit from a shorter-path JDBC driver and can run faster than in a stand-alone JVM.

Oracle8i Cache
Many real-world Web applications have been designed with homegrown, middle-tier caches to improve scalability. Developers will typically write shell or Perl programs that extract data from a central database and populate file system caches on the Web server systems. The Oracle Internet Application Server provides Oracle8i Cache to install SQL caches in the middle tier.

This full-fledged SQL engine brings read-only SQL data closer to the middle-tier logic. The cache management tool enables you to point to a database and create caches on multiple nodes, hand-picking tables that should be instantiated in the middle tier. By running the SQL caches on the same tier as the application logic, you avoid network round-trips when accessing cached data. This is likely to make the application run faster, but its primary advantage is that it reduces the load on the database, which improves scalability. In effect, you end up with more CPUs to handle the SQL load. The cache is read-only and can be refreshed on demand or on a timer basis.

Release 2 will also let you run the Oracle8i JVM and PL/SQL in the cache. By running servlets, JSPs, EJBs or even CORBA objects in the cache, you obtain a highly scalable, reliable and available execution environment for your J2EE applications. The server runs the same J2EE container in the middle tier as the database does in the back end. This gives you the choice of deploying your J2EE components in either the middle tier or the back-end database without having to modify them.

Other Components
In addition to support for Java and XML, the Oracle Internet Application Server comes with several other modules. Among them is a set of application frameworks for portal construction and long-running forms-based applications, business intelligence and ad hoc reporting. Most of the frameworks are extensible in PL/SQL. Some of them are now being extended to support Java programming, so expect more Java-based application frameworks from Oracle in the future.

For the Java Programmer
The Oracle Internet Application Server is a full-fledged Web application environment that enables you to develop using the Oracle Internet Platform and deploy your application on multiple tiers. It caters well to the needs of the Java programmer; all J2EE APIs are supported, and you can run various J2EE-based components. You also get a collection of Java libraries and frameworks to help you write applications.

An application server requires a set of development tools. For the Java programmer Oracle supplies the JDeveloper programming environment that enables you to develop and deploy J2EE-based components including JSPs, servlets and EJBs. One of the newest features of JDeveloper is support for attaching a debugger to Java code running in the Oracle8i JVM in the cache or data tiers.

J2EE and Other Java Libraries
The Internet Application Server and Oracle8i support all the J2EE APIs. The details depend on the versions, but the key is that the J2EE implementations are identical in both servers, which allows you to move your code freely between the middle (cache) tiers and the Oracle8i data tier. Release 1 of the Oracle Internet Application Server supports servlets and JSPs in the Apache mod_jserv tier. In the next release of both products (Oracle8i Release 3 and Oracle Internet Application Server Release 2) you can also run servlets and JSPs in the middle and data tiers. In all versions EJBs always run in the middle and data tiers. The other J2EE APIs, such as JDBC, JTA, JMS and JavaMail, are available in both tiers.

In addition to J2EE, the Internet Application Server supplies several Java libraries, or frameworks, such as the XML development toolkit and the Portal-to-Go framework, to support WAP devices. Of particular interest is the Oracle Business Components for Java, an object-relational mapping tool and application framework targeted to the SQL-savvy Java programmer. BC4J enables you to define Java objects representing the results of various SQL queries and can help share data between Java objects coming from the same rows, even if they're fetched by unrelated SQL queries. This model, for Java programmers with a SQL background, complements the EJB entity bean implementation of the Internet Application Server. BC4J allows the expert programmer to optimize SQL queries and data access patterns.

Flexible Java Deployment
Two different JVMs are offered with the Internet Application Server to run your Java components: a stand-alone JVM such as Sun's JDK and the Oracle8i JVM embedded in the cache and data tiers (see Figure 2). The stand-alone JVM is intended for use with Apache mod_jserv. The Oracle8i JVM is preferred with the Internet Application Server. You can run servlets, JSPs and EJB clients in the stand-alone JVM. The Oracle8i JVM runs directly in the address space of the Oracle8i caches and database. You can use it to run EJBs, CORBA objects and Java stored procedures. In Release 2 of the Oracle Internet Application Server and in Oracle8i Release 3, you can also use the Oracle8i JVM to run servlets and JSPs directly in the cache and data tiers.

Figure 2
Figure 2:

EJBs always run in the Oracle8i JVM, either in the caches or in the database. In either case the EJBs will run close to the persistent SQL storage, which is highly desirable because EJBs are indeed data-centric components. Many EJB developers are using EJBs as Java-friendly front ends to SQL data. All the JDBC or SQLJ code stays hidden behind the EJB remote interfaces, and servlet programmers calling EJBs don't have to know anything about the SQL schema of the application. This is a good way to design applications if you want to be able to change the database schema without having to reimplement your servlets. Running EJBs in a cache or in the data tier is even more interesting for entity beans, which are even more data-centric than session beans.

Depending on your application, EJBs may benefit from running in a cache tier. Obviously, EJBs that don't update SQL data will benefit greatly from the cache, which is read-only. By replicating the tables used by the EJBs in the middle tier, you'll immediately improve the scalability of your application. EJBs that update data may also benefit from the cache, depending on their data access pattern. Updatable entity beans, especially the ones that rely on the container to manage their persistence (also known as CMP entity beans), will require careful design at both the Java and SQL levels to be able to benefit from the cache at all. In some cases you may get better performance by running EJBs that update data in the data tier, and calling them from read-only EJBs running in the cache tiers. One advantage of having the same EJB container in the cache and data tiers is that you can easily try out different deployment scenarios until you find the best architecture for your application.

Servlets can run either in stand-alone JVMs or in the Oracle8i JVM. Stand-alones are controlled by Apache mod_jserv, and this setup works well for stateless applications. Many Web applications running today have been designed to be stateless to improve scalability, failover and availability. In these applications most of the conversational state is stored in a database across calls. If a JVM running servlets crashes, you can quickly bring up another JVM to take over, and the conversational state can be restored from the database. To end users it just looks like an HTTP failure - once the page is reloaded, work easily resumes. One problem with the stand-alone JVMs is their tendency to hang or crash under heavy memory usage. They can easily get lost in endless garbage collection runs and stop responding. To work around this problem, Apache mod_jserv allows you to distribute the HTTP load across a pool of JVMs. This divides the memory usage across the different JVMs and provides live backups in case one of the JVMs crashes. It also helps to improve the throughput of your application because more threads can run servlets at the same time. Managing the JVM pool isn't easy, but management tools will be available to help you in the future.

The Oracle8i JVM, running directly inside the cache or database, is more robust than stand-alone JVMs. It was designed from the start to be a server VM, and supports heavy memory usage without the problems of stand-alone JVMs. It lets each client see a dedicated JVM when there is, in fact, a pool of server processes taking turns at executing Java on behalf of the different clients. In addition, the Oracle8i JVM provides faster access to SQL than the stand-alone JVMs. It uses the shorter-path JDBC KPRB driver that accesses the SQL engine without any interprocess communication. Because the SQL engine and the Oracle8i JVM are linked in a single executable, the JDBC driver only needs a C function call to execute queries. Finally, Oracle8i Release 3 comes with the JServer accelerator compiler that speeds up Java code running in the Oracle8i JVM to JIT speed, making the Oracle8i JVM a good contender in the high-performance Java world.

Consider running servlets in the Oracle8i JVM if they use a lot of memory (stateful servlets are a good example) or if they need fast access to SQL and EJBs. Servlets running in the Oracle8i JVM have direct in-memory access to EJBs. The EJBs are activated in the same JVM as the servlets, removing the network overhead incurred by the RMI/IIOP calls that are necessary when the servlets run in stand-alone JVMs. Running servlets in the Oracle8i JVM produces a more stable and robust system. Stateless servlets or servlets using a small amount of per-client memory will work fine in the stand-alone JVMs. However, be aware that because of security and integrity reasons the Oracle8i JVM doesn't allow you to use JNI and doesn't implement some of the AWT interfaces; therefore you must run servlets that depend on these features in the stand-alone JVMs.

A New Generation of Application Servers Combining Apache with a middle-tier SQL cache executing the state-of-the-art Oracle8i JVM and the proven PL/SQL engine provides an extremely powerful application server. Adding a family of application frameworks for portals, forms, business intelligence, mobile device access and asynchronous communications makes the Oracle Internet Application Server one of the richest programming environments available for developing and deploying Web applications. The tight integration of the server with the Oracle8i database, together with the shared J2EE container, broadens the deployment options from a single system for lower scalability needs to multiple forms of systems for utmost Internet scalability. Providing Java programming and remote debugging tools, the server can be used in conjunction with the Oracle8i database to fulfill the promise of the Oracle Internet Platform to furnish an end-to-end solution for the development of Web applications.

.  .  .

For more information on the Oracle Internet application server, visit www.oracle.com/ip/deploy/ias/. Developers should go to http://otn.oracle.com/products/ias/. For more information on the scalability of the Oracle JServer VM (Oracle8i JVM), see the November 1999 issue of Java Developer's Journal (Vol. 4, issue 11).

Author Bio
Matthieu Devin is a director of development in Oracle's Server Technologies division and the chief architect for the Oracle Internet Application Server product. [email protected]


All Rights Reserved
Copyright ©  2004 SYS-CON Media, Inc.
  E-mail: [email protected]

Java and Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. SYS-CON Publications, Inc. is independent of Sun Microsystems, Inc.