Ben, I won't claim that I know that much more about server internals, but I do know that the web server doesn't just send the entire response (which could be megs in size) out into the Internet and hope the end computer actually receives it. How would that handle lost or corrupt packets?
If you have ever used SeeFusion, you will see it has a "time to first byte" number. Ignoring use of the cfflush tag, if a web page being processed has a TTFB value of 500 ms but the total page time was 10 seconds, that tells you that CF finished its work in half a second, and the first byte of the response went out to the client after half a second. It also tells you the client took 9.5 seconds to finish receiving the response. The client's connection speed is usually at fault. What that tells us though, is that the web server "knows" that the client is still receiving the data, and it re-sends any packets that weren't received correctly. (Once received, all the packets are reassembled on the client to form the entire response) To prove this, download a packet analyzer like WireShark (used to be Ethereal) and hit a web page while capturing. Filter on that TCP stream, and you will see the request headers, and response headers/body. Go back and look at each TCP packet to be sent, and after the initial HTTP GET request, you will see a series of packets coming back from the remote server, after every few packets, you will see an "HTTP [ACK]" begin sent from your computer back to the server basically saying "Hey, I got it!" This conversation of "here you go" and "hey, I got it" continues until the entire HTTP response has been transferred to the client. The final packet has a "FIN" flag which is also acknowledged that states that was the end of the packets. To my knowledge, all of this happens at a pretty low level after your CF code has finished processing. The Java thread is still in use though while the data is being read out of the servlet response's buffer. If the client does not respond, I think the server tries sending response packets (which will get no reply) until it finally gives up after a period of time. If the user closes their browser while the page is still being processed, the server wouldn't know until it finished, and tried to start sending the response. If the user closes their browser while it is still receiving the response, I think the server would stop getting acknowledgments and would eventually time out and give up. In either case, the entire page (and all it's queries, etc) still get processed. Here's a good page on the subject: http://tldp.org/HOWTO/Unix-and-Internet-Fundamentals-HOWTO/internet.html ~Brad -------- Original Message -------- Subject: Re: client holding open a connection From: Ben Nadel <b...@bennadel.com> Date: Mon, June 15, 2009 7:54 am To: cf-talk <cf-talk@houseoffusion.com> Funky stuff. I always just assumed that the server sends off the content and then closes the response regardless of what the client is doing (otherwise, how would the server know if the client closed the page half way through page load). ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:323518 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4