We have some ADF Application in WLS 11g. The application is used 24*7 day by users as its main business application. After few days servers responds slowly or say after handling
requests it goes slow down. Ultimately, stops & throw Out of Memory error. We know that allocating more physical memory can extend some more days to throw Out of Memory
Error but here or there it has to be Out of Memory & we have to restart WLS.
So, here is our challenge as we can't afford to restart server always or dont want to go in situation Out of Memory. The reason is we have many users online, posting transactions.
I want to know from experts, how can we avoid Out of Memory situation forever ? How can we avoid restarting WLS when it slows down ? Why java servers need to be restarted ?
First of all Java has in built mechanism of garbage collection which clears the memory as and when required.
It seems that there might be memory leak in your code due to which memory is not cleared as the objects might still be showing as referenced objects due to which u r noticing OutOfMemory
Also check what kind of OutOfMemory u r noticing in the logs.
You could capture heap dump of the JVM process and analyze it in order to find out the code which is leaking out.
Please go thru the below links :
Also once u restart the servers memory gets cleaned up and is available for use.
Edited by: b!p2!|\| on Jan 4, 2013 3:59 AM
Ya , I know GC is mechanism for clearing the memory. So, you mean if our code is leaking proof, we are never going to get OutOfMemory. But what about slowness of server responding after
handling several requests. When it slows down very much, we have to restart WLS. Is it possible to avoid restarting wls ?
At the very first step your code should be leak proof.
In order to verify that the code is leak proof capture GC logs and check whether after every garbage collection cycle memory is released for reuse , if not there is definitely leak in the code.
You could use GC viewer tool for viewing GC logs, heap dump would definitely give a larger picture with lot of more information and the code which is creating highest number of objects.
First of all it is very necessary to determine how much memory your application would need and accordingly assign enough memory i.e. heap size.
GC plays an important role on how the server behaves so try to tune the GC algorithm for better performance.
Below link speaks about the performance tuning of JVM , however the code should be leak proof.