Wednesday, July 16, 2014

Weblogic -- Increasing Memory Size / Managed Server High Cpu usage/ Weblogic Console hang

Weblogic managed servers can spin in the Cpu if the memory they may use is not enough for their work.
You can monitor situation using Linux top command.
Just after starting your managed server, issue top command.
Look for RES column , this will display the physical memory that managed server uses at a time.. Also look for the CPU column, for the percentage of the CPU resource that your managed server uses..
In a memory leak situation  , you will see that , after starting your managed server, its RES column will increase .. It will increase but stop increasing at a limit.. This limit is actually the limit that your managed server's java process is configured.. I am talkin about Xms Xmx XX:PermSize and XXMaxPermSize.. In some situation you will see your weblogic managed server consumes all the CPU cycles in the system and a hang situation arises because of it.. You will not able to navigate even in your weblogic admin console, when this happens.

The solution for this problem is to increasse the memory limits of the problematic Managed server..

You can increase the limit by using Admin console before starting your managed servrer..
You should choose your managed server and put following parameters in to the argument section which resides the Server Start tab..

-Xms2048m -Xmx4096m -XX:PermSize=1024m -XXMaxPermSize=1024m

For example :

Thanks to http://itbitsolutions.files.wordpress.com for sharing this screenshot.

When you set these memory parameters properly and start your managed weblogic server, you will see that it will use CPU and it will increase the memory usage (RES column) in the first start, but then after a while it will finish its works and release the CPU, as well as stabilize its Memory usage.

Lastly, I m sharing the definitions of java memory parameters used in this document as follows;

Thanks to http://www.avricot.com/ for the info below..

Permanent Space is  used by stored classes, methods etc. It is controlled by ;
-XX:PermSize: initial value
-XX:MaxPermSize: max value

Java Heap is a continous memory region where all Objects data will be stored (by data, we mean instance of class, primitive and references). controlled by,
-Xmx : max heap size
-Xms : min heap size.
-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.

1 comment :

  1. Bluehost is definitely one of the best web-hosting company with plans for all of your hosting needs.

    ReplyDelete