Feature #2981

squid cache management

Added by Filippo Carletti over 6 years ago. Updated over 6 years ago.

Status:CLOSEDStart date:
Priority:NormalDue date:
Assignee:-% Done:

100%

Category:nethserver-squid
Target version:v6.6
Resolution: NEEDINFO:No

Description

Some scenarios could benefit from an on-disk cache of web downloads (i.e. windows updates).

I'd like to have a new tab on the web proxy page with some settings to enable and maintain a cache for squid.
Possible parameters:
  • enable cache
  • cache size
  • non cacheable websites
  • max and min obj size
  • clear cache button

Note: squid needs 10M of ram for every 1G of disk cache.

Associated revisions

Revision 70033740
Added by Edoardo Spadoni over 6 years ago

configuration. added tab to manage cache configurations. Refs #2981

History

#1 Updated by Filippo Carletti over 6 years ago

Add a template-custom:

# cat /etc/e-smith/templates-custom/etc/squid/squid.conf/15cache 
{
    my $mem = $squid{'MemCacheSize'} || '256';
    $OUT.="cache_mem $mem MB\n";
    my $status = $squid{'DiskCache'} || 'disabled';
    my $min = $squid{'MinObjSize'} || '0';
    my $max = $squid{'MaxObjSize'} || '4096';
    my $size = $squid{'DiskCacheSize'} || '100';
    if ($status eq 'enabled') {
        $OUT.="\n# Enable disk cache\n";
        $OUT.="cache_dir rock /var/spool/squid $size max-size=32768\n";
        $OUT.="minimum_object_size $min KB\n";
        $OUT.="maximum_object_size $max KB\n";
    }
}

Set the default config:

config setprop squid DiskCache enabled DiskCacheSize 100 MinObjSize 0 MaxObjSize 4096 MemCacheSize 256

Expand squid.conf:

expand-template /etc/squid/squid.conf

Create disk cache:

service squid stop
rm -f /var/spool/squid/rock
squid -z -F -N
service squid start

#3 Updated by Filippo Carletti over 6 years ago

Variables:
DiskCache=enabled
DiskCacheSize=100 (in Mbytes)
MinObjSize=0 (in kbytes)
MaxObjSize=4096 (kbytes)
MemCacheSize=256 (Mbytes)

#4 Updated by Filippo Carletti over 6 years ago

The cache has to be re-created if size is changed.

#5 Updated by Filippo Carletti over 6 years ago

rock storage has some limitations on our squid version.
aufs is working well.
New template:

{
    my $mem = $squid{'MemCacheSize'} || '256';
    $OUT.="cache_mem $mem MB\n";
    my $status = $squid{'DiskCache'} || 'enabled';
    my $min = $squid{'MinObjSize'} || '0';
    my $max = $squid{'MaxObjSize'} || '4096';
    my $size = $squid{'DiskCacheSize'} || '100';
    if ($status eq 'enabled') {
        $OUT.="\n# Enable disk cache\n";
        $OUT.="cache_dir aufs /var/spool/squid $size 16 256\n";
        $OUT.="minimum_object_size $min KB\n";
        $OUT.="maximum_object_size $max KB\n";
    }
}

Labels:
Disk cache size (in MB)
Min object size (in kB)
Max object size (in kB)

To clean the cache:
http://wiki.squid-cache.org/SquidFaq/OperatingSquid#I_want_to_restart_Squid_with_an_empty_cache

#6 Updated by Edoardo Spadoni over 6 years ago

  • Status changed from NEW to TRIAGED
  • % Done changed from 0 to 20

#7 Updated by Edoardo Spadoni over 6 years ago

  • Category set to nethserver-squid
  • Status changed from TRIAGED to ON_DEV
  • Assignee set to Edoardo Spadoni
  • % Done changed from 20 to 30

#8 Updated by Edoardo Spadoni over 6 years ago

  • Status changed from ON_DEV to MODIFIED
  • Assignee deleted (Edoardo Spadoni)
  • % Done changed from 30 to 60

#9 Updated by Giacomo Sanchietti over 6 years ago

  • Target version changed from ~FUTURE to v6.6

#10 Updated by Giacomo Sanchietti over 6 years ago

  • Status changed from MODIFIED to ON_QA
  • % Done changed from 60 to 70
Package in nethserver-testing:
  • nethserver-squid-1.3.0-1.5.g40e1adb.ns6.noarch.rpm

#11 Updated by Filippo Carletti over 6 years ago

  • Status changed from ON_QA to VERIFIED
  • % Done changed from 70 to 90

1. empty cache with cache disabled: cache was emptied
2. empty cache with cache enabled: cache was emptied
3. enabled cache, browsed the internet, found some file in cache
4. set a min size of 200k, found only big files in cache
5. updated a previous install, set cahce, browsed, all good

#12 Updated by Giacomo Sanchietti over 6 years ago

  • Status changed from VERIFIED to CLOSED
  • % Done changed from 90 to 100
Released in nethserver-base:
  • nethserver-squid-1.3.1-1.ns6.noarch.rpm

Also available in: Atom PDF