File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Groovy and the fly likes Grails memory usage Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » Groovy
Bookmark "Grails memory usage" Watch "Grails memory usage" New topic

Grails memory usage

Peter Johnson

Joined: May 14, 2008
Posts: 5852

One of the things I have noticed playing around with Grails is that it uses quite quite a bit of heap memory and permgen space. Does your book cover any hints or tips on reducing the memory footprint of a Grails app?

JBoss In Action
Jon Dickinson
Ranch Hand

Joined: Feb 24, 2009
Posts: 45
Hi Peter,

My book does not specifically cover this. Although my first thoughts are that there two potential causes of high memory usage.

1) The large number of frameworks that Grails builds on. It uses Hibernate and Spring under the hood so loading all of these classes is going to take up some memory. For single web applications deployed to a Tomcat server this will probably not cause issues, so long as you give the server a realistic amount of memory (512M). Deployments that require a number of Grails applications to run under one Tomcat instance may want to look at packaging the applications so they can share Spring and Hibernate libraries. This is not covered in the book.

2) Application design. If the domain objects are implemented to perform eager fetching on their relationships then you could experience memory problems as too much data is loaded on every request to the database. This is covered in the book when I talk about n+1 query performance problems.


Jon Dickinson
Accolade Consulting
Grails 1.1 Web Application Development
I agree. Here's the link:
subject: Grails memory usage
It's not a secret anymore!