How to setup java memory aurgs for weblogic

First of all, JVM memory
for 32 bit OS, JVM max is 4GB of RAM.

Java Heap
java heap is a continuous memory region where all the Objects data will be stored.

Java Heap parameters:
-Xmx : max heap size (ex: -Xmx1024)
-Xms : min heap size. Having -Xms = 1.8GB (32bit) can be bad, because you don’t let memory for anything else.
-Xmn : the size of the heap for the young generation
Young generation represents all the objects which have a short life of time. Young generation objects are in a specific location into the heap, where the garbage collector will pass often. All new objects are created into the young generation region (called “eden”). When an object survive is still “alive” after more than 2-3 gc cleaning, then it will be swap has an “old generation” : they are “survivor” .
Good size is 33%
-XX:NewRatio : the same as Wmn, but using a % (dynamic fs static -Xmn option). -XX:NewRatio=3 means that the ratio between the old and young generation is 1:3
-XX:NewSize – Size of the young generation at JVM init. Calculated automatically if you specify -XX:NewRatio
-XX:MaxNewSize – The largest size the young generation can grow to (unlimited if this value is not specified at command line)
-XX:SurvivorRatio : “old generation” called tenured generation, ratio, in %. For example, -XX:SurvivorRatio=6 sets the ratio between each survivor space and eden to be 1:6 (eden is where new objects are created)
-XX:MinHeapFreeRatio: default is 40%. JVM will allocate memory to always have as minimum 40% of free memory. When -Xmx = -Xms, it’s useless.
-XX:MaxHeapFreeRatio: default is 70%. The same as Min, to avoid unecessary memory allocation.

For weblogic setup:
1. Open the domain environment sh file:

        
\user_projects\domains\base_domain\bin\setDomainEnv.sh

2. Locate the following remark, inside the sh file: (‘Search’ -> “#REM IF USER_MEM_ARGS”)

#REM IF USER_MEM_ARGS the environment variable is set, use it to override ALL MEM_ARGS values

3. Directly after this remark, add the following line:

USER_MEM_ARGS=-Xms256m -Xmx1024m -XX:CompileThreshold=8000 -XX:PermSize=128m -   XX:MaxPermSize=512m

4. The portion of the file you have edited looks like this:

#REM IF USER_MEM_ARGS the environment variable is set, use it to override ALL MEM_ARGS values

        USER_MEM_ARGS=-Xms256m -Xmx1024m -XX:CompileThreshold=8000 -XX:PermSize=128m -XX:MaxPermSize=512m

        if NOT “%USER_MEM_ARGS%”==”" (

        MEM_ARGS=%USER_MEM_ARGS

        )

Additional:
-Xrs Reduces use of operating-system by the java VM, Disables signal handling in the JVM.
Setting -Xrs prevents the Java™ run time environment from handling any internally or externally generated signals such as SIGSEGV and SIGABRT. Any signals raised are handled by the default operating system handlers. Disabling signal handling in the JVM reduces performance by approximately 2-4%, depending on the application.

Useful info:
http://www.petefreitag.com/articles/gctuning/
http://docs.oracle.com/javase/7/docs/technotes/tools/windows/java.html

Add a Comment