views:

352

answers:

3

My Grails application is running in a development environment. I still didn't go into production, but in any case, is it normal that my Grails application is requiring 230 MB at startup only (with an empty bootstrap and no request handled so far)?

Do you know why this is the case, how to improve memory usage in development mode and, most important, whether it is reduced in production environment?

A: 

I wouldn't blame all that memory usage just on Grails. Because it uses an embedded Tomcat (Jetty in older versions) there will be a decent amount of overhead even when running an empty application.

IMO, 230MB is a lot of memory use for a Java application. High memory usage is just part of life when writing jvm based applications.

leebutts
A: 

My online Grails applications run in a VPS with only 512MB (which includes a Drupal CMS, Apache, the email services, ... and the Tomcat to run GRails) so you can definitely tune your application to use less memory

Jordi Cabot
That is what it seems to me. But how to tune it?
fabien7474
I'm not an expert but, as a first solution, have you tried to limit the amount of memory for tomcat, maybe it is taking a lot of memory by default and it is not a problem of your specific application
Jordi Cabot
+1  A: 

To answer your questions, yes - it is normal. It's especially normal if you have a lot GSPs in your application. GSPs are runtime compiled so you can speed up their generation by increasing your permgen space.

You can improve memory use and performance in general by making sure that you are passing the '-server' flag when you load your server JVM.

Brandon
Thx for you answer. What is the -server flag?
fabien7474
Java has two virtual machines that you can use. The client is the default. The server comes with the JDK. Check to see if you have it installed with 'java -version -server'. The server runs faster but takes longer to start and uses more memory. Check out http://hubpages.com/hub/Using_the_Server_JVM for some info on how to make it your default.
Brandon