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
 

The Internet is rapidly evolving from a static, stateless, information-exchange medium to a dynamic transactional medium that offers new opportunities to change how we do business. To exploit these opportunities, leading-edge independent software vendors and corporate IT organizations are beginning to build and deploy enterprise applications using open Internet standards. They use standard Internet browsers and HTML as clients, model their business logic in Java and access these applications via open Internet communication protocols such as HTTP and IIOP. They deploy applications on a small number of professionally managed, highly scalable and high-performance application servers and database servers.

Building enterprise applications on the Internet model has been challenging, however, requiring application developers to learn an enormous number of tools, and different types of servers and middleware. Further, the infrastructure platforms available have failed to offer the performance, scalability or reliability required by enterprise applications. Java servers in particular have faced three important limitations. First, the Java language is challenging, requiring automatic storage management, language-level multithreading and loosely coupled dynamic loading that limit scalability and performance. Second, the first generation of Java VMs have naturally focused on the needs of single-user systems; for example, good, lightweight performance for dynamically downloaded applets, and GUI-driven execution rather than the enormous throughput, performance (for long-running, preinstalled applications) and reliability required for mission-critical, transaction-oriented business applications. Third, Java VMs have required developers to write multithreaded servers using sophisticated multiprogramming concepts rather than providing a robust, multithreaded server platform that simply runs business applications scalably.

Oracle8i was designed to dramatically simplify how Internet applications are developed, deployed and managed. There are three fundamental components to this strategy.

  • At the heart of Oracle8i is a fast and highly scalable Java Virtual Machine that is seamlessly integrated with the database kernel and provides an efficient execution platform for Java programs. It was designed specifically to address the three challenges described above - performance, scalability and reliability.
  • Oracle8i provides users with a variety of industry-standard programmatic interfaces with which to build applications in Java. These include support for Enterprise JavaBeans, CORBA Services in Java and Java stored procedures, an emerging standard supported by virtually all the major database vendors. Java applications in turn access SQL via standard interfaces - JDBC drivers or SQLJ, a standard way to embed SQL statements in Java programs.
  • Oracle offers JDeveloper, a Java development tool that provides a number of facilities supporting SQLJ, Java stored procedures, Enterprise JavaBeans and CORBA services
Key Architectural Features of Oracle's Java VM
Figure 1 provides an architectural illustration of Oracle8i's JVM. Three primary architectural components make it an efficient server platform.
  • An advanced server-oriented memory manager to improve the scalability of Java programs
  • A high-performance native compiler to speed up the execution of Java programs
  • A generalized protocol framework to allow Java programs to be accessed directly from a variety of Internet clients

Figure 1
Figure 1:

