[squid-users] squid cache

Antony Stone Antony.Stone at squid.open.source.it
Wed Sep 30 19:47:48 UTC 2015


On Wednesday 30 September 2015 at 21:35:32, Magic Link wrote:

> Hi,i configure squid to use cache. It seems to work because when i did a
> try with a software's download, the second download is TCP_HIT in the
> access.log.

Congratulations.

> The question i have is : why the majority of requests can't be cached (i
> have a lot of tcp_miss/200) ?

Whether that is the *majority* of requests depends greatly upon what sort of 
content you are requesting.

That may sound trite, but I can't think of a better way of expressing it.  Get 
10 users on your network to download the same image file (no, not all at the 
same time), and you'll see that the 9 who were not first get the content a lot 
faster than the 1 who was first.

If they're downloading other types of content, though, you may not get such a 
"good" result.

> i found that dynamic content is not cached but i don't understand.

What does "dynamic" mean?  It means it is not fixed / constant / stable.  In 
other words, requesting the "same content" twice might result in different 
answers, therefore if Squid gave you the first answer again in response to the 
second request, that would not be what you would have got from the remote 
server, and is therefore wrong.

Example: eBay

You look up an auction which is due to end in 2 minutes.  You see the current 
price and the number of bids (plus the details of what it is, etc).

5 minutes later you request the same URL again.  It would be wrong of Squid to 
show you the same page, with 2 minutes to go, and the bidding at X currency 
units, from Y other bidders.  No, Squid should realise that the content it 
previously requested is now stale, and it needs to fetch the new current 
content and show you who won the auction and for how much.

That is dynamic content.  The remote server tells Squid that there is no point 
in caching the page it just fetched, because within 1 second it may well be 
stale and need fetching anew.

A lot of the Internet works that way these days.


Regards,


Antony.


-- 
"Life is just a lot better if you feel you're having 10 [small] wins a day 
rather than a [big] win every 10 years or so."

 - Chris Hadfield, former skiing (and ski racing) instructor

                                                   Please reply to the list;
                                                         please *don't* CC me.


More information about the squid-users mailing list