About Identifying Top Performance Areas

2-4 Oracle Fusion Middleware Performance and Tuning Guide This section covers the following performance tuning areas for your JVM: ■ Configuring Garbage Collection ■ Logging Low Memory Conditions ■ Monitoring and Profiling the JVM

2.4.1 Configuring Garbage Collection

Garbage collection is the JVM process of freeing up unused Java objects in the Java heap. JVM garbage collection can be a resource-intensive operation and may effect application performance. In some cases, inefficient garbage collection can severely degrade application performance. Therefore, it is important to understand how applications create and destroy objects. This section cover the following Garbage Collection tuning options: ■ Specifying Heap Size Values ■ Selecting a Garbage Collection Scheme ■ Disabling Explicit Garbage Collection An acceptable rate for garbage collection is application-specific and should be adjusted after analyzing the actual time and frequency of garbage collections. If you set a large heap size, full garbage collection is slower, but it occurs less frequently. If you set your heap size in accordance with your memory needs, full garbage collection is faster, but occurs more frequently. To tune the JVM garbage collection options you must analyze garbage collection data and check for the frequency and type of garbage collections, the size of the memory pools, and the time spent on garbage collection. Before you configure JVM garbage collection, analyze the following data points: 1. How often is garbage collection taking place? Compare the time stamps around the garbage collection. 2. How long is a full garbage collection taking? 3. What is the heap size after each full garbage collection? If the heap is always 85 percent free, for example, you might set the heap size smaller. 4. Do the young generation heap sizes Sun or Nursery size Jrockit need tuning? Note: To maximize performance from your JVM, be sure that you use only production JVMs on which your applications have been certified and that your operating system patches are up-to-date. The Supported Configurations pages at http:www.oracle.comtechnologysoftwareproductsi asfilesfusion_certification.html are frequently updated and contain the latest certification information on various platforms. See Also: The JVM provides a variety of parameters to enable you to more finely tune heap management and garbage collection behavior. For more information, see the references listed in Appendix A : Oracle JRockit Java Virtual Machine JVM . Top Performance Areas 2-5 You can manually log garbage collection and memory pool sizes using verbose garbage collection logging: ■ Sun JVM command line options: -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps Look for Full GC to identify major collections. ■ Additional Sun Tools: – JStat – JConsole – Visualgc For more information on Sun’s options, see http:java.sun.comjavasetechnologieshotspotgcindex.jsp ■ Jrockit JVM command line options: -XXverbose:gc NOTE: Oracle provides other command-line options to improve the performance of your JRockit VM. For detailed information, see JRockit JDK Command Line Options by Name at http:download.oracle.comdocscdE13150_ 01jrockit_jvmjrockitwebdocsindex.html ■ Additional JRockit Tools: – JRockit Runtime Analyzer jra recording – JRockit Management Console jrmc – JRockit Memory Leak Detector

2.4.1.1 Specifying Heap Size Values

The goal of tuning your heap size is to minimize the time that your JVM spends doing garbage collection while maximizing the number of clients that the Fusion Middleware stack can handle at a given time. Specifically the Java heap is where the objects of a Java program live. It is a repository for live objects, dead objects, and free memory. When an object can no longer be reached from any pointer in the running program, it is considered garbage and ready for collection. A best practice is to tune the time spent doing garbage collection to within 5 of execution time. The JVM heap size determines how often and how long the virtual machine spends collecting garbage. An acceptable rate for garbage collection is application-specific and should be adjusted after analyzing the actual time and frequency of garbage collections. If you set a large heap size, full garbage collection is slower, but it occurs less frequently. If you set your heap size in accordance with your memory needs, full garbage collection is faster, but occurs more frequently. In production environments, set the minimum heap size and the maximum heap size to the same value to prevent wasting virtual machine resources used to constantly grow and shrink the heap. Ensure that the sum of the maximum heap size of all the