This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Languages » Groovy
Bookmark "Grails memory usage" Watch "Grails memory usage" New topic
Author

Grails memory usage

Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

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
Author
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.

Cheers,
Jon.


Jon Dickinson
Accolade Consulting
Grails 1.1 Web Application Development
 
Consider Paul's rocket mass heater.
 
subject: Grails memory usage
 
Similar Threads
What do you think about the following review of grails at ohloh?
Does it exist Admin Automatica Panel Like Django on Java????
Grails for prototyping and enterprise applications
Grails weak points
java.lang.OutOfMemoryError: Java heap space