speeding up Grails (Part 1 — High level Profiling)

Meni Lubetkin
Meni Lubetkin
Published in
2 min readOct 17, 2011

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.

….

--

--