[dev] Using compression through squid takes forever

Bernard Blackham b-horde at blackham.com.au
Thu Feb 12 01:32:36 PST 2004


Greetings,

I was running into a problem where pages would hang for 15 seconds
before they loaded but only when using a proxy server. I've tracked
the problem down to compression.

If a page is requested with a keep-alive (as is done by squid), then
the reply will be sent with a Content-length header of the original
text, but the actual length of the output is the length of the
compressed page. Squid will sit there waiting for more data, keeping
the client in suspense, until it times out.

Typical conversation is below.

Client -> Squid :

GET http://bhorde.cwis.uwa.edu.au/bhorde/services/javascript.php?file=open_compose_win.js&app=imp HTTP/1.1
Host: bhorde.cwis.uwa.edu.au
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3.1) Gecko/20030527 Debian/1.3.1-2
Accept: */*
Accept-Encoding: gzip,deflate,compress;q=0.9
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Connection: close
Proxy-Connection: close
Referer: http://bhorde.cwis.uwa.edu.au/bhorde/login.php

Squid -> Apache :

GET /bhorde/services/javascript.php?file=open_compose_win.js&app=imp HTTP/1.0
Host: bhorde.cwis.uwa.edu.au
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3.1) Gecko/20030527 Debian/1.3.1-2
Accept: */*
Accept-Encoding: gzip,deflate,compress;q=0.9
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Referer: http://bhorde.cwis.uwa.edu.au/bhorde/login.php
Via: 1.1 proxy.uwa.edu.au:8888 (squid/2.5.STABLE4-CVS)
X-Forwarded-For: 130.95.115.75
Cache-Control: max-age=7200
Connection: keep-alive   <--- without this, the content-length is still reported as 890, but the connection is closed so stops the timeout

Apache -> Squid :

HTTP/1.1 200 OK.
Date: Thu, 12 Feb 2004 09:03:32 GMT
Server: Apache/1.3.29 (Debian GNU/Linux) mod_ssl/2.8.16 OpenSSL/0.9.7c mod_python/2.7.8 Python/2.3.2 mod_perl/1.29 PHP/4.3.3
X-Powered-By: PHP/4.3.3
Set-Cookie: Horde=f26c6a6d0609149519126bb0819bc835; path=/bhorde; domain=bhorde.cwis.uwa.edu.au
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: public, max-age=86400
Pragma: no-cache
Last-Modified: Thu, 02 Oct 2003 10:04:08 GMT
Content-Length: 890
Content-Encoding: gzip
Vary: Accept-Encoding
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/javascript

<around 400 bytes of gzip'ed data>

Apache -> Squid :

HTTP/1.1 200 OK
Date: Thu, 12 Feb 2004 09:12:28 GMT
Server: Apache/1.3.29 (Debian GNU/Linux) mod_ssl/2.8.16 OpenSSL/0.9.7c mod_python/2.7.8 Python/2.3.2 mod_perl/1.29 PHP/4.3.3
X-Powered-By: PHP/4.3.3
Set-Cookie: Horde=f26c6a6d0609149519126bb0819bc835; path=/bhorde; domain=bhorde.cwis.uwa.edu.au.
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: public, max-age=86400
Pragma: no-cache
Last-Modified: Thu, 02 Oct 2003 10:04:08 GMT
Content-Length: 890
Content-Encoding: gzip
Vary: Accept-Encoding
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/javascript

<around 400 bytes of gzip'ed data>

Notice the content-length header sitting at 890. This is using HEAD
from 11-Feb. Any ideas how to resolve this? (besides turning off
compression)

TIA,

Bernard.

-- 
 Bernard Blackham <bernard at blackham dot com dot au>


More information about the dev mailing list