Apache on Win32: Slow Transfers of single, static files in HTTP, fast in HTTPS
Posted
by
Michael Lackner
on Server Fault
See other posts from Server Fault
or by Michael Lackner
Published on 2011-12-21T14:36:20Z
Indexed on
2012/10/28
11:06 UTC
Read the original article
Hit count: 327
I have a weird problem with Apache 2.2.15 on Windows 2000 Server SP4. Basically, I am trying to serve larger static files, images, videos etc. The download seems to be capped at around 550kB/s even over 100Mbit LAN.
I tried other protocols (FTP/FTPS/FTP+ES/SCP/SMB), and they are all in the multi-megabyte range. The strangest thing is that, when using Apache with HTTPS instead of HTTP, it serves very fast, around 2.7MByte/s! I also tried the AnalogX SimpleWWW server just to test the plain HTTP speed of it, and it gave me a healthy 3.3Mbyte/s.
I am at a total loss here. I searched the web, and tried to change the following Apache configuration directives in httpd.conf, one at a time, mostly to no avail at all:
SendBufferSize 1048576 #(tried multiples of that too, up to 100Mbytes)
EnableSendfile Off #(minor performance boost)
EnableMMAP Off
Win32DisableAcceptEx
HostnameLookups Off #(default)
I also tried to tune the following registry parameters, setting their values to 4194304 in decimal (they are REG_DWORD), and rebooting afterwards:
HKLM\SYSTEM\CurrentControlSet\Services\AFD\Parameters\DefaultReceiveWindow
HKLM\SYSTEM\CurrentControlSet\Services\AFD\Parameters\DefaultSendWindow
Additionally, I tried to install mod_bw, which sets the event timer precision to 1ms, and allows for bandwidth throttling. According to some people it boosts static file serving performance when set to unlimited bandwidth for everybody. Unfortunately, it did nothing for me.
So:
- AnalogX HTTP: 3300kB/s
- Gene6 FTPD, plain: 3500kB/s
- Gene6 FTPD, Implicit and Explicit SSL, AES256 Cipher: 1800-2000kB/s
- freeSSHD: 1100kB/s
- SMB shared folder: about 3000kB/s
- Apache HTTP, plain: 550kB/s
- Apache HTTPS: 2700kB/s
Clients that were used in the bandwidth testing:
- Internet Explorer 8 (HTTP, HTTPS)
- Firefox 8 (HTTP, HTTPS)
- Chrome 13 (HTTP, HTTPS)
- Opera 11.60 (HTTP, HTTPS)
- wget under CygWin (HTTP, HTTPS)
- FileZilla (FTP, FTPS, FTP+ES, SFTP)
- Windows Explorer (SMB)
Generally, transfer speeds are not too high, but that's because the server machine is an old quad Pentium Pro 200MHz machine with 2GB RAM. However, I would like Apache to serve at at least 2Mbyte/s instead of 550kB/s, and that already works with HTTPS easily, so I fail to see why plain HTTP is so crippled.
I am using a Kerio Winroute Firewall, but no Throttling and no special filters peeking into HTTP traffic, just the plain Firewall functionality for blocking/allowing connections.
The Apache error.log (Loglevel info) shows no warnings, no errors. Also nothing strange to be seen in access.log.
I have already stripped down my httpd.conf to the bare minimum just to make sure nothing is interfering, but that didn't help either.
If you have any idea, help would be greatly appreciated, since I am totally out of ideas!
Thanks!
Edit: I have now tried a newer Apache 2.2.21 to see if it makes any difference. However, the behaviour is exactly the same.
Edit 2: KM01 has requested a sniff on the HTTP headers, so here comes the LiveHTTPHeaders output (an extension to Firefox). The Output is generated on downloading a single file called "elephantsdream_source.264", which is an H.264/AVC elementary video stream under an Open Source license. I have taken the freedom to edit the URL, removing folders and changing the actual servers domain name to www.mydomain.com. Here it is:
LiveHTTPHeaders, Plain HTTP:
http://www.mydomain.com/elephantsdream_source.264
GET /elephantsdream_source.264 HTTP/1.1
Host: www.mydomain.com
User-Agent: Mozilla/5.0 (Windows NT 5.2; WOW64; rv:6.0.2) Gecko/20100101 Firefox/6.0.2
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Connection: keep-alive
HTTP/1.1 200 OK
Date: Wed, 21 Dec 2011 20:55:16 GMT
Server: Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/0.9.8r PHP/5.2.17
Last-Modified: Thu, 28 Oct 2010 20:20:09 GMT
Etag: "c000000013fa5-29cf10e9-493b311889d3c"
Accept-Ranges: bytes
Content-Length: 701436137
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/plain
LiveHTTPHeaders, HTTPS:
https://www.mydomain.com/elephantsdream_source.264
GET /elephantsdream_source.264 HTTP/1.1
Host: www.mydomain.com
User-Agent: Mozilla/5.0 (Windows NT 5.2; WOW64; rv:6.0.2) Gecko/20100101 Firefox/6.0.2
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Connection: keep-alive
HTTP/1.1 200 OK
Date: Wed, 21 Dec 2011 20:56:57 GMT
Server: Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/0.9.8r PHP/5.2.17
Last-Modified: Thu, 28 Oct 2010 20:20:09 GMT
Etag: "c000000013fa5-29cf10e9-493b311889d3c"
Accept-Ranges: bytes
Content-Length: 701436137
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/plain
© Server Fault or respective owner