3

I've install Squid Proxy via sudo apt-get install squidon Ubuntu for a forward proxy

I've not modified any of the default settings in squid.conf apart from http_access deny all to http_access allow all

Now I've used this command # tail -f /var/log/squid3/access.log to monitor the squid access logs in real time and I see that despite numerous different types of websites, static and dynamic, lots of images and static files, the results are still always the same.

Lots of TCP_Miss and barely two or three TCP_Hits I've also checked the size of Squid's spool and it's only 4.0K

So I know now that Squid is not caching anything. Is there anyone able to help me out there with this? I've read almost every single article from google when searching for "Squid TCP_Miss" and "Squid not caching" but none of those worked for me.

Thanks

jc.yin
  • 131
  • 1
  • 1
  • 2

2 Answers2

4

Had the same problem but figured it out. At the end of the squid configuration file you have refresh patterns - refresh_pattern and some rules after (explanation here). The default catch all pattern is the one with the '.'. It obeys client refresh so content can't be served from cache. I've added this rule just above the one with '.' and can now cache .png files for 120 seconds.

refresh_pattern .png            120     50%     86400 ignore-reload

refresh_pattern .               0       20%     4320
chicks
  • 3,793
  • 10
  • 27
  • 36
Tom
  • 41
  • 2
2

Squid (and the rest of the Proxy servers out there), caches only static content. Not dynamic web pages. So, you will see a lot of TCP_MISS for php/asp etc pages. In addition, in case the webmaster set the no_cache directive, not even the JPG files will be cached.

Peter
  • 822
  • 2
  • 10
  • 23
  • But the thing is, I noticed that a lot of images, which are supposed to be static, aren't getting cached anyway, because there's a few `?` in the URL. Also shouldn't contents like js and css files also be cached? They aren't getting either – jc.yin Jul 13 '13 at 19:09
  • Also I have followed the guide here http://wiki.squid-cache.org/ConfigExamples/DynamicContent and implemented the new code but still barely anything is getting cached at all. I mean if out a "normal" web 2.0 website, with 30 images, only two images get cached each time, how come Squid is still so popular? – jc.yin Jul 13 '13 at 19:10
  • 1
    Please tell us which part of the tutorial you did follow?.Also note, that the cache size is important. I strongly suggest to use one of the tools you can find at http://www.squid-cache.org/Misc/log-analysis.html. I used them in the loooong past (when squid was a necessity) and managed to pinpoint any issue I had. – Peter Jul 14 '13 at 05:56