Squid:Performance

From K12LTSP Wiki

Jump to: navigation, search

Contents

Squid Configuration

There are a number of options in the squid config file, /etc/squid/squid.conf, that can drastically affect performance. The squid.conf file is very well commented, every option is well documented. Below are a couple items of interest.

cache options

There are a couple of options that affect performance of the cache itself.

The default storage format is ufs. Changing this to diskd will use the ufs storage format, but will utilize a separate process to avoid blocking the main Squid process on disk-I/O. The numbers at the end of the cache_dir line, "15000 30 256", are the amount of disk space to allocate to the cache (15Gigs in this example), and the directory hashing configuration (create 30 directories, each containing 256 directories).

    cache_dir diskd /var/spool/squid 15000 30 256

cache_mem specifies the ideal amount of memory to be used for:

  • In-Transit objects
  • Hot Objects
  • Negative-Cached objects

Note that squid uses more memory than this, do not set it to your total amount of ram==== For servers with 512MB of ram, 250MB seems to be about right: ====

    cache_mem  250 MB

There are two caching algorthms that are concidered better than the default algorthm: GDSF and LFUDA. GDSF is optimized for hit-rates (low-latency) and LFUDA is optimized for bit-rates (bandwidth savings). For more information about the GDSF and LFUDA cache replacement policies see http://www.hpl.hp.com/techreports/1999/HPL-1999-69.html and http://fog.hpl.external.hp.com/techreports/98/HPL-98-173.html

    cache''replacement''policy heap GDSF
    memory''replacement''policy heap GDSF

log options

The cachestorelog stores information that is basically useless, disable it to save the disk i/o

    cache''store''log none

ICP queries can generate a huge number of log entries, turn off logging for them to save the disk i/o

    log''icp''queries off

Some logs can be buffered, saving some disk i/o

    buffered_logs on

misc options

By default, statitics are kept on a per-client basis. If you don't care about that, turn it off

    client_db off

The default logging format contains a huge amount of interesting data. If you are not interested in all the extra data and/or would prefer that the logs were human-readable, you can emulate common httpd log format

    emulate''httpd''log on

By default squid removes CGI query variables from the logs to protect the privacy of the users. If you cannot protect the privacy of your users, such as would be the case for a school, you can turn this feature off

    strip''query''terms off
Personal tools