Squid3 Caching websites works but not for large files despite max size 6GB

Posted on

Problem :

For a homelab environment, I setup a Squid 3.3.8 Caching server on CentOS 7 (minimal) as a proxy server (not as the default gateway with transparent caching).

With a Xubuntu client, I setup proxy networking with:

export http_proxy="192.168.1.15:3128"   (the same pattern for https and ftp)

Web browsing works and I can see it hit the log /var/log/squid/access.log. However, big files like .ISO images are not being cached despite 30GB of cache space available and a 6GB per object size limit.

How do I troubleshoot and fix this?

I see two misses sequentially in the log files, which I understood means squid caching failed.

1442197979.371 394811 192.168.1.61 TCP_MISS/200 666894705 GET http://ftp.osuosl.org/pub/centos/7/isos/x86_64/CentOS-7-x86_64-Minimal-1503-01.iso - HIER_DIRECT/140.211.166.134 application/octet-stream
----
1442199880.195 414232 192.168.1.61 TCP_MISS/200 666894705 GET http://ftp.osuosl.org/pub/centos/7/isos/x86_64/CentOS-7-x86_64-Minimal-1503-01.iso - HIER_DIRECT/140.211.166.134 application/octet-stream

Squid Config:

cache_dir ufs /var/spool/squid 30720 16 256
cache_mem 256 MB
maximum_object_size_in_memory 512 KB
maximum_object_size 6 GB
cache_replacement_policy heap LFUDA
range_offset_limit -1
quick_abort_min -1 KB

Solution :

According to this answer here on Server Fault—and sourced from this thread official Squid Proxy support site—the maximum_object_size should be placed above the cache_dir in the squid.conf file.

Knowing that, just change your configuration from this:

cache_dir ufs /var/spool/squid 30720 16 256
cache_mem 256 MB
maximum_object_size_in_memory 512 KB
maximum_object_size 6 GB
cache_replacement_policy heap LFUDA
range_offset_limit -1
quick_abort_min -1 KB

To this:

maximum_object_size 6 GB
cache_dir ufs /var/spool/squid 30720 16 256
cache_mem 256 MB
maximum_object_size_in_memory 512 KB
cache_replacement_policy heap LFUDA
range_offset_limit -1
quick_abort_min -1 KB

Restart the Squid proxy and see what happens.

Leave a Reply

Your email address will not be published.