cache_size

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 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 4 MB. If you wish to get a high BYTES hit ratio, you should probably increase this (one 32 MB object hit counts for 3200 10 KB hits). If you wish to increase speed more than your want to save bandwidth, you should leave this low. During the initial downloading of a file, the downloading time seems to be a normal one, but if you download the same file again, the time it takes for download will be very minimum. This indicates that, the file comes from the Cache.

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 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 while, 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

ipcache_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

Tag Name

ipcache_low (percent)

Usage

ipcache_low percentage

Description
This specifies the low water mark for caching IP addresses.

Default

ipcache_low 90

Tag Name

ipcache_high (percent)

Usage

ipcache_high percentage

Description
This specifies the high water mark for caching IP addresses.

Default

ipcache_high 95

 

Tag Name

fqdncache_size

Usage

fqdncache_size (number of entries)

Description
This specifies the maximum number of FQDN cache entries.

Default

fqdncache_size 1024

 

Tag Name

cache_replacement_policy

Usage

cache_replacement_policy policy

Description
The cache replacement policy parameter decides which objects will remain in cache and which objects are evicted (replaced) to create space for the new objects.

  • 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. i.e., it replaces the object that has not been accessed for the longest time.

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 ( Least Frequently Used with Dynamic Aging ) 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 https://www.hpl.hp.com/techreports/1999/HPL-1999-69.html and https://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-policies=heap or simply --enable-removal-policies.

Caution
If using the LFUDA replacement policy, the value of maximum_object_size should be increased 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