Bug 42065 - EnableSendFile can slow file transfers on Windows
Summary: EnableSendFile can slow file transfers on Windows
Status: RESOLVED WORKSFORME
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: Core (show other bugs)
Version: 2.2.10
Hardware: Other Windows Server 2003
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-04-06 07:47 UTC by Frank McCreedy
Modified: 2011-02-05 17:47 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Frank McCreedy 2007-04-06 07:47:25 UTC
We run Apache 2.0.59 (32 bit .exe) on Windows 2003 Server Enterprise Edition 64
Bit.  When EnableSendFile is enabled (the default) file transfers can be slow. 
For instance, on our gigabit lan, the file transfer would average around 300
kB/s.  This only seemed to affect HTTP file transfers.  HTTPS would be normal
speed.  This bug only affected a few machines on the lan (we don't know why-
maybe some timing issue?).  Once EnableSendFile was turned off the file transfer
would go at 11 mB/s.  

The file transfer client was running Windows XP (booting a Ubuntu live cd didn't
seem to have the problem on the same hardware).

Maybe EnableSendFile could be off by default for the win32 source...
Comment 1 Frank McCreedy 2007-04-06 09:10:55 UTC
I should add that even though it didn't -seem- to affect other windows machines
on the lan, it actually did reduce their download speed.  So they would download
around 5 or 6 mB/s instead of 11.  Since they didn't slow down to 300 kB/s we
thought they were tranferring at optimum speed...
Comment 2 Frank McCreedy 2007-04-06 09:12:54 UTC
I should also add that I don't know if the Windows machines downloading from a
Linux-based Apache would have the same problem or not (to clarify my comment on
the win32 source)
Comment 3 Dominik Friedrichs 2008-10-26 07:32:05 UTC
Thanks Frank, im so glad i took a look in here. I was already compiling Apache and messing with the code trying to figure out why it was so slow (200kbyte/s instead of 650). I even tried Apache 2.0 and 1.3 with the same problem. I had the same issue with my FTP server, but that vanished after i increased its Sendbuffer size from 16 to 64kb. So i assumed Apache somehow did not care about the SendBufferSize Directives, because i couldnt notice any difference when using them, so i tried hardcoding the 64k value, no change. I would never have thought of Sendfile to cause this, after turning it off my Apache worked like a charme instantly!

I run Apache 2.2.10 on a Windows 2003 x64 SP2 standard virtual server with 100Mbit internet connection, so the problem still exists in the most recent version. Well maybe its not really a problem/bug, but rather an incompatibility of Win2003 with the sendfile directive.... In that case Apache should mention this somewhere IMO, or as you said Frank, disable it by default. The slowdown seems only to occur on high latency lines, like 60ms RTT. On the LAN it doesnt appear, as i contacted my provider for support, and they weren't able to determine any difference in speed between MS IIS and Apache running in parallel on my server back then, probably downloading from it via LAN. (same thing for localhost downloads)

I think Apache should put this in the FAQ or something, i have found quite a few people on the web having this issue not resolved. I myself searched for a solution the past 4 weeks...
Comment 4 Dominik Friedrichs 2011-02-05 17:47:14 UTC
If all these dont work:

EnableSendfile off
EnableMMAP off
Win32DiableAcceptEx
SendBufferSize ...

Then this is one last thing to try (worked for me on a new W2k3 R2 server):
Set in your Windows registry

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Afd\Parameters

DefaultSendWindow
DefaultReceiveWindow

To something like 65535. You'll probably have to create the DWORD values. Reboot afterwards and that should do the trick.

It appears that Apache fails to set the buffer size (without printing warnings) or its setting is ignored by Windows for some reason.