firnnauriel
firnnauriel

Reputation: 2063

How to show page generation stats in Grails

Aside from adding a custom timer to measure the beginning and end of a controller's action, is there an easier or more helpful way to show how long a page is really loaded (i.e. show at the bottom of the page: this page is generated in 30.5 seconds)? Note that in Grails, there's the concept of taglibs wherein you can add additional logic after all the processing done in the controller.

I'm actually not yet sure on how controller and taglib works or how the whole page is rendered in Grails, perhaps they are processed in parallel? Feel free to enlighten me on this too.

Thanks!

Upvotes: 5

Views: 704

Answers (4)

deluan
deluan

Reputation: 1865

If you just want the times spent on the action and to render your gsp (with all its tags), you can use a simple filter to measure that. Take a look at this blogpost: Profiling web requests in your Grails application (disclaimer: I'm the author)

Regards, Deluan

Upvotes: 4

Grooveek
Grooveek

Reputation: 10094

I used Spring Insight with STS. That's absolutely awesome for Grails Application in developpement. Modifying a tomcat for use in poroduction make it a bit tricky though

But you can go down to the duration of each select from hibernate and you have timing metric in real time through the all stack of application

Upvotes: 2

tim_yates
tim_yates

Reputation: 171184

Not really what you asked for (sorry), but maybe of interest is the JavaMelody plugin for Grails:

The goal of JavaMelody is 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.

Not tried it myself, but it looks useful

Upvotes: 1

rdmueller
rdmueller

Reputation: 11062

there are several ways to get the timing.

  • Easiest way is to configure your server to write logs with page generation time
  • you could inject your timing into for instance a security filter and the end of your page - but as you already mentioned, even this would mean to reinvent the wheel
  • have you checked the plugins?

but if you want to present the timing to your users, I would suggest to download the debug plugin, unzip it and check where the timing is measured. You can easily copy this code and use it to output the timing on the page.

Upvotes: 2

Related Questions