2

GSP rendering in our Grails application is very slow

We tried to isolate the issue using JavaMelody, the mean time to render gsp is 16,083ms which is way too slow.

So i'm sure the rendering of GSP is the main problem.

Any suggestions?

HalaKuwatly
  • 181
  • 1
  • 2
  • 8
  • 4
    GSPs get compiled once. Typically when you package the WAR. What you need to look at is what is going on in your GSP. Do you have a lot of logic in there? Move it out to a controller. Is it doing lots of loops? Optimize your data structures. Without you posting a sample GSP it's hard to say what the issue is. – Joshua Moore Jun 04 '14 at 17:06

1 Answers1

3

GSP is actually very fast and comparable in speed to most rendering technologies. If you are having speed issues it is normally down to the complexity of your page and / or tag libraries.

Consider what tag libraries you are using, whether you are using excessive numbers of includes/templates and also profile if you are lazy loading data in your view. If you have an n+1 problem with lazy loaded data you could be executing a lot of queries during view rendering which slows things down massively.

Graeme Rocher
  • 7,985
  • 2
  • 26
  • 37