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

Tuning Cache Performance

I am wondering what one needs to do to balance cached HTTP pages in memory vs. disk.  I have hardly any memory used on my system (400MB out of 4GB), but about 3.9GB in use on the storage volume.  I'd like to dedicate as much memory to the HTTP proxy cache as possible to improve performance (unless I'm barking up the wrong tree).

This is on a v5.202 system - I may be looking at 6.0, but we're pretty close to going production, so I'm a little leery of using a beta.  

If it matters, I have an IBM x306 with dual P4 Xeons.  I am running the "classic" kernel mode, due to the reports I'd read of proxy issues with SMP.

Thanks!


This thread was automatically locked due to age.
Parents
  • You'll probably be voiding your ASL support, but...

    Read the docs at
    http://www.squid-cache.org/

    Specifically, you are looking for 
    cache_mem

    The squid docs say that it will use about 3X what you tell it to.
    I'd start around 512MB maybe.

    add your parameters to the squid.conf-default file
    save a copy of your changes on your PC.
    disable & re-enable the proxy.

    My understanding is the proxy is OK with SMP, but only if you don't use the content filter.

    BTW, unless you have a LOT of users, using more RAM probably won't make much difference.
    If you do, you'd probably want to use more disk as well.
    (cache_size I think)
    Make sure you don't fill up the partition!

    Barry
  • I suppose the term *a lot* is relative, but it'd be roughly 1,500 people in total.  I have a boatload of disk space (again, relative) - I'm using about 3.9GB on /var/storage, with 25.5GB free.  But memory used averages 325MB, with 1.7GB free (looks like I lied, I only have 2GB of RAM).

    When I look at the file, I am able to specify cache_mem, which I bumped to 256 MB from 16MB (wow, very small).  However, I'm not able to figure out the cache_dir setting, since it replaces what should be the maximum cache size on disk with the term [].  I wasn't able to find a reference to this in the Squid docs either, so I'm not sure what it is or where it gets set.

    I am kind of surprised that this isn't part of the config that is managed via the webadmin interface and backed up in the .ABF file.  I hope this gets remedied in the 6.0 release...tuning proxy cache settings shouldn't require Vi, and shouldn't "void support".
Reply
  • I suppose the term *a lot* is relative, but it'd be roughly 1,500 people in total.  I have a boatload of disk space (again, relative) - I'm using about 3.9GB on /var/storage, with 25.5GB free.  But memory used averages 325MB, with 1.7GB free (looks like I lied, I only have 2GB of RAM).

    When I look at the file, I am able to specify cache_mem, which I bumped to 256 MB from 16MB (wow, very small).  However, I'm not able to figure out the cache_dir setting, since it replaces what should be the maximum cache size on disk with the term [].  I wasn't able to find a reference to this in the Squid docs either, so I'm not sure what it is or where it gets set.

    I am kind of surprised that this isn't part of the config that is managed via the webadmin interface and backed up in the .ABF file.  I hope this gets remedied in the 6.0 release...tuning proxy cache settings shouldn't require Vi, and shouldn't "void support".
Children
  • Here are the things you are looking for.  You will have to add them into the file:
    Open the .conf file in "joe".
    ASL> joe /var/chroot-squid/etc/squid.conf-default

    As the above article suggests, look at the /var/chroot-squid/etc/reference-squid.conf file first since it has all the original annotations regarding the different options contained in the file.

    cache_mem
    Default cache_mem 8 MB

    I have this at zero.  I want to shift the caching form RAM to the hard disk

    Default maximum_object_size 4096 KB
    Objects larger than this size will NOT be saved on disk. The value is specified in kilobytes, and the default is 4 MB.

    I have this at 102400(100 megs)  if you have a large hard disk raise this appropriatly.  I have another installation i have this value at 350 megs.  Again shifting the  caching load to the hdd.

    maximum_object_size_in_memory (bytes)
    Objects greater than this size will not be attempted to be kept in the memory cache. This should be set high enough to keep objects accessed frequently in memory to improve performance while, low enough to keep larger objects from hoarding cache_mem.
    Default maximum_object_size_in_memory 8 KB

    I have this also at zero.  Again shifting the caching load to the hard disk.  If you have tons of ram then you can raise the first and last a touch..restart the proxy via webmin..and see how it works.  Modifying this file voids your Astaro support so make sure you can be on your own before doing this in a production environment.

    Owner:  Emmanuel Technology Consulting

    http://etc-md.com

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

    PfSense w/Suricata, ntopng, 

    Other addons to follow

  • [ QUOTE ]
    I suppose the term *a lot* is relative, but it'd be roughly 1,500 people in total.  I have a boatload of disk space (again, relative) - I'm using about 3.9GB on /var/storage, with 25.5GB free.  But memory used averages 325MB, with 1.7GB free (looks like I lied, I only have 2GB of RAM).

    When I look at the file, I am able to specify cache_mem, which I bumped to 256 MB from 16MB (wow, very small).  However, I'm not able to figure out the cache_dir setting, since it replaces what should be the maximum cache size on disk with the term [].  I wasn't able to find a reference to this in the Squid docs either, so I'm not sure what it is or where it gets set.

    I am kind of surprised that this isn't part of the config that is managed via the webadmin interface and backed up in the .ABF file.  I hope this gets remedied in the 6.0 release...tuning proxy cache settings shouldn't require Vi, and shouldn't "void support". 

    [/ QUOTE ]
    don't mess with cache_dir.

    Owner:  Emmanuel Technology Consulting

    http://etc-md.com

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

    PfSense w/Suricata, ntopng, 

    Other addons to follow

  • Oops... looks like ASL sets the  variable itself, so it isn't safe to change it.

    Looking at squid.conf, it looks like our 5.202 has it set to 7GB out of the 14GB partition (/var/storage)
    We don't actually use squid on our ASL though.

    Anyways, what size is yours set to?
    Note that it can take a lot of usage before it'll ever grow that big, and things may expire before it does if you don't have enough users, so it may just be that there's not that much to cache.
    Most sites nowadays set their content to expire very quickly.

    Barry
  • [ QUOTE ]
    Oops... looks like ASL sets the  variable itself, so it isn't safe to change it.

    Looking at squid.conf, it looks like our 5.202 has it set to 7GB out of the 14GB partition (/var/storage)
    We don't actually use squid on our ASL though.

    Anyways, what size is yours set to?
    Note that it can take a lot of usage before it'll ever grow that big, and things may expire before it does if you don't have enough users, so it may just be that there's not that much to cache.
    Most sites nowadays set their content to expire very quickly.

    Barry 

    [/ QUOTE ]
    Here we can chew up 2 gigs of a 6 gig squid partition in about 3 weeks..more if we have to do a bunch of webwork or my servers need updating..[:)]

    Owner:  Emmanuel Technology Consulting

    http://etc-md.com

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

    PfSense w/Suricata, ntopng, 

    Other addons to follow