Streaming PDF, measuring response timing

  • Thread starter Thread starter Ron
  • Start date Start date
R

Ron

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();
 
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 reply

Just so I understand then, when this code finishes, the data could still be
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)


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();
.
 
Back
Top