简体   繁体   中英

Redeploying a Grails App using Jenkins on Tomcat fills PermGen Space

Currently we are having various problems with the deployment of our Grails application on Tomcat 6, mainly it's about memory usage issues and redeployment via Jenkins.

The Application eats more and more memory, and we tried to resolve this with CMSPermGenSweepingEnabled (we are using UseConcMarkSweepGC), so now the temporary classes used by Groovy should get cleaned up.

What still is a problem is that on each Redeploy (with jenkins) the app needs around 150 mb of additional Permgen space ... any idea how to avoid this?

We are using Grail 1.3.7, and our current configuration flags are

-Djava.util.logging.config.file=/var/lib/tomcat6/conf/logging.properties
-Djava.awt.headless=true
-Xms2048M
-Xmx2048M
-XX:MaxPermSize=1024m
-XX:PermSize=1024m
-XX:+CMSClassUnloadingEnabled
-XX:+CMSPermGenSweepingEnabled
-XX:+UseConcMarkSweepGC
-Djava.net.preferIPv4Stack=true
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.endorsed.dirs=/usr/share/tomcat6/endorsed
-Dcatalina.base=/var/lib/tomcat6
-Dcatalina.home=/usr/share/tomcat6
-Djava.io.tmpdir=/tmp/tomcat6-tmp

It's very popular tomcat issue , they even have some recommendations: http://wiki.apache.org/tomcat/OutOfMemory , but at most cases it's works only for small or fully controlled project (mean 'project without any external library'). All solid projects I ever seen fails under tomcat with this error :(

My recomendation - restart Tomcat instance after deploy.

We've experienced similar issues with our Grails applications on Tomcat. Our solution is the same as what Igor suggests, restart Tomcat after a deploy.

We have two production servers setup in a cluster so they share sessions. We take one server down, undeploy the application, restart tomcat, deploy the new version of the application, and bring that server back up. Then repeat the process on the other server. So far this is working for us.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM