We currently are having performance issues with grails. It is taking about 10 seconds to load one of our main pages. I checked and saw that our grails app was starting up with 512 memory. We currently can use up to 3.5 gigs worth of ram.
I tried exporting the following:
export JAVA_OPTS="-XX:MaxPermSize=1024m -Xmx1024M -server"
After checking how it started up it seems as if it still started with the 512m setting. Where is this set?
Csaba's answer is not accurate.
You don't need to tweak the startGrails script. This is something dangerous since the next time you will upgrade Grails, you will lose your configuration. I am not even talking about an environment that should be the same among multiple developers!
The solution is quite simple :
GRAILS_OPTS="-XX:MaxPermSize=1024m -Xmx1024M -server"
JAVA_OPTS
I assume you use Linux or some other unix variant.
Unfortunately it seems that (at least in Grails 1.1.1) the $GRAILS_HOME/bin/startGrails
directly set a -Xmx512m
value in JAVA_OPTS
(on Windows, the startGrails.bat
only set this if you do not provide your own value - I wonder why the unix script behaves different). It seems that the only way currently is to override this setting in startGrails
.
Note that the above only true for development. If you deploy a war to an application server the memory settings in the server startup script will be used.
Update 2010.07.30: as fabian7474 wrote, from Grails 1.2.2 you can use GRAILS_OPTS
to specify vm parameters and now it is the recommended way.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With