Response.OutputStream.Write
(1)
Adobe
(1)
Response.ContentType
(1)
Response.AddHeader
(1)
ASP.NET
(1)
DocumentStreamer.BlobBufferSize
(1)
IIS
(1)
Response.Buffer
(1)

Streaming PDF, measuring response timing

Asked By Ron
21-Nov-09 06:50 AM
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 is a few lines
to help you get the picture (at bottom of this post)

My question is that I am 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();

asp.net runs in a separate process from iis, and talks via a named pipeto iis.

bruce barker replied to Ron
21-Nov-09 02:39 PM
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)

Hi Bruce, thanks for taking the time to replyJust so I understand then, when

Ron replied to bruce barker
22-Nov-09 02:36 PM
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?

It seems to me that using Fiddler and/or the time-taken field in the IIS

Andrew Morton replied to Ron
23-Nov-09 05:55 AM
It seems to me that using Fiddler and/or the time-taken field in the IIS log
files may give you the statistic you are 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
That's an excellent suggestion, IMO.
Mark Rae [MVP] replied to Andrew Morton
23-Nov-09 06:42 AM
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
Nice one gentlemen"Mark Rae [MVP]" wrote:
Ron replied to Mark Rae [MVP]
23-Nov-09 12:35 PM
Nice one gentlemen
Post Question To EggHeadCafe