Pergunta

I often see High Perm Gen in my java(web) application.

jmap command, often shows it is 90% used. But it does not seem to cause any problems to my application. My overall Heap Usage is quite low (about 400 MB, where max memory is set to 2048 MB).

The Team that manages the Application in Production, is concerned that PermGen is High. And often all sorts of problems are attributed to it.

Question:
(1) Do i need to be worried just becz PermGen is High, Wouldn't PermGen come down when Garbage Collection happens?
(2) Should i double the max PermGen Size (current is 200 MB), would there be any side effect of that?

Foi útil?

Solução

(1) Do i need to be worried just becz PermGen is High, Wouldn't PermGen come down when Garbage Collection happens?

Nope. PermGen is the space reserved for loading class information. It cannot be garbage collected unless say a web container un-deploys a WAR file and the classes are not needed anymore.

(2) Should i double the max PermGen Size (current is 200 MB), would there be any side effect of that?

The first obvious side effect is that the JVM would use more RAM. Make sure the physical RAM allocated to the machine is sufficient. BIRT is an example of an app that fails quite quickly due to permgen space although there is no leak. Secondly I would also investigate if there a leak in your permgen. Increasing your permgen as a precautionary step is fine, but it may not help the application in the longer run if there is a memory leak.

A leaking driver for example can lead to more permgen usage. A good litmus test is to repeatedly hot-deploy your application and check for changes to the permgen. Does it keep increasing until you run out of memory ? Then you have a leak.

Outras dicas

You have three things to worry about: heap, perm gen, and total resident memory.

You don't need to worry about perm gen until you run out of it. Try increasing the value.

The side effect is more RAM consumed. Your statistics suggest that you could use more perm gen and smaller max heap.

Your real concern shouldn't be point in time values. Since this is a web app, you need to watch heap, perm gen, and total resident memory and see how they evolve over time.

You've got a nice app if the GC keeps everything under control and the server can handle typical and peak loads. If it grows over time, you might need to worry about a memory leak.

Which app server are you deployed on? That matters a great deal. A Tomcat app will be much lighter on total resident memory than a full-blown Java EE app server.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top