It's a familiar old problem but I really want to put it to bed once and for all! I've got the following JVM flags set:
-XX:+CMSClassUnloadingEnabled
-XX:+CMSPermGenSweepingEnabled -Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=true
but I still observe the permgen usage notch up by a good 50MBs for every deployment cycle. I'm deploying remotely using the Tomcat manager application, and Grails is in production mode.
If it gets too full then a kill -9
is necessary!
I might try using JRockit but nor now it's not an option. I don't really find it acceptable in a production environment to have to bounce the whole container every once in a while.
Permgen leakage is an issue no matter what appserver you're on when using grails is my experience (highly personal and probably easily contendable anecdote, just to be clear on that ;) ).
If this is the only app you have deployed, why not just shutdown.sh, delete webapp folder, put in war and then startup.sh ?
It's the way we go and the redeployment only gains about 7 seconds (where 5 of those are a sleep 5
to ensure catalina is fully shutdown before it goes back up).
Edit:
Having one tomcat instance per app is pretty cool anyways in my opinion!