[squid-users] Reverse proxy woes

From: Anthony Tonns <atonns@dont-contact.us>
Date: Thu, 21 Feb 2008 18:45:04 -0500

I'm running a reverse proxy on CentOS5 with squid-2.6.STABLE6-5.el5_1.2
(RHEL RPM) and running into some odd issues. I have a stack setup like
this:

Squid (port 80) -> apache (port 8888) -> Resin (port 8080)

It's caching images/static files served from the apache level like a
champ, but it's having intermittent problems caching dynamically
generate content. The apache -> Resin connector is mod_proxy_http with
the "force-proxy-request-1.0" hack in-place. Apache is 2.2.8, Resin
3.1.3, all running on the same box - Linux devserver01 2.6.18-53.1.4.el5
#1 SMP Fri Nov 30 00:45:55 EST 2007 x86_64 x86_64 x86_64 GNU/Linux.

Running once a second a curl command like:

curl -b /tmp/cj -c /tmp/cj -s -v -o/dev/null
http://www.example.com/index.html

I'll get this response dozens/hundreds of times (i.e. a MISS):

* About to connect() to www.example.com port 80
* Trying 192.168.80.223... connected
* Connected to www.example.com (192.168.80.223) port 80
> GET /index.html HTTP/1.1
> User-Agent: curl/7.15.5 (x86_64-redhat-linux-gnu) libcurl/7.15.5
OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
> Host: www.example.com
> Accept: */*
> Cookie: JSESSIONID=abciW-MVH28Db_ekbG5Gr
>
< HTTP/1.0 200 OK
< Date: Thu, 21 Feb 2008 23:31:55 GMT
< Server: Resin/3.1.3
< Cache-Control: max-age=60, must-revalidate, proxy-revalidate
< Expires: Thu, 21 Feb 2008 23:32:54 GMT
< Content-Type: text/html; charset=iso-8859-1
< X-Cache: MISS from devserver01.example.com
< X-Cache-Lookup: MISS from devserver01.example.com:80
< Via: 1.0 devserver01.example.com:80 (squid)
< Connection: close
Closing connection #0

But then all of a sudden I'll get this for a minute as the Age counter
increments up to max-age, 60:

* About to connect() to www.example.com port 80
* Trying 192.168.80.223... connected
* Connected to www.example.com (192.168.80.223) port 80
> GET /index.html HTTP/1.1
> User-Agent: curl/7.15.5 (x86_64-redhat-linux-gnu) libcurl/7.15.5
OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
> Host: www.example.com
> Accept: */*
> Cookie: JSESSIONID=abciW-MVH28Db_ekbG5Gr
>
< HTTP/1.0 200 OK
< Date: Thu, 21 Feb 2008 23:31:55 GMT
< Server: Resin/3.1.3
< Cache-Control: max-age=60, must-revalidate, proxy-revalidate
< Expires: Thu, 21 Feb 2008 23:32:54 GMT
< Content-Type: text/html; charset=iso-8859-1
< Age: 2
< X-Cache: HIT from devserver01.example.com
< X-Cache-Lookup: HIT from devserver01.example.com:80
< Via: 1.0 devserver01.example.com:80 (squid)
< Connection: close
Closing connection #0

and then it will go back to an un-cached, MISS state for dozens/hundreds
of requests.

Given the Cache-Control / Expires headers, shouldn't Squid be caching
this every single time for sixty seconds?

Tony

P.S. The site involved here gets hundreds/thousands of hits per second
for these pages, so caching for 60 seconds is a big win. We'll extend
cache times as required... once it's working.
Received on Thu Feb 21 2008 - 16:45:23 MST

This archive was generated by hypermail pre-2.1.9 : Sat Mar 01 2008 - 12:00:05 MST