Koozali.org: home of the SME Server

Increase squid cache size and/or cache_mem

Offline Michail Pappas

  • *
  • 351
  • +1/-0
Increase squid cache size and/or cache_mem
« on: April 25, 2012, 11:06:44 AM »
Hello all,

I've read the db commands reference, checked config show squid and searched the forum and wiki, but I was unable to find what I'm looking for: is it possible to simply change the cache size and the RAM allocated (cache_mem) using only by config set commands, or is the only way possible through creating a template?

Offline mmccarn

  • *
  • 2,656
  • +10/-0
Re: Increase squid cache size and/or cache_mem
« Reply #1 on: April 25, 2012, 01:49:20 PM »
Here's are some notes on general template / service configuration settings:
http://wiki.contribs.org/Template_Tutorial#Detailed_generic_troubleshooting_.26_configuration_steps

The squid configuration file is built based on the templates in /etc/e-smith/templates/etc/squid/squid.conf.

Looking at the template fragments in that folder, I don't see anything about "cache_mem", "cache_dir" or "size" -- so you would have to create custom template fragments if you want to set non-default values for any of these.

Offline Michail Pappas

  • *
  • 351
  • +1/-0
Re: Increase squid cache size and/or cache_mem
« Reply #2 on: May 08, 2012, 08:21:58 AM »
Sorry for the late reply, been ultra busy...

I think I managed to make my first SME template :)

Just for the record, these are the changes I implemented to allow the user to have a custom cache:

File /etc/e-smith/templates-custom/etc/squid/squid.conf/cache_dir_size/75cache_dir_size (if directory /etc/e-smith/templates-custom/etc/squid/squid.conf/cache_dir_size/ does not exist, create it first):
Code: [Select]
{
    $OUT .= "cache_dir aufs /var/spool/squid/ " . ($squid{cache_dir_size} || '100') . " 16 256\n";
}

Then run the following commands ONCE:
Code: [Select]
config setprop squid cache_dir_size 1000
expand-template /etc/squid/squid.conf
sv stop squid
sv start squid

« Last Edit: May 08, 2012, 08:30:55 AM by reqman »