Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Streaming PDF, measuring response timing

3 views
Skip to first unread message

Ron

unread,
Nov 21, 2009, 6:50:01 AM11/21/09
to
Dear all

I have an asp.net application that streams PDFs to the browser in 64kb
chunks, looping through until all the PDF is streamed out. Here's a few lines
to help you get the picture (at bottom of this post)

My question is that I'm going to measure the time that this code takes to
run and log it to see how things are performing. However, what will this
measurement actually be representing?

a) The time it takes for the whole data of the PDF to reach the client.
b) same as a) but additional time it takes for the Adobe Reader to load and
display (which is usually slow)
c) Something else, i'm missing the point?

Any help of thoughts greatly appreciated here! Thanks all.

ps. if the answer is b) is it actually possible to measure a)?


Response.Clear();
Response.Buffer = true;
Response.ContentType = "application/pdf";
Response.AddHeader("content-length", System.Convert.ToString(document.Size));
Response.AddHeader("Accept-Header", System.Convert.ToString(document.Size));

byte[] buffer = new byte[documentStreamer.BlobBufferSize];

while ((buffer = documentStreamer.StreamBytes()).Length != 0)
{
//Write straight back to browser....
Response.OutputStream.Write(buffer, 0, buffer.Length);
Response.Flush();
}
documentStreamer.Close();
Response.End();

bruce barker

unread,
Nov 21, 2009, 2:39:36 PM11/21/09
to

asp.net runs in a separate process from iis, and talks via a named pipe
to iis. you will measure how long it takes IIS to accept the data.
depending on how much IIS buffers, how much the internet buffers, how
much the proxies buffer, how much the firewalls buffer, etc will
introduce a difference between your measurement and what the browser sees.


-- bruce (sqlwork.com)

Ron

unread,
Nov 22, 2009, 2:36:01 PM11/22/09
to

Hi Bruce, thanks for taking the time to reply

Just so I understand then, when this code finishes, the data could still be
on its way to the client and the PDF may not actually be visible yet?

"bruce barker" wrote:

> .
>

Andrew Morton

unread,
Nov 23, 2009, 5:55:53 AM11/23/09
to
It seems to me that using Fiddler and/or the time-taken field in the IIS log
files may give you the statistic you're looking for.

Notes on time-taken:
http://blog.jonathanroussel.com/2009/03/iis-5-and-6-time-taken-information.html

Fiddler:
http://www.fiddler2.com/fiddler2/

To see if the Adobe Reader plugin is being slow, you could try a different
one, like Foxit Reader.

Andrew


Mark Rae [MVP]

unread,
Nov 23, 2009, 6:42:20 AM11/23/09
to
"Andrew Morton" <a...@in-press.co.uk.invalid> wrote in message
news:7mv829F...@mid.individual.net...

> To see if the Adobe Reader plugin is being slow, you could try a different
> one, like Foxit Reader.

That's an excellent suggestion, IMO.

The Foxit reader outperforms the Adobe reader many times over, has virtually
none of the Adobe "bloat", and supports an MDI interface:
http://www.foxitsoftware.com/downloads/index.php


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Ron

unread,
Nov 23, 2009, 12:35:02 PM11/23/09
to
Nice one gentlemen

"Mark Rae [MVP]" wrote:

> .
>

0 new messages