Monday, July 14, 2014

Eclipse Ggts and Grails memory settings

I started developing Groovy on Grails application in Eclipse Ggts. I experienced performance issues of Eclipse editor and application written in Groovy on Grails. Once I received following error:
java.lang.OutOfMemoryError: PermGen space

Following settings helped me to increase speed of Ggts and Grails app.

I adjusted settings of Ggts Eclipse ini file, i.e. I open:
C:\sw\ggts-3.5.1.RELEASE\GGTS.ini

and modified following argument to:
--launcher.XXMaxPermSize
512M

and modified following arguments:
-Xms512m
-Xmx2g
-XX:MaxPermSize=1g

and added following lines under list of arguments "-vmargs":
-XX:+UseConcMarkSweepGC
-XX:+CMSClassUnloadingEnabled
-XX:+CMSPermGenSweepingEnabled

Then I adjusted Debug configuration (created before). I open dialog: 
Debug Configurations / Grails / MyProfile / Arguments

and put following settings to VM Arguments:
-server -Xms512m -Xmx2g -XX:PermSize=32m -XX:MaxPermSize=1g -Dfile.encoding=UTF-8 -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC

(src: http://groovy.codehaus.org/Running section Avoiding PermGen out of memory)

This simply increases memory consumption limit, so the Grails application will run smoother.

Other effective settings for VM Arguments:
-server -Xms128M -Xmx2G -XX:PermSize=128m -XX:MaxPermSize=1800m -Dfile.encoding=UTF-8 -XX:SurvivorRatio=128 -XX:MaxTenuringThreshold=0 -XX:+UseTLAB -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:+CMSIncrementalMode -XX:-UseGCOverheadLimit -XX:+ExplicitGCInvokesConcurrent

These settings can be applied to grails-app/conf/BuildConfig.groovy as well.

(src: http://grails.org/plugin/tomcat section Using jvmArgs property)

Additional Tomcat notes ...

Grails - Apache Tomcat - JNDI DataSource settings, i.e. JDBC:
grails-app/conf/Config.groovy
More at http://grails.org/plugin/tomcat

Tomcat Admin user account settings:
C:\tomcat\conf\tomcat-users.xml