Friday, December 18, 2009

Speed up Grails in local environment

Typical error received in Grails:-
Running Grails application..
loading security config ...
2009-07-07 12:10:12,224 [main] ERROR plugins.DefaultGrailsPluginManager - Error configuring dynamic methods for plugin [validation:1.1.1]: java.lang.OutOfMemoryError: Java heap space
org.codehaus.groovy.runtime.InvokerInvocationException: java.lang.OutOfMemoryError: Java heap space
at _GrailsBootstrap_groovy$_run_closure2_closure13.doCall(_GrailsBootstrap_groovy:86)
at _GrailsBootstrap_groovy$_run_closure2_closure13.doCall(_GrailsBootstrap_groovy)
at _GrailsSettings_groovy$_run_closure10.doCall(_GrailsSettings_groovy:274)


Grails can seem very slow in development mode, with pages taking more than a second to load. If this applies to you, then try increasing the maximum heap size by setting the

JAVA_OPTS

environment variable to something like this: '-Xmx512m' - this will set the maximum heap size to 512Mb when running Grails and should result in a noticeable improvement in response times.

As a workaround you can edit startGrails.bat and unconditionally put -Xmx to
JAVA_OPTS (search for related lines).

set JAVA_OPTS=%JAVA_OPTS% -Xms512m -Xmx512m -XX:MaxPermSize=1024m

in reference to:

"Grails can seem very slow in development mode, with pages taking more than a second to load. If this applies to you, then try increasing the maximum heap size by setting the JAVA_OPTS environment variable to something like this: '-Xmx512m' - this will set the maximum heap size to 512Mb when running Grails and should result in a noticeable improvement in response times."
- Grails - Quick Start (view on Google Sidewiki)

No comments:

Post a Comment

Thank you for your feedback