Re: Response.Flush: Differences between IIS 6.0 and 5.0?

From: David Wang [Msft] (someone_at_online.microsoft.com)
Date: 09/20/04


Date: Mon, 20 Sep 2004 04:18:02 -0700

I can check on the behavior with the ASP/HTTP.SYS team.

I actually think that IIS6 does not violate your following statement:
"In other words, I do not expect my ASP script to continue running until the
entire response buffer has been sent to the client."

ASP did send the entire response buffer to the client prior to continuing
running. You are expecting ASP to wait until the client has ACK'd the
receipt of the response -- something quite impractical for a network
application. The important thing is that ASP maintains the integrity of the
network packet order -- but you can never make any assumptions about
networking timing.

The networking stack used by IIS6 (HTTP.SYS) is radically different than
IIS5 (Winsock), so differences are likely and may not be reconciled
depending on how serious they are.

-- 
//David
IIS
This posting is provided "AS IS" with no warranties, and confers no rights.
//
"Anthony Marchesini" <Arm07470@newsgroup.nospam> wrote in message
news:%235hus1mnEHA.3464@tk2msftngp13.phx.gbl...
It has always been my expectation and observation that Response.Flush is a
synchronous operation.  In other words, I do not expect my ASP script to
continue running until the entire response buffer has been sent to the
client.
It appears that this is no longer the case under IIS 6.0.  Here's an ASP
page that I created to document this unexpected (and, for my application,
undesirable) behavior:
<%
With Response
 'Buffer 1 MB of HTML output
 .Buffer = True
 .Write "<html><body><!--" & String(1048559, "-") & ">"
 'See how long it takes to Flush to the browser
 StartTime = Timer()
 .Flush
 StopTime = Timer()
 'Output result
 .Write "Flush took "
 .Write FormatNumber(StopTime - StartTime, 3, -1)
 .Write " seconds to send 1 MB to the browser.</body></html>"
 .End
End With
%>
Browsing to this ASP page hosted on an IIS 5.0 server yield the following
output in the browser:
   Flush took 5.938 seconds to send 1 MB to the browser.
With the following response headers:
   HTTP/1.1 200 OK
   Server: Microsoft-IIS/5.0
   Date: Sun, 19 Sep 2004 16:29:27 GMT
   X-Powered-By: ASP.NET
   Connection: close
   Content-Type: text/html
   Cache-control: private
Hosted on an IIS 6.0 server, I get this output in the browser:
   Flush took 0.016 seconds to send 1 MB to the browser.
With the following response headers:
   HTTP/1.1 200 OK
   Connection: close
   Date: Sun, 19 Sep 2004 16:31:22 GMT
   Server: Microsoft-IIS/6.0
   MicrosoftOfficeWebServer: 5.0_Pub
   X-Powered-By: ASP.NET
   Content-Type: text/html
   Cache-control: private
The headers don't seem to reveal anything interesting.  I have included them
just to prove that there's no transfer encoding or compression going on that
would explain the different results from the two servers.
The interesting result is that Flush took almost no time to execute on IIS
6.0 and it took nearly 6 seconds on IIS 5.0.  The 6 second result is
expected if Flush is a synchronous operation since that's about how long it
took to receive the page in my browser from both of the servers.  The only
explanation for the 0 second result on the 6.0 server is that Response.Flush
is behaving asynchronously on that server.
While I'm sure that asynchronous flushes would be desirable for many
applications, it is highly undesirable for mine.  I won't make this post any
longer explaining why (unless someone really wants to know), just trust that
I have a good reason.
All of this boils down to two questions:
   1) Is this change in behavior documented and expected?
   2) Is there a way to get the old behavior back?
- Anthony Marchesini


Relevant Pages

  • Re: html servlet flow
    ... A browsers' request is always an absolute path, ... Imagine for example, that the browser requests for the url '/random', and the webserver recognizes this as a special address which doesn't actually point to a file, but instead indicates that the server should generate a random 32-bit integer and send its decimal string representation as a response. ...
    (comp.lang.java.programmer)
  • w3wp.exe 100% CPU
    ... I'm developing my website with asp with IIS and 2003 server. ... did some test after editing my asp script, my browser just took forever to ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: request.setAttribute(...) versus session.setAttribute(...)
    ... Browser makes HTTP request for document associated with the link's URL ... Server prepares and sends a response, ...
    (comp.lang.java.programmer)
  • Re: HTTP header processing sequence
    ... HTTPWatch is doing that, not the browser. ... The browser issues a GET waits for response (no more GETs till it gets that ... server from the client. ... Initially it sends the request for the html ...
    (microsoft.public.win32.programmer.networks)
  • Re: HTTP header processing sequence
    ... Initially it sends the request for the html source, and if there are any more objects to request it does so, and then wait for the server to reply sending back the requested data using appropriate headers. ... How does the (browser) client know how to match up multiple received responses from the server with GET-requests, as this does not appear to be sequential. ... So the association of request and response is no problem. ...
    (microsoft.public.win32.programmer.networks)