By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,786 Members | 1,142 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,786 IT Pros & Developers. It's quick & easy.

Page rendered in X seconds?

P: n/a
hi,
i would like to display a discreet message on all my pages indicating how
long the server took to render the page. full tracing is not an option
because it would freak out my non-technical users!
i've looked around online and can find nothing to do this, or in the SDK
docs. i thought .Net 2.0 would have something more out-of-the-box for this
type of performance measuring but i can't find any.

i was thinking about running a timer with Application_BeginRequest and
EndRequest but that seems a little crude given that a portion of requests
will not be able to have their response stream written to, e.g. for
downloading binary files etc.
another approach is to start a timer in Page_PreInit and then end the timer
in Page_PreRender, writing it out to a label etc. But this is missing any
delay from the Unload method, is this negligable?

thanks in advance
tim
Oct 31 '06 #1
Share this Question
Share on Google+
10 Replies


P: n/a
PreInit/PreRender is ur best bet...you'll miss out on Unload, but you'll
have too since it's too late to write to the page at that point...You're
talking about millisenconds..if that..(unless you are doing some crazy stuff
in there, but my guess is that you aren't doing anything at all).

Karl
--
http://www.openmymind.net/
http://www.codebetter.com/
"Tim_Mac" <ti********@community.nospamwrote in message
news:uU**************@TK2MSFTNGP05.phx.gbl...
hi,
i would like to display a discreet message on all my pages indicating how
long the server took to render the page. full tracing is not an option
because it would freak out my non-technical users!
i've looked around online and can find nothing to do this, or in the SDK
docs. i thought .Net 2.0 would have something more out-of-the-box for
this type of performance measuring but i can't find any.

i was thinking about running a timer with Application_BeginRequest and
EndRequest but that seems a little crude given that a portion of requests
will not be able to have their response stream written to, e.g. for
downloading binary files etc.
another approach is to start a timer in Page_PreInit and then end the
timer in Page_PreRender, writing it out to a label etc. But this is
missing any delay from the Unload method, is this negligable?

thanks in advance
tim

Oct 31 '06 #2

P: n/a
Thanks for Karl's input.

Hi Tim,

As for the " indicating how long the server took to render the page" you
mentioned, do you mean the time the ASP.NET page hander process the page's
request (load post data , handle postback events....) or the time the
runtime render out the page into response stream?

If what you want is get the time server handler process page request, I
think it ok to use the PreInit and PreRender event pair to do the
calculation since at that time all the main processing has been finished.
And as for the UnLoad event, you do not need to worry about it, because
Unload is called at the page instance's dispose time which is not guarantee
to be immediately after page's rendering, so the delay in Unload should not
be countered into page request's processing time.

In addition, though PreInit/PreRender pair can get the most page request
processing time, if you want to handle the complete time, the best choice
should be use a custom httpmodule and use the HttpApplication pipeline
events to caculate the time. The "PreRequestHandlerExecute" and
"PostRequestHandlerExecute" events are the ones that fires before and after
page handler process the request.

#ASP.NET Application Life Cycle Overview
http://msdn2.microsoft.com/en-us/library/ms178473.aspx

http://support.microsoft.com/kb/307985/en-us

However, the limitation of using custom httphandler and pipeline event is
that we can not access the control in page structure like in Page's code,
but can only write content into current request's response stream.
Please feel free to post here if you have any other consideration or ideas.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 1 '06 #3

P: n/a
hi Steven,
thanks for your answer. i have tried it out so far with the preinit and
preRender event pair and it seems to provide a good indication. i like the
ability to write directly to page controls, rather than trying to inject
some HTML at the right point in the document via a HttpHandler.

i have some users who occassionally complain that my web application is
running slow, but i am 99.99% sure that the problem is their own company
LAN, which shares a single broadband connection. it is difficult to keep
re-assuring them that nothing is wrong with my app, so hopefully i can use
this load-time indicator to help them see if the problem is actually with
the server or their own connection.

i'm confident that the application is well written and performing very
responsively all the time, so i'm hopeful this will get the users to leave
me alone :)

many thanks again
tim

"Steven Cheng[MSFT]" <st*****@online.microsoft.comwrote in message
news:9p**************@TK2MSFTNGXA01.phx.gbl...
Thanks for Karl's input.

Hi Tim,

As for the " indicating how long the server took to render the page" you
mentioned, do you mean the time the ASP.NET page hander process the page's
request (load post data , handle postback events....) or the time the
runtime render out the page into response stream?

If what you want is get the time server handler process page request, I
think it ok to use the PreInit and PreRender event pair to do the
calculation since at that time all the main processing has been finished.
And as for the UnLoad event, you do not need to worry about it, because
Unload is called at the page instance's dispose time which is not
guarantee
to be immediately after page's rendering, so the delay in Unload should
not
be countered into page request's processing time.

