WebLogic Server Performance and Tuning: Part I - Tuning JVM

Each WebLogic Server instance runs in its own dedicated Java Virtual Machine (JVM) which is their runtime environment. Every Admin Server in any domain executes within a JVM. The same also applies for Managed Servers. WebLogic Server can be used for a wide variety of applications and services which uses the same runtime environment and resources. Oracle WebLogic ships with 2 different JVM, HotSpot and JRocket but you can choose which JVM you want to use.

JVM is designed to optimize itself however it also provides some startup options to make small changes. There are default values for its memory and garbage collection. In real world, you will not want to stick with the default values provided by the JVM rather want to customize these values based on your applications which can produce large gains in performance by making small changes with the JVM parameters. We can tell the garbage collector how to delete garbage and we can also tell JVM how much space to allocate for each generation (of java Objects) or for heap. Remember during the garbage collection no other process is executed within the JVM or runtime, which is called STOP THE WORLD which can affect the overall throughput.


Each JVM has its own memory segment called Heap Memory which is the storage for java Objects. These objects can be grouped based on their age like young generation (recently created objects) or old generation (surviving objects that have lived to some extent), etc. A java object is considered garbage when it can no longer be reached from anywhere in the running program. Each generation has its own memory segment within the heap. When this segment gets full, garbage collector deletes all the objects that are marked as garbage to create space. When the old generation space gets full, the JVM performs a major collection to remove the unused objects and reclaim their space. A major garbage collect takes a significant amount of time and can affect system performance.

When we create a managed server either on the same machine or on remote machine it gets its initial startup parameters from $DOMAIN_HOME/bin/setDomainEnv.sh/cmd file.
By default two parameters are set:

    Xms: The initial heapsize
    Xmx: The max heapsize


Try to set equal initial and max heapsize. The startup time can be a little longer but for long running applications it will provide a better performance.

When we set -Xms512m -Xmx1024m, the physical heap size will be 512m. This means that there are pages of memory (in the state of the 512m) that the JVM does not explicitly control. It will be controlled by OS which could be reserve for the other tasks. In this case, it is an advantage if the JVM claims the entire memory at once and try not to spend time to extend when more memory is needed. Also you can use -XX:MaxPermSize (Maximum size of the permanent generation) option for Sun JVM. You should adjust the size accordingly if your application dynamically load and unload a lot of classes in order to optimize the performance.

You can set the JVM options/heap size from the following places:

    Through the Admin console, in the Server start tab (Please note this feature is enabled ONLY if managed server is started via nodemanage/Admin Console and StartScriptEnabled is set to false in the nodemanager.properties which is default)


    In the startManagedWeblogic script for the managed servers
    $DOMAIN_HOME/bin/startManagedWebLogic.sh/cmd
    JAVA_OPTIONS="-Xms1024m -Xmx1024m" ${JAVA_OPTIONS}


    In the setDomainEnv script for the managed servers and admin server (domain wide)
    USER_MEM_ARGS="-Xms1024m -Xmx1024m"

When there is free memory available in the heap but it is too fragmented and not contiguously located to store the object or when there is actually insufficient memory we can get java.lang.OutOfMemoryError. We should create Thread Dump and analyze if that is possible in case of such error.


The second option we can use to produce higher throughput is to garbage collection. We can roughly divide GC algorithms into 2 categories: parallel and concurrent. Parallel GC stops the execution of all the application and performs the full GC, this generally provides better throughput but also high latency using all the CPU resources during GC. Concurrent GC on the other hand, produces low latency but also low throughput since it performs GC while application executes. The JRockit JVM provides some useful command-line parameters that to control of its GC scheme like -XgcPrio command-line parameter which takes the following options;

XgcPrio:pausetime (To minimize latency, parallel GC)
XgcPrio:throughput (To minimize throughput, concurrent GC )
XgcPrio:deterministic (To guarantee maximum pause time, for real time systems)


Sun JVM has similar parameters (like  -XX:UseParallelGC or -XX:+UseConcMarkSweepGC) to control its GC scheme. We can add -verbosegc -XX:+PrintGCDetails to monitor indications of a problem with garbage collection.

Try configuring JVM’s of all managed servers to execute in -server mode to ensure that it is optimized for a server-side production environment.

Comments:

You can set the JVM options/heap size from the following places:
Through the Admin console, in the Server start tab (Please note this feature is enabled ONLY if managed server is started via nodemanage/Admin Console and StartScriptEnabled is set to false in the nodemanager.properties which is default)

I am taking your statement and trying to find out something
In our environment I have done same thing but StartScriptEnabled is true .But I am still able to do start and stop the instance.
Can you please let me know why is it so .

Posted by abhishek on January 08, 2013 at 04:24 PM CET #

Hi Abhishek,

Its right there is no need to keep it false as if we want to control the Managed server through NodeManager we need to keep this property as "true"

Thanks
-Ashish

Posted by Ashish on August 29, 2013 at 10:26 AM CEST #

Hi ,
Need help for configuration of JRockit JVM, we are facing memory issue with this JVM with below parameter:
Xms:512
Xmx: 1536
1)After 2 new version deployment/undeployment JVM is not reclaiming space
and SOA server is getting crash becouse of java out of memory issue.

2) after 1000 BPM instance creation its also not reclaiming memory and SOA server is getting crash becouse of java out of memory issue.

Please help any body .

Thanks
Shailendtra

Posted by shailendra on November 30, 2013 at 09:10 PM CET #

Hi,

When we set memory for each managed server for e.g. "-Xms1024m -Xmx1024m" and in the setDomainEnv to "-Xms1024m -Xmx1024m". Suppose if we have three managed server in the same machine and we set each managed server to "-Xms1024m -Xmx1024m". What memory value should be used in the setDomainEnv. Will each of the managed sever use the value allocated in setDomainEnv file. Or would the managed server use the memory from its own JVM.

Thanks
Harish

Posted by Harish on March 19, 2014 at 01:04 PM CET #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Oracle ECEMEA Partner Hubs Migration Center Team

We share our skills to maximize your revenue!
Our dedicated team of consultants can rapidly and successfully assist you to adopt and implement the latest of Oracle Technology in your solutions.

Stay Connected
partner.imc
@
beehiveonline.oracle-DOT-com
Google+

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
2
3
4
5
6
9
10
11
12
13
14
16
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today