1 Introduction to Application Diagnostics for Java

This chapter provides an introduction to Oracle Enterprise Manager 10g Application Diagnostics for Java. It covers the following:


Mission critical Java applications often suffer from availability and performance problems. Developers and IT administrators spend a lot of time diagnosing the root cause of these problems. Many times, the problems occurring in production environments either cannot be reproduced or may take too long to reproduce in other environments. This can cause severe impact on the business.

Oracle Enterprise Manager 10g Application Diagnostics for Java (Oracle AD4J) is a lightweight Java application monitoring and diagnostics tool that enables administrators to diagnose performance problems in production. By eliminating the need to reproduce problems, it reduces the time required to resolve these problems. This improves application availability and performance. Using Oracle AD4J, administrators will be able identify the root cause of performance problems in the production environment without having to reproduce them in the test or development environment. It does not require complex instrumentation or restarting of the application to get in-depth application details. Application administrators will be able to identify Java problems or Database issues that are causing application downtime without any detailed application knowledge. The key features of Oracle AD4J are:

Low Overhead Monitoring with Deep Diagnostics

Oracle AD4J provides in-depth monitoring of Java applications with very low overheads. Hence it does not slow down your application. It helps you to identify the slowest requests, slowest methods, requests waiting on I/O, requests using a lot of CPU cycles, and requests waiting on database calls. It also identifies the end-user requests that have been impacted by resource bottlenecks. Application resources that are causing the performance bottleneck are also visible.

Easy Installation and Deployment

Oracle AD4J is easy to install, deploy, and use. To install the product, you do not need to modify the source code / byte code of your application, or restart any application server. The AD4J Agent can be deployed easily without modifying the application or changing any configuration files. Once deployed, the Monitoring feature can be turned on so that it is always monitoring your production JVMs and databases. This saves time in reproducing the problems.

Real-Time JVM Visibility

Oracle AD4J provides immediate visibility into the Java stack. You can monitor thread states and Java method/line numbers in real time and you can proactively identify issues rather than diagnosing issues like application crashes, memory leaks, and application hangs after they occur.

If a particular request is hanging or if the entire application is slow, administrators can perform a real-time transaction trace to view current Java application activity. You can see the offending threads and their execution call stacks. You can also analyze various bottleneck resources such as how much time a thread spent in waiting for a database lock. Complex problems such as activity in one thread (or request) affecting the activity in the other thread or rest of the JVM can be found very quickly.

Cross-Tier Transaction Tracing

Oracle AD4J facilitates tracing of Java requests to the associated database sessions and vice-versa enabling rapid resolution of problems that span different tiers. It highlights the slowest SQL queries and helps administrators to tune SQL and the database to improve the performance application. This facilitates smooth communication between the database administrators and application administrators by isolating the problems to the database or the Java tier.

Powerful Heap Analysis Tools

Memory leaks lead to application slowdowns and eventually cause applications to crash. Oracle AD4J alerts administrators on abnormalities in Java memory consumption. Administrators can use Oracle's Java diagnostics console and take heap dumps in production applications without disturbing the application. They can take multiple heap dumps over a period of time, analyze the differences between the heap dumps and identify the object causing the memory leak. Heap analysis can be performed even across different application versions. Differential Heap Analysis with multiple heap dumps makes it easy to identify memory leaks.

JVM Pooling

Oracle AD4J allows administrators to group sets of JVMs together into JVM pools. This provides the console user with a single view across all related JVMs. Hence all JVM's that make up a single application or a single cluster may be grouped together in an application. This allows administrators to visualize problems naturally and intuitively.

Real-time and Historical Diagnosis

With Oracle AD4J, you can perform real-time and historical diagnostics on your Java applications. This provides you with detailed insight on the root causes of production problems without having to reproduce the same problem in a Test or QA environment. You can play back transactions interactively from the browser and view the time spent in the network and the server. You can also view the response time breakdown by Servlet, JSP, EJB, JDBC, and SQL layers.

Apart from the real-time data, you can also analyze historical data to diagnose problems that occurred in the past. You can view historical data that shows the time taken by end-user requests and the breakdown by Servlet, JSP, EJB, JDBC, and SQL layers.

JVM Tracing

Sometimes the monitoring interval (normally 1 second) that is in use is too coarse grained. The Java thread of interest may be too short lived or the amount of monitoring data collected may be insufficient. In such cases, you can run a JVM Trace to get fine-grained details of the JVM activity. This feature of AD4J allows you to monitor your Java application at a very high frequency (default of once every 50ms) for a short period of time. This allows you to identify interdependency of threads, bottleneck resources (DB, I/O, CPU, Locks, Network) & top methods.

System Architecture

The following figure shows the system architecture of Oracle's Java Diagnostics application.

Figure 1-1 AD4J Architecture

AD4J Architecture

In this diagram, two AD4J Agents are being used to monitor a standard three tier Java based application. The JVM agent is used to monitor the mid-tier and the database agent is used to monitor the back end. The AD4J Console is a web-based console and does not require any client utility to be installed. In response to specific user actions on the console, the console makes various requests for monitoring data to the AD4J JVM Agent. The Agent takes snapshots of the state of the running JVM and sends a response back to the Console which is stored in the repository. If additional database correlation information is required, the Console sends a request to the AD4J DB Agent which in turn sends a response back to the Console. All the computation and post processing activity takes place only in the Console and its repository thereby ensuring optimal performance from the application itself.

Software and Hardware Requirements

  • Console JVM Requirements: Any 32-bit JDK.

  • AD4J Console: Windows (2000 or later), Windows XE, Linux (RHEL 3 or later), Solaris SPARC (8 or later), 1 CPU, 2GHz (Intel equivalent), 2GB RAM, 10GB Hard Disk.

  • Supported Console Repository Versions: Oracle 9i, 10g, and 11g either local or remotely installed. On Windows only, you can use the PostgreSQL starter database that is shipped with the product. This database must be changed to an Oracle database before production deployment.

    To run the AD4J Console with a repository on Oracle XE, you need to increase the Max DB Sessions by entering the following commands in SQL*Plus:

    SQL> show parameters sessions
    SQL> alter system set sessions=500 scope=spfile;
    SQL> show parameters processes
    SQL> alter system set processes=500 scope=spfile;


    When you load heap dumps, ensure that there is at least 5 times the amount of space as the file being loaded. E.g.: If you are loading a 1GB heap dump, you must ensure that there is 5GB available in the database.