JVM Memory usage

During development of a J2EE application at my current employer I came across OutOfMemoryExceptions in the permGen space. The first thing we thought was that it was a memory leak in one of the applications where it occurred. After further investigation it seemed to be that we were pushing the limits of the JVM.

The big problem was that we had 3 EAR files deployed on a JBoss server that by itself already uses a lot of memory. Deploying so many EAR files in 1 JBoss instance is definitely not recommended when using the default JVM configuration. If you crank up the JVM max perm gen space than it is possible to have such a configuration. But keep in mind that if you crank up the permGen space other parts of the JVM memory have less. A better solution is trying to integrate your applications if possible so the common libraries are not loaded multiple times. If this is not possible try to deploy them on separate servers or undeploy some of the default applications of JBoss to save memory.

So when building web applications always make sure if it's really necessary to divide them into separate EAR files. Also check your memory usage of the application before releasing it live so you can prevent such problems.

Comments

Popular posts from this blog

Fastest XML parser

Tomcat behind Apache HTTP server using Spring Security

Cargo-itest open source project