This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Squid Memory and Caching Tweaks

Squid tends to be memory piggish as it likes to cache to ram.  I want squid to not only put all that cache to the hard disk i want large files.  Here is how you do it..[:)]

Login to your firewall using an ssh client using the "loginuser" ID.

Once logged in "su" to root...
ASL> su -
Password: 

Open the .conf file in "joe".
ASL> joe /var/chroot-squid/etc/squid.conf-default

cache_mem
This is a biggie.  It partially controls the maximum amount of ram used for the object cache.  This is not a hard limit though. Since I want my stuff cached to the hard disk and i want to minimize ram usage by squid i set this to zero.
Default cache_mem 8 MB

Default maximum_object_size 4096 KB
Objects larger than this size will NOT be saved on disk.  Make this as large as the largest file you want cached on the disk.  I would not make it larger than 25% of your total squid partition size.

maximum_object_size_in_memory (bytes)
Objects greater than this size will not be attempted to be kept in the memory cache.  Since we are loooking to minimize memory usage set this to zero.  If you have a tons of free ram then make this at most a meg in size.
Default maximum_object_size_in_memory 8 KB
--------------------------------------------------------------------------
in v6 it is a bit different
The same procedure applies BUT:
look for the following:
[] Objects greater than this size will not be attempted to be kept in the memory cache.  Since we are loooking to minimize memory usage set this to zero.  If you have a tons of free ram then make this at most a meg in size.

next find []  Objects larger than this size will NOT be saved on disk.  Make this as large as the largest file you want cached on the disk.  I would not make it larger than 25% of your total squid partition size.

finally find []
This is a biggie.  It partially controls the maximum amount of ram used for the object cache.  This is not a hard limit though. Since I want my stuff cached to the hard disk and i want to minimize ram usage by squid i set this to zero.

Here are my v6 settings:
maximum_object_size_in_memory 0 KB
maximum_object_size 250 MB
cache_mem 0 KB

Once you make the mods save the file and then stop the http proxy.  Wiat a few minutes and then restart it.  That will load the new squid configuration.


This thread was automatically locked due to age.
Parents
  • William, O wise and Grand Pooh-bah,
    what are the advantages and disadvantages of doing this besides reducing swap usage?

    Ian M [:)]
  • Hi,

    well you have less swapping, because Squid is using the harddisk for storage instead of memory, hmm. And you now have many many files on your /var/storage. Higher CPU load and more stress to the harddisk. 
    If you have some small line to the internet, it will for sure boost the speed of often visited sites.

    Chris
  • [ QUOTE ]
    Hi,

    well the files still need to be processed by squid, keeping his tables up2date, removing to old files and so on, no 99% cpu load, but nothing to look over. Not the large files are the problem, but the million small ones. 
    Guess a better solution would be some old box, where you can put in some ide raid controller with raid 0 over 2 or more disks. 
    And you can mess around with him, without loosing astaro warranty  [;)].

    Chris 

    [/ QUOTE ]
    I am seeing no performance issues.  My cpu load stays well below .5 during the day and only spikes to 1-2 during log rotations and accounting calculations.

    Owner:  Emmanuel Technology Consulting

    http://etc-md.com

    Former Sophos SG(Astaro) advocate/researcher/Silver Partner

    PfSense w/Suricata, ntopng, 

    Other addons to follow

  • Dear Friends,

    I just installed the ASL 6, and when I try to tune the cache, I found the 3 parameters empty ?

    Should I reinstall or upgrade ??

    Thanks
  • [ QUOTE ]
    Dear Friends,

    I just installed the ASL 6, and when I try to tune the cache, I found the 3 parameters empty ?

    Should I reinstall or upgrade ??

    Thanks 

    [/ QUOTE ]
    nope just type them in manually.

    Owner:  Emmanuel Technology Consulting

    http://etc-md.com

    Former Sophos SG(Astaro) advocate/researcher/Silver Partner

    PfSense w/Suricata, ntopng, 

    Other addons to follow

  • William,

    maximum_object_size_in_memory [] KB
    maximum_object_size [] MB 
    cache_mem [] KB

    In the ASL 6, it is written like the above, all I did is entering a number before the KB or MB, for example:

    maximum_object_size [] 250 MB 

    I restart the ASL, when I run IE, it shows that an error page with the following

    connect error:socket error:Connection refused

    Hearing from very soon
  • [ QUOTE ]
    William,

    maximum_object_size_in_memory [] KB
    maximum_object_size [] MB 
    cache_mem [] KB

    In the ASL 6, it is written like the above, all I did is entering a number before the KB or MB, for example:

    maximum_object_size [] 250 MB 

    I restart the ASL, when I run IE, it shows that an error page with the following

    connect error:socket error:Connection refused

    Hearing from very soon 

    [/ QUOTE ]
    copy and paste your configuraiton file here please..[:)]

    Owner:  Emmanuel Technology Consulting

    http://etc-md.com

    Former Sophos SG(Astaro) advocate/researcher/Silver Partner

    PfSense w/Suricata, ntopng, 

    Other addons to follow

  • I am sorry, I don't know how to copy it, I don't have Linux PC.

    But as I told you I just insert a number between the last bracket and the MB.

    May be I should clear something ????
  • [ QUOTE ]
    I am sorry, I don't know how to copy it, I don't have Linux PC.

    But as I told you I just insert a number between the last bracket and the MB.

    May be I should clear something ???? 

    [/ QUOTE ]erase the three parameters i noted aove and then manually type in
    maximum_object_size_in_memory 0 KB
    maximum_object_size 250 MB
    cache_mem 0 KB

    Owner:  Emmanuel Technology Consulting

    http://etc-md.com

    Former Sophos SG(Astaro) advocate/researcher/Silver Partner

    PfSense w/Suricata, ntopng, 

    Other addons to follow

  • maximum_object_size_in_memory 0 KB
    maximum_object_size 250 MB
    cache_mem 0 KB

    Well, as you said, I just delete the extra characters. And I left it as above.

    It works, thanks to you.

    Do you used yahoo or msn for chatting ?
  • maximum_object_size_in_memory 512 KB
    maximum_object_size 250 MB
    cache_mem 65536 KB

    What do you think of the above parameters ? Since I notice that the search in yahoo or google is not good as before ?

    Regards
  • [ QUOTE ]
    maximum_object_size_in_memory 512 KB
    maximum_object_size 250 MB
    cache_mem 65536 KB

    What do you think of the above parameters ? Since I notice that the search in yahoo or google is not good as before ?

    Regards 

    [/ QUOTE ]
    It's up to you. with 512 megs of ram i want as much ram freed up as possbile since ids and accouting take up quite a bit of ram..[:)]

    Owner:  Emmanuel Technology Consulting

    http://etc-md.com

    Former Sophos SG(Astaro) advocate/researcher/Silver Partner

    PfSense w/Suricata, ntopng, 

    Other addons to follow

Reply
  • [ QUOTE ]
    maximum_object_size_in_memory 512 KB
    maximum_object_size 250 MB
    cache_mem 65536 KB

    What do you think of the above parameters ? Since I notice that the search in yahoo or google is not good as before ?

    Regards 

    [/ QUOTE ]
    It's up to you. with 512 megs of ram i want as much ram freed up as possbile since ids and accouting take up quite a bit of ram..[:)]

    Owner:  Emmanuel Technology Consulting

    http://etc-md.com

    Former Sophos SG(Astaro) advocate/researcher/Silver Partner

    PfSense w/Suricata, ntopng, 

    Other addons to follow

Children
No Data