Web caching on my NAS

Squid cache logo

I have been running the Squid proxy software on my Synology DS 207 for over a month now, and I was curious to see how much traffic would end up being cached. My iPhone, my personal laptop and my Playstation 3 are all configured to use for regular HTTP traffic. So I downloaded the access log files and ran some Python on it.

The first thing to observe is that the amount of cache hits is relatively low: around 8% of the request were serviced from the cache. When counted in bytes, the efficiency of the cache is even worse: around 1% of the bytes were served out of the cache. This was to be expected, the largest download occur only once, so caching them makes no sense. Clearly whatever saving I get from the proxy is in terms of latency, in particular for the iPhone which has little internal cache. While the NAS has a latency advantage, it is not so big nowadays, ping times from my laptop to the NAS is around 2.5 ms, while the Apple software server (the first in the list below) is around 25ms, given the fact that the NAS serves out of its disk, I’m not sure the latency improvement of the cache is that great, I have to find a way to measure that…

The next question is what gets cached, besides a few places I go to regularly (like my blog), most of the cached servers are serving static content. So the proxy is its job properly: caching frequent, static content.

Hostname Hits
swcdn.apple.com 5363
r.mzstatic.com 2996
images.apple.com 629
a4.mzstatic.com 555
a2.mzstatic.com 554
pics.ricardostatic.ch 541
illiweb.com 535
a5.mzstatic.com 532
a3.mzstatic.com 508
a1.mzstatic.com 494
fastcache.gawkerassets.com 458
clients1.google.ch 429
www.fr.ricardo.ch 427
upload.wikimedia.org 422
i4.ytimg.com 389
static.arstechnica.net 380

So what mimes mostly get cached, unsurprisingly, this is mostly images and text data.
The fact that many sites still are not configured to return the MIME type is worrying but well…

Mime Hits
image/png 8898
image/jpeg 6976
text/plain 5599
image/gif 4801
text/html 2650
application/x-javascript 2019
text/css 1495
text/x-cross-domain-policy 518
application/javascript 505
text/javascript 496
image/x-icon 335
application/x-shockwave-flash 313
application/xml 259
application/x-x509-ca-cert 150
text/xml 137
application/vnd.google.safebrowsing-chunk 126
application/pdf 109
application/ocsp-response 27
application/octet-stream 19

One thought on “Web caching on my NAS

  1. Hi,
    I am interested to know on how you implement the squid server on your NAS storage. Hopefully you would share you knowledge

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: