Return-Path: Delivered-To: apmail-httpd-dev-archive@www.apache.org Received: (qmail 79698 invoked from network); 4 Aug 2005 02:01:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 4 Aug 2005 02:01:30 -0000 Received: (qmail 39815 invoked by uid 500); 4 Aug 2005 02:01:24 -0000 Delivered-To: apmail-httpd-dev-archive@httpd.apache.org Received: (qmail 39765 invoked by uid 500); 4 Aug 2005 02:01:23 -0000 Mailing-List: contact dev-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list dev@httpd.apache.org Received: (qmail 39752 invoked by uid 99); 4 Aug 2005 02:01:23 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Aug 2005 19:01:23 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: local policy) Received: from [204.146.167.214] (HELO Boron.MeepZor.Com) (204.146.167.214) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Aug 2005 19:01:13 -0700 Received: from [127.0.0.1] (dmz-firewall [206.199.198.4]) by Boron.MeepZor.Com (8.12.8/8.12.8) with ESMTP id j7421J0m024061 for ; Wed, 3 Aug 2005 22:01:21 -0400 Message-ID: <42F176ED.5040704@apache.org> Date: Wed, 03 Aug 2005 22:01:17 -0400 From: Bill Stoddard Reply-To: stoddard@apache.org User-Agent: Mozilla Thunderbird 1.0.5 (Windows/20050711) X-Accept-Language: en-us, en MIME-Version: 1.0 To: dev@httpd.apache.org Subject: Re: SSL downloads faster than non SSL? References: <42EFDCB9.5010309@cfl.rr.com> <92e3673aaf98a7561602cad399ecc5c8@ricilake.net> <42EFEB8E.9000506@cfl.rr.com> <6.2.1.2.2.20050803080502.0611d6a0@pop3.rowe-clan.net> <42F0E742.2060208@cfl.rr.com> <6.2.1.2.2.20050803115813.06689220@pop3.rowe-clan.net> In-Reply-To: <6.2.1.2.2.20050803115813.06689220@pop3.rowe-clan.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N William A. Rowe, Jr. wrote: > At 10:48 AM 8/3/2005, Phillip Susi wrote: > >>William A. Rowe, Jr. wrote: >> >> >>>In the APR library, yes, we translate 'apr_sendfile' to TransmitFile() >>>on win32. Some other magic occurs to obtain a file handle which can be passed to TransmitFile. But there are enough flaws in the TF() api >>>that perhaps this would be better defaulted to 'off'. >> >>Really? Are you quite sure? I wonder what's hosing it all up. Once you hand TransmitFile() the socket and file handles, it should blast the file over the network nice and fast. > > > Yes of course :) However, sadly, Microsoft has a number of bugs Search the archives of this or the apr mailing list... other than bugs (which can be reported to MS with reasonable expectation that they will be fixed. maybe :-), the most serious flaw is that there is no way to timeout calls to TransmitFile. If I call TransmitFile to send a file and the client chooses to not read any of the bytes I send him, transmitfile will fill-up the send buffers in the TCP stack then block forever. I've never found a way to check the 'status' of the call to TransmitFile, to see if it was making 'acceptable' progress sending bytes to the client. To solve (by some definition of solve) this timeout problem, we made TransmitFile (under apr_sendfile) send no more than 64K bytes at a time. The call to transmitfile is non-blocking and the calling thread blocks on WaitForSingleObject for 'timeout' seconds. If the call completes before the WaitFor call times out, we send the next 64K byte chunk of the file. Repeat until all the file is sent. Whoever came up with the brilliant idea of making multiple calls to TransmitFile to send files over 64K bytes needs to be dragged behind a bus ;-) Now if Apache 2 supported asynchronous (or event driven) writes to the network (like IIS), we could just call apr_sendfile/TransmitFile once to send the whole shaboozie and not worry (too much) about whether the client is broken or is running a DoS attack. A monitor thread would periodically check for a transmitfile completion status; if the completion status is too slow in coming, the monitor thread cancels the io and closes the socket.