speeding up Grails (Part 1 – High level Profiling)

our first step will be to do “profiling”  of our application.

Peter Ledbrook mention on his presentation (see the previous post) ,

things can be slow in each part of our application:

  • DB access
  • our business logic processing
  • network latency
  • UI (html, java script, Ajax calls)

usually we have some sense where things are not going well. so the best way  is to make a prioritizes list of our actions/system flows where we see  problem and also list our most used actions as well.

but first let as get help using the JavaMelody plugin. the JavaMelody is “a tool to monitor Java or Java EE application servers in QA and production environments. It is not a tool to simulate requests from users, it is a tool to measure and calculate statistics on real operation of an application depending on the usage of the application by users.” (javaMelody introduction)

in Grails application we can get information about the database, spring beans works and views rendering (jsp). please note that we can use this tool not only for our performance improvement but also in the production environment. the JavaMelody is collection all the data and can give as a statistical reports in html/PDF or even by mail for each period.

grails install-plugin grails-melody

A few things you might want to know: (from the plugin page)

  • grails-melody plugin overwrite original grails ‘dataSource’ bean in spring context with a JavaMelody datasource proxy.
  • grails-melody plugin use groovy meta programming to intercept grails services method calls.

The plugin copies a GrailsMelodyConfig.groovy file into your project’s grails-app/conf directory. there you can change some of the plugin configuration options.

to see the JavaMelody view you need to use the monitoring action

http://localhost:8080/<YourContext>/monitoring/

the melody provides as a lot of information in a few ways:

Charts  ( with zoom-in option)

statistic of http requests

the next step is to generate the statistical data by running our application. we can do it of course manually, or using  our functional tests  ( if we have…) or using automation tools for functional behavior testing like JMeter  or Selenium .

i’ll refer to those tools in my following posts.

for now we have a lot of information we can get, using the JavaMelody.

….

speeding up Grails (Grails performance tuning)

I just start a performance tuning project for a Grails application that is production for more then 2 years. during this time we did some work and also upgrade the Groovy/Grails version. the current version is the latest 1.3.7

As a starting point i want to share a Spring webcast by Peter Ledbrook i attend a few month ago.

this going to give you some idea of the things we need to do and check. Spring are using their tools for the mission – i’ll use other open source tools as well…

this is the first post of a series of posts about the Groovy & Grails performance issue.