What are your tricks / resources for performance tuning a grails app?
I'm developing my first serious grails application, and got the basic functionality to work, so now I'd like to make it go faster. There are some operations that should not take very long but do, and an one that I know can never be fast, but which takes too long even when I reduce its scope to the bare minimum.
I've enabled the hibernate cache and made all relations load eagerly (which should be better since the total amount of data is quite small), but this has had no noticeable effect.
I've tried to profile, but I need something more fine-grained than the grails profiler plugin and could get neither eclipse TPTP nor VisualVM to work. With the former I am not surprised since it's always been a godawfully overengineered mess, while VisualVM requires on-the-fly instrumentation that doesn't seem to work with Groovy.
So what can I do besides playing guessing games?
Edit: I ended up doing "printf-profiling" and found that most of the time was spent in 2 or 3 innocent lines of code that did some very simple calculations. Yeah, they were run a lot, but the same methods contained much more complex operations that were run just as much. The killer seems to have been division operations involving Groovy's implicit conversions to BigDecimal
. After extracting those calculations into static Java methods that use float
exclusively, execution times were down by 90%.
I'm still looking for a way to use a real profiler though, since that would have saved me hours of work narrowing down where to put manual timings while repeatedly restarting grails (slow) and running the operations in question (very slow - that's why asked this question after all).