Squid 2.4 Stable1
Configuration Manual
 

   
Previous
Table of Contents
Next

OPTIONS WHICH AFFECT THE CACHE SIZE


Tag Name

cache_mem

Usage

cache_mem bytes

Description

'cache_mem' specifies the ideal amount of memory to be used for :
  • In-Transit objects
  • Hot Objects
  • Negative-Cached objects
Data for these objects are stored in 4 KB blocks. This parameter specifies the ideal upper limit on the total size of 4 KB blocks allocated. In-Transit objects take the highest priority. In-transit objects have priority over the others. When additional space is needed for incoming data, negative-cached and hot objects will be released. In other words, the negative-cached and hot objects will fill up any unused space not needed for in-transit objects. If circumstances require, this limit will be exceeded. Specifically, if your incoming request rate requires more than 'cache_mem' of memory to hold in-transit objects, Squid will exceed this limit to satisfy the new requests. When the load decreases, blocks will be freed until the high-water mark is reached. Thereafter, blocks will be used to store hot objects.

Default

cache_mem 8 MB

Example

cache_mem 1 GB

Caution

This parameter does not specify the maximum process size. It places a limit on one aspect of squid's memory usage. Squid uses memory for other things as well. Process will probably become twice or three times bigger than the value put here.


Tag Name

cache_swap_low (percent, 0-100)

Usage

cache_swap_low percentage

Description

This tag is used to specify the low-water mark for cache object replacement. Replacement begins when the swap (disk) usage is above the low-water mark and attempts to maintain utilization near the low-water mark. If utilization is close to the low-water mark less replacement is done each time.

Default

cache_swap_low 90

Example

cache_swap_low 95

Caution

If you have a large cache, 5% could be hundreds of MB. If this is the case you may wish to set this number closer together


Tag Name

cache_swap_high (percent, 0-100)

Usage

cache_swap_high percentage

Description

This tag is used to specify the high-water mark for cache object aggressive replacement. As swap utilization gets close to high-water mark object eviction becomes more aggressive.

Default

cache_swap_high 95

Example

cache_swap_high 98

Caution

If you have a large cache, 5% could be hundreds of MB. If this is the case you may wish to set this number closer together


Tag Name

maximum_object_size (bytes)

Usage
maximum_object_size (bytes)

Description

Objects larger than this size will NOT be saved on disk. The value is specified in kilobytes, and the default is 4MB. If you wish to get a high BYTES hit ratio, you should probably increase this (one 32 MB object hit counts for 3200 10KB hits). If you wish to increase speed more than your want to save bandwidth you should leave this low

Default

maximum_object_size 4096 KB

Example

maximum_object_size 2000 KB

Caution

If using the LFUDA replacement policy you should increase this value to maximize the byte hit rate improvement of LFUDA! See replacement_policy below for a discussion of this policy


Tag Name

minimum_object_size (bytes)

Usage
minimum_object_size (bytes)

Description

Objects smaller than this size will NOT be saved on disk. The value is specified in kilobytes, and the default is 0 KB, which means there is no minimum. See maximum_object_size for more information

Default

minimum_object_size 0 KB

Example

minimum_object_size 2000 KB

Note

See maximum_object_size, which is reversibly applicable


Tag Name

maximum_object_size_in_memory (bytes)

Usage
maximum_object_size_in_memory (bytes)

Description

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 whilst low enough to keep larger objects from hoarding cache_mem.

Default

maximum_object_size_in_memory 8 KB

Example

maximum_object_size_in_memory 20 KB


Tag Name

icache_size (number of entries)

Usage

ipcache_size (number of entries)

Description

This tag is used to specify the size of the ipcache.

Default

ipcache_size 1024

Caution

-


Tag Name

icache_low (percent)

Usage

ipcache_low percentage

Description

This specifies the low water mark for caching IP addresses.

Default

ipcache_low 90

Caution

-


Tag Name

icache_high (percent)

Usage

ipcache_high percentage

Description

This specifies the high water mark for caching IP addresses.

Default

ipcache_high 95

Caution

-


Tag Name

fqdncache_size

Usage

fqdncache_size (number of entries)

Description

This specifies the maximum number of FQDN cache entries.

Default

fqdncache_size 1024

Caution

-


Tag Name

cache_replacement_policy

Usage

cache_replacement_policy policy

Description


The cache replacement policy parameter determines which objects are evicted (replaced) when disk space is needed

  • lru : Squid's original list based LRU policy
  • heap GDSF : Greedy-Dual Size Frequency
  • heap LFUDA : Least Frequently Used with Dynamic Aging
  • heap LRU : LRU policy implemented using a heap

This applies to any cache_dir lines listed below this.

The LRU policies keep recently referenced objects.

The heap GDSF policy optimizes object-hit rate by keeping smaller popular objects in cache so it has a better chance of getting a hit. It achieves a lower byte hit rate than LFUDA though since it evicts larger (possibly popular) objects.

The heap LFUDA policy keeps popular objects in cache regardless of their size and thus optimizes byte hit rate at the expense of hit rate since one large, popular object will prevent many smaller, slightly less popular objects from being cached.

Both policies utilize a dynamic aging mechanism that prevents cache pollution that can otherwise occur with frequency-based replacement policies.

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 .


Default

cache_replacement_policy lru

Example
cache_replacement_policy heap LFUDA
To use this policy, Squid should be built with configure option --enable-removal-policy=heap or simply --enable-removal-policy.

Caution

If using the LFUDA replacement policy, the value of maximum_object_size should be incereased above its default of 4096 KB to maximize the potential byte hit rate improvement of LFUDA. If needed to use other policies than default, squid should be built with configure option --enable-removal-policies.


Tag Name

memory_replacement_policy

Usage

memory_replacement_policy policy

Description


The memory replacement policy parameter determines which objects are purged from memory when memory space is needed.

See cache_replacement_policy for details


Default

memory_replacement_policy lru

Caution

-