Re: [squid-users] Reverse proxy TCP_MISSes for cached pages from different client IPs

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Wed, 19 Oct 2011 16:53:53 +1300

On 19/10/11 07:02, goran kent wrote:
> Hi,
>
> Using squid 2.6.STABLE21 on CentOS 5.x as a reverse proxy.
>
> For our application caching URLs with "/?q=" in it is vital for
> performance. In other words, irrespective of client IP or client
> cache settings (or even origin server cache control), etc, any URL
> with "/?q=" in it *must* be cached permanently and served to any and
> all clients (until we refresh it manually).
>
> The problem I'm having is that clientA will browse to eg,
> "test.com/?q=a" and it will be cached successfully. However, clientB
> or clientC, etc, browsing to the same URL ("test.com/?q=a" in this
> case), will not always be served from the cache. Instead, and I've
> been unsuccessfully trying to isolate why, squid will go direct and
> re-fetch it from the origin server, even though the page in the cache
> is only a few seconds old.

Squid is optimized to produce an accurate copy of the object as per the
client request requirements.

>
> Here's the log:
>
> ip.of.my.desktop TCP_MISS/200 3211 GET http://test.com/?q=minors -
> FIRST_UP_PARENT/myAccel text/html
> ip.of.client.A TCP_MISS/200 3258 GET http://test.com/?q=minors -
> FIRST_UP_PARENT/myAccel text/html
> ip.of.client.B TCP_MISS/200 3206 GET http://test.com/?q=minors -
> FIRST_UP_PARENT/myAccel text/html
>
> Browsing again to the same URL with clientA yields a hit:
>
> ip.of.client.A TCP_MEM_HIT/200 3214 GET http://test.com/?q=minors -
> NONE/- text/html
>
> So, it's almost like caching is tied to the client IP, and not based
> solely on the cached URL, which is what I would expect for reverse
> proxying.

It is tied to the client request headers usually.
Grab a copy of the request and reply headers and find out.

>
> I'd appreciate any comments/suggestions on what I'm missing.
>
> Thanks
> Henry
>
>
> My config:
>
> http_port 80 accel defaultsite=test.com
> cache_peer directtest.com parent 80 0 no-query originserver name=myAccel
> acl our_sites dstdomain test.com
> acl all src 0.0.0.0/0.0.0.0
> http_access allow our_sites
> cache_peer_access myAccel allow our_sites
> cache_peer_access myAccel deny all
> # my next question will be: what's the best refresh_pattern line to
> permanently cache pages containing my pattern:

> refresh_pattern -i [?]q= 1000000 100 100 reload-into-ims
> override-expire override-lastmod ignore-reload ignore-no-cache

That requests line says store for a maximum of 100 seconds regardless of
when the origin server says it will change.

Start with an upgrade. The newer Squids have much better reverse proxy
support. Then work from there.

Amos

-- 
Please be using
   Current Stable Squid 2.7.STABLE9 or 3.1.16
   Beta testers wanted for 3.2.0.13
Received on Wed Oct 19 2011 - 03:53:59 MDT

This archive was generated by hypermail 2.2.0 : Wed Oct 19 2011 - 12:00:06 MDT