Sunday, 15 September 2013

Solving approach a Perm Gen out of memory memory issue

Solving approach a Perm Gen out of memory memory issue

Please read it completely before marking it duplicate
I have gone through many blogs/post here and on google in order to find a
concrete way to resolve the perm gen OOM issue; but none of them has
solved the issue so far. Here is the my use-case:
I have a tomcat server on which many individual project *.war files are
deployed.
The perm gen issue was not a problem initially and we kept on adding more
modules.
Recently we faced Perm Gen - OOM issue and it was successfully resolved by
increasing perm gen memory in JVM parameter.
We kept on adding more modules and then one fine day again encountered
this issue.
As a temporary solution, we keep on re-starting our server and the issue
remain silent for a week or so.
Approach towards permanent solution:
The famous approach to increase perm gen in JVM parameter is not an option
anymore.
I understand that this could be a code issue, which is causing perm gen
memory leak. But reviewing the huge codebase is almost impossible.
Your help needed:
Is there a free tool or quick way (or tips) to figure out a bad code here?
One observation in our code module:
I have observed that in each of the module *war, there is 80% common jar
used, but all of them is bundled individually into each of the war.
What I see here (I may be wrong)
The tomcat server must be using individual app-classloader for each of the
modules war.
So, even though two same classes from a jar (say same abcd.jar located
into different war) gets loaded in perm gen area; they would not be
visible to each other (due to java security model).
In short for each of the app, many copies of a class may be getting loaded
(which, otherwise could be made common).
Your help needed:
Is the above analysis holds true?
If we move the common jars into some common lib path and include that path
into tomcat shared lib configuration, would it help? My target is only one
copy of class loaded into perm gen area.
At last - What other way I should think about?

No comments:

Post a Comment