views:

41

answers:

2

Hi

I run some test to keep track of response time of a grails app.

I use the layout-view framework of grails in this way:

In a controller I determine what view and layout to use

Then I render a genericView with a code like this:

So this genericView do all the magic.

I create a Performance filter that track how much time takes between afterController and beforeController (controller time) and between beforeController and renderView ( view Time).

In a layout I have a lots of <g:pageProperty name=""> tags and in the view I have the same number in <content tag=".."> that nested includes <g:include controller="..."/>.

This works perfectly and it gives me the posibility to reuse layouts (as dispositions of html parts) and views (mappings between dispositions and real content).

When I take the mean in the view time it takes something like 35 milliseconds to do all the includes.

I think that is a lot.

Do you know any other useful alternatives to the grails framework to include and ensamble the view when it renders?

Or maybe I have to use the framework in a better way?

EDIT: I just note that the time is spend in <g:include controller="..."/>.

I include 4 controller in a view. The controller and actions included only have a render "something" And the times are like this:

main controller: controller time: 3.98 view time: 43.87

Others controllers (included in the main view): total: 15.55

So 4 include view takes kind of 28.32 milliseconds to run!

Any pointer would help.

Thanks in advance.

+1  A: 

Groovy and Grails definitely have some performance issues, but in general they're negligible since the database and network latency usually make up the majority of the request time. So I was curious when I saw this question and expected scary numbers. 35 milliseconds is very fast. I think you have much more important things to worry about.

Burt Beckwith
35 milliseconds IS very fast but this test is very simplistic. I also have kind of 20 to 30 includes. And several of those controllers consume different REST services. So I have to reduce all the time that I can. 29 milliseconds to assemble already renderer views, or to prepare the ejecution of controller actions it seems to me a strange spending of time.
damian
A: 

With my limited grails development your performance appears to be standard and nothing out of the ordinary. I believe this is a case of premature optimization. What hard performance goals do you have, are you writing an application that requires response time to fall within a certain value? Have you compared any other model view controller frameworks and development tools such as Spring Roo to see how there performance compares and where they spend there time? With out more information on your application it’s difficult to say where your bottlenecks will be, but I would assume any performance issues you run into will be more likely to happen with your REST services or database access. Those would probably be the areas you would want to focus on first. Using Hibernate cash or cashing results of your REST calls where ever possible would probably help.

Jared
The application is way advanced right now. Is not premature optimization. And for the same reason I can't change the MVC framework right now. What I can do is (if is not a big effort) to change the way I include controllers in views. And the others areas (REST) are cobert by caching methods.
damian