Squid hit rate

How can I measure performance of my Squid proxy server?

I keep downloading many of the same files but never seem to see a speed up. My Internet connection is pretty slow, so I would have thought that Squid's cache would drastically speed things up. I get the impression that my cache isn't being used at all...
 
I remember a graphical statistics program for Squid, but I'll have to go down memory lane to come up with that (later). There are also command-line tools in squidclient, like squidclient -p <port> mgr:info (which you may have to configure/enable, don't quite remember).

Edit: ah yes, www/calamaris and www/sarg. Untested by me: www/squidanalyzer.
 
You can also check the various logs from squid, if I remember correctly it has a log specific for cache hits/misses.

I keep downloading many of the same files but never seem to see a speed up. My Internet connection is pretty slow, so I would have thought that Squid's cache would drastically speed things up. I get the impression that my cache isn't being used at all...
Keep in mind that HTTPS connections are never cached.
 
I ran squid at my house for a while and and the grand scheme of things it won;t make that much difference. A lot of www sites have implemented https which can't be cached (unless you break some http man-in-the-middle rules), and even for the http sites many have implemented http code to reduce caching. You can easily override those settings and that will get your cache hit rate up. But even then you're hit rate will still be lowish. I created a 10GB cache to hold lots of stuff and that helped, but in the end I turned it off as it was eating up a fair bit of ram. When I get my new system bought (I am waiting for reasons) with 16GB ram to start I might try squid again. Ultimatly I did it for learning and curiosity so goal acheived. ;)

In a service provider or enterprise environment you will see higher hit rates in theory, but https still kills caching there too.
 
I've found that simple shell scripts can examine the squid logs very well. This guy has some ready-made scripts on his site:

http://blog.davidvassallo.me/2011/05/19/analyzing-squid-access-logs/

Anyway, squid doesn't cache very big files, so with images getting so big these days, less is cached. I think it may be a tunable parameter though. The squid logs can really tell you many things about what you're pulling down from sites - and it can be a real eye opener in terms of site traffic versus ad traffic, etc. David's scripts really nail the details on this.
 
Back
Top