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

  • Check the caching headers of the pages squid is retrieving. They may not allow caching. – Ladadadada Jul 13 '13 at 16:06
  • I really don't think it's the headers... I've tried like over 20 different websites and none of them have a single actual TCP_Hit – jc.yin Jul 13 '13 at 16:07
  • Check it anyway. – Michael Hampton Jul 13 '13 at 18:13
  • Sorry for my newbiness but could you tell me how do I check the headers? And what I'm I looking for exactly. Thanks – jc.yin Jul 13 '13 at 18:49
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
| improve this answer | |
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.

| improve this answer | |
  • 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 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 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 5:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.