|
Tuning Java Virtual Machines (JVMs)
The Java virtual machine (JVM) is is an abstract computing machine designed to support the Java programming language. How you tune your JVM affects the performance of WebLogic Server and your applications.The following sections discuss JVM tuning considerations:
Table 2-1 discusses general JVM tuning considerations.
The JVM vendor and version affect performance. Use only production JVMs on which WebLogic Server has been certified. WebLogic Server 6.x supports only those JVMs that are Java 1.3-compliant. The Platform Support page is frequently updated and contains the latest certification information on various platforms. Check this page often for the most current JVM information. |
|
Deployments using different JVM versions for the client and server are supported in WebLogic 6.0. For information about support for mixed client/server JVMs. Check the Platform Support page often for the most current information. |
|
Use a JIT compiler when you run WebLogic Server. Most JVMs use a JIT compiler, including those from Sun Microsystems and Symantec. See your JVM supplier documentation for more information. Note: Sun's JVM 1.3.x, JIT options are no longer valid because the Java HotSpot Client and Server Virtual Machines are two separate JITs accessing the same runtime system. See Java Virtual Machine (JVM) Information. |
|
On UNIX, two threading models are available: green threads and native threads. To get the best performance and scalability with WebLogic Server, choose a JVM that uses native threads, not green threads. See your VM documentation for more information about threading. For Solaris, see "Threading Models and Solaris Versions Supported" on the JavaSoft web site. |
|
See Tuning Heap Size. |
The JVM heap size determines how often and how long the VM spends collecting garbage (de-allocating unused Java objects).The JVM heap is a repository for live objects, dead objects, and free memory. When a JVM runs out of memory in the heap, all execution in the JVM stops while a garbage collection algorithm goes through memory and frees space that is no longer required by an application. This process affects performance because server-side work cannot proceed during garbage collection.
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.
The goal of tuning your heap size is to minimize the time that you spend doing garbage collection while maximizing the number of clients that you can handle at a given time.
This section describes how to determine the most effective heap size:
-Xverbosegc:file=/tmp/gc$$.out
where $$ maps to the PID of the java process.
Because the output includes timestamps for when garbage collection ran, you can infer how often it
Use as large a heap size as possible without causing your system to "swap" pages to disk. The amount of free RAM on your system depends on your hardware configuration and the memory requirements of running processes on your machine. See your system administrator for help in determining the amount of free RAM on your system.
Typically, you should use 80% of the available RAM (not taken by the operating system or other processes) for your JVM.
Setting Minimum Heap Size Equal to Maximum Heap Size
Set the minimum heap size equal to the maximum heap size. This yields higher performance throughput than setting the values differently, and prevents the JVM from spending time incrementing the heap. You specify the minimum and maximum values for Java heap memory when starting the WebLogic Administration Server from the Java command line.
$ java ... -XX:NewSize=128m -XX:MaxNewSize=128m -XX:SurvivorRation=2 -Xms512m -Xmx512m
Setting High Heap Size for Benchmarking
To ensure maximum performance, you might set high heap size values to ensure that garbage collection does not occur during the entire run of the benchmark.
Using Non-Standard Java Command Line Options
You can use non-standard java options to improve performance. Be aware that use of these options depends on how your application is coded.
Non-Standard Options for Hotspot VM on NT
Some examples of options for improving performance on the Hotspot VM on NT are listed in Table 2-2.
Non-Standard Options for HotSpot VM on Solaris
See non-standard options for Solaris VMs at .
|
Copyright © 2000 BEA Systems, Inc. All rights reserved.
|