Performance problem in view framework in Grails
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 grail开发者_JAVA技巧s 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.
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.
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.
精彩评论