In addition, though PreInit/PreRender pair can get the most page request
processing time, if you want to handle the complete time, the best choice
should be use a custom httpmodule and use the HttpApplication pipeline
events to caculate the time. The "PreRequestHandlerExecute" and
"PostRequestHandlerExecute" events are the ones that fires before and
after
page handler process the request.

#ASP.NET Application Life Cycle Overview
http://msdn2.microsoft.com/en-us/library/ms178473.aspx

http://support.microsoft.com/kb/307985/en-us

However, the limitation of using custom httphandler and pipeline event is
that we can not access the control in page structure like in Page's code,
but can only write content into current request's response stream.
Please feel free to post here if you have any other consideration or
ideas.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================

This posting is provided "AS IS" with no warranties, and confers no
rights.

Nov 1 '06 #4

P: n/a
Thanks for your reply Tim,

Well, now I get that why you need to add this info in each of your pages
:-).

BTW, I suggest you also check the average size (response content size) of
your pages, when the page's output size is large, the rendering time (flush
response content to client) can not be omited. Also, if you feel
necessary, you can even build a dedicated report to display the total
processing time of each page(through a custom httpmodule and use the
application events to hook the time).

Anyway, please feel free to post here if you need any further help or if
you get any progress.

Have a good day!

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 2 '06 #5

P: n/a
hi Steven,
thanks for the extra tip about the render phase. i do have some large
pages, upwards of 100Kb displaying a few hundred records in datagrids. i
have viewstate turned off which helps a lot, paging is not an option because
some of my user population are at the extreme novice end of the spectrum,
i.e. clicking next/previous could be a challenge!

do you know how i could factor in the Render time without going down the
HttpModule route, which i understand loses direct access to the page
controls.

thanks
tim

"Steven Cheng[MSFT]" <st*****@online.microsoft.comwrote in message
news:gg**************@TK2MSFTNGXA01.phx.gbl...
Thanks for your reply Tim,

Well, now I get that why you need to add this info in each of your pages
:-).

BTW, I suggest you also check the average size (response content size) of
your pages, when the page's output size is large, the rendering time
(flush
response content to client) can not be omited. Also, if you feel
necessary, you can even build a dedicated report to display the total
processing time of each page(through a custom httpmodule and use the
application events to hook the time).

Anyway, please feel free to post here if you need any further help or if
you get any progress.

Have a good day!

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no
rights.

Nov 2 '06 #6

P: n/a
Hello Tim,

Thanks for the followup.

As for the render time, I'm afraid we haven't any good means to get it
without use the httpmodule or any other system event which is out of
ASP.NET's page control's lifecycle. This is because the ASP.NET page's
controls are only available during a short period of time which is part of
the page handler's processing time, so we will not be able to record the
render time and set them to Control's properties.

Do you think it possible to create a dedicated report page which always
record and display each page's render time and the client user and visit
them to see the average status?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 3 '06 #7

P: n/a
hi Steven,
i've taken another look at the performance monitoring options and i think
that should cover everything if i need to look for averages and reports etc.

what i have at the moment is at least a good indication of server
load/busyness, even if it is missing the Render stage.

thanks again for your assistance
tim
"Steven Cheng[MSFT]" <st*****@online.microsoft.comwrote in message
news:ft****************@TK2MSFTNGXA01.phx.gbl...
Hello Tim,

Thanks for the followup.

As for the render time, I'm afraid we haven't any good means to get it
without use the httpmodule or any other system event which is out of
ASP.NET's page control's lifecycle. This is because the ASP.NET page's
controls are only available during a short period of time which is part of
the page handler's processing time, so we will not be able to record the
render time and set them to Control's properties.

Do you think it possible to create a dedicated report page which always
record and display each page's render time and the client user and visit
them to see the average status?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no
rights.

Nov 3 '06 #8

P: n/a
Tim_Mac wrote:
hi,
i would like to display a discreet message on all my pages indicating how
long the server took to render the page. full tracing is not an option
because it would freak out my non-technical users!
i've looked around online and can find nothing to do this, or in the SDK
docs. i thought .Net 2.0 would have something more out-of-the-box for this
type of performance measuring but i can't find any.
tim
As the foregoing discussion shows, determining the details
about page download, processing (rendering), and availability
can be tricky.

The eValid solution implements testing from within a full
featured web browser. eVaild uses IE DLLs for page rendering so
internal timings are identical (or extremely close) to what
you would see in IE.

In addition to a stopwatch function, eValid also has
facilities for timing based on when objects appear on the
screen, or when objects are made available in the DOM. There
is also "detailed timing" on how long each page component
takes to download.

You can download your evaluation copy of eValid V6 from:

http://www.e-Valid.com/Products/Down...ml?status=FORM

Full details about the eValid web analysis and testing suite
can be found at:

http://www.e-Valid.com

Nov 3 '06 #9

P: n/a
hi eValid,
sorry i'm not interested in the browser render time, just on the server
side.
interesting product though.
tim
Nov 4 '06 #10

P: n/a
You're welcome.

Please feel free to post here when there is anything we can help.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 6 '06 #11

This discussion thread is closed

Replies have been disabled for this discussion.