Server-Oriented Memory Management System
The Oracle database has for many years supported a highly scalable server called the MultiThreaded Server (see Figure 2) within which we have integrated Oracle's JVM. The JVM includes a unique, high-performance memory manager that conforms to and is tuned to the multithreaded server's shared memory model while remaining completely transparent to the Java programmer. It allocates and frees memory in chunks called object memories. There are three different types of object memories with different lifetimes and degrees of sharing across users:

  • Shared memory: The JVM puts immutable Java objects (such as metadata, bytecode vectors and constant pool data) into shared memory initialized once and shared across users.
  • Session Memory: It places Java session state (the transitive closure of each concurrent user's static variables over their references) into per-client shared memory, giving users the illusion of their own "virtual machine."
  • Call Memory: Finally, it uses per-call memory as the allocation space of a modern-generation, scavenging garbage collector.

Figure 2
Figure 2:

The net benefit of these sophisticated shared-memory mechanisms is to reduce per-user memory requirements for typical stateful Java sessions to between 80 and 150 KB, allowing Oracle8i to support tens of thousands of concurrent users.

Native Compilation
Contrary to early impressions, Java is not inherently slow to execute, but is amenable to a wide range of compilation strategies. Oracle8i's JVM includes a native compiler tuned to the needs of server applications. It translates Java binaries to a portable subset of ANSI C source, which is in turn dynamically compiled to platform-specific binary code by a target C compiler. The resulting executable is dynamically linked directly into the server as a dynamic-link library. We adopted this approach for two reasons: first, server code tends to be longer lived and more throughput-critical than client code, allowing us to invest more resources upfront to produce more efficient code than JIT compilers, which must amortize the cost of compilation over a much shorter duty cycle; and second, it allows us to offer high performance uniformly on over 60 different hardware and operating system platforms.

The net benefit of native compilation? In early tests the native compiler has demonstrated improved Java execution performance from 15 to 40 times faster than interpreted code.

Generalized Protocol Framework
To allow a variety of standard Internet clients such as browsers, Internet mail clients, embedded ORBs and middle-tier application servers to access Java programs scalably in the server, we have generalized the database's listener and dispatcher to provide general-purpose protocol handling for arbitrary, user-defined protocols. Oracle8i uses this infrastructure to provide native support for HTTP, IIOP, Internet Mail protocols (IMAP4, SMTP, POP3) and other protocols including FTP.

Programming Oracle8i's JVM
Oracle8i's VM is a general-purpose JVM; any Java application can be run on it. It supports three different programming models: Java stored procedures, Enterprise Java-Beans and CORBA Services.

Java Stored Procedures
Java programs can be stored and executed in the Oracle database as Java stored procedures, which allow users to program the database by adding business rules in Java to extend SQL. As an industry standard, Java stored procedures are portable across databases from many different vendors. Such procedures use JDBC or SQLJ to access data. Because they execute in the database server, SQL access is much faster than when the data needs to be retrieved from the server to a JVM on another machine. Java stored programs run in a variety of contexts:

  • User-defined functions and stored procedures are called within SQL queries, allowing the stored procedure programmer to directly extend SQL with Java.
  • Triggers are stored procedures that are tied to a particular table or view and execute when that table or view is changed. All five types of Oracle triggers can be implemented in Java.
  • Object-relational methods allow users to add behavior to SQL object types in Java. Java stored programs can be invoked from any database client including Java clients such as JDBC and SQLJ, 4GL tools such as Developer/2000 and PowerBuilder, and C/C++ clients via ODBC or the Oracle call interface.

Enterprise JavaBeans (EJBs)
EJBs give Java application programmers a convenient and highly productive component model for server-side business logic, facilitating code reuse and multitier application development. Oracle8i provides a highly scalable and high-performance execution environment for EJBs that complies with the EJB 1.0 specification. It supplies a number of EJB services including a Java Transaction Service (JTS) API via the embedded JDBC driver, which has been extended to support JTS-visible transactions. It exposes a Java Naming and Directory Interface (JNDI) to any industry standard Lightweight Directory Access Protocol (LDAP)-enabled directory service. EJB components in the server can be placed in any standard directory and accessed via JNDI. Additionally, it provides a stringent security framework using Internet-standard security mechanisms such as SSL over IIOP for encryption, coupled with traditional database authentication and multiple layers of access control.

CORBA Servers
Distributed systems developers can use the infrastructure used for EJBs to deploy CORBA servers implemented in Java. The JVM provides a CORBA Object Transaction Service (OTS) and also exposes a standard COSNaming interface. Oracle8i provides an object adapter that serves as a registry of CORBA objects published in the RDBMS, and helps locate and load CORBA objects upon initial activation by CORBA clients. It also provides a number of features that make it easy for Java programmers to develop CORBA services, including Caffeine, a direct Java-to-IIOP mapping that eliminates the need for IDL definition, support for objects by value and extensible structs, and a number of tools that simplify application development. Figure 3 illustrates how Enterprise Java Beans and CORBA services can be used in Oracle8i.

Figure 3
Figure 3:

Summary
Oracle8i represents a revolutionary new breed of product: a server platform targeted specifically to simplify how you build, deploy and manage Internet applications. It combines enterprise-scale support for SQL data (the shape of the Internet's data) and Java programs (the language of the Internet's behavior) in a highly integrated, robust, easy-to-use package. All of its components - the protocol framework, the JVM and the data-management facilities - are configured to run out of the box and be managed with a single tool. Oracle8i promises dramatic improvement in how quickly and productively Internet applications can be developed and deployed.

About the Authors
Thomas Kurian is director of Internet computing at Oracle Corporation and is responsible for formulating Oracle's database strategy in the Internet and e-commerce marketplaces. Prior to Oracle, Thomas worked at McKinsey and Company, an international consulting firm. You can e-mail him at [email protected]

Dave Rosenberg is senior director, Java products group, Oracle Corporation, and heads the development team responsible for the Java VM in Oracle8i. Prior to Oracle, Dave led efforts to build object-oriented databases at Object Design Inc. and knowledge management systems at ISX Corporation. You can e-mail him at [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.