User Tools

Site Tools


pfsense:squid:options_which_affect_the_cache

This is an old revision of the document!


PFSense - Squid - Options which affect the Cache

Cache Replacement Policy

Decides which objects will remain in cache and which objects are replaced to create space for the new objects.

  • Default: Heap LFUDA.

The cache replacement policies are:

PolicyExplanationComment
LRUSquid's original list based LRU policyKeeps recently referenced objects.
Heap GDSFGreedy-Dual Size FrequencyOptimizes 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.
Heap LFUDALeast Frequently Used with Dynamic AgingKeeps 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. If using the LFUDA replacement policy you should increase the value of maximum_object_size above its default of 4096 KB to maximize the potential byte hit rate improvement of LFUDA.
Heap LRULRU policy implemented using a heap

The policies utilize a dynamic aging mechanism that prevents cache pollution that can otherwise occur with frequency-based 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.


Low-Water Mark in %

The low-water mark for AUFS/UFS/diskd cache object eviction by the cache_replacement_policy algorithm.

  • Default: 90.

High-Water Mark in %

The high-water mark for AUFS/UFS/diskd cache object eviction by the cache_replacement_policy algorithm.

  • Default: 95.

Hard Disk Cache Size

Amount of disk space (in megabytes) to use for cached objects.

Set to 50% of the hard disk size.


Hard Disk Cache System (cache_dir)

This specifies the kind of storage system to use.

Storage SystemDescriptionComment
usfThe old well-known Squid storage format that has always been there.
aufsUses POSIX threads to avoid blocking the main Squid process on disk I/O. (Formerly known as async-io.)
diskdUses a separate process to avoid blocking the main Squid process on disk I/O.
nullDoes not use any storage. Ideal for embedded.

Level 1 Directories

Specifies the number of Level 1 directories for the hard disk cache.

  • Default: 16.

Each level-1 directory contains 256 subdirectories, so a value of 256 level-1 directories will use a total of 65536 directories for the hard disk cache.

This will significantly slow down the startup process of the proxy service, but can speed up the caching under certain conditions.


Minimum Object Size

Objects smaller than the size specified (in kilobytes) will not be saved on disk.

  • Default: 0 (meaning there is no minimum).

Maximum Object Size

Objects larger than the size specified (in megabytes) will not be saved on disk.

  • Default: 4 (MB).

Memory Cache Size (cache_mem)

Specifies the ideal amount of physical RAM (in megabytes) to be used for In-Transit objects, Hot Objects and Negative-Cached objects.

  • Default is : 64MB.

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.

NOTE: This tag 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.


Maximum Object Size in RAM

Objects greater than this size (in kilobytes) will not be attempted to kept in the memory cache.

  • Default: 256 (KB).

Memory Replacement Policy

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

  • Default: heap GDSF.

The cache replacement policies are same as cache_replacemen_policy:

PolicyExplanationComment
LRUSquid's original list based LRU policyKeeps recently referenced objects.
Heap GDSFGreedy-Dual Size FrequencyOptimizes 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.
Heap LFUDALeast Frequently Used with Dynamic AgingKeeps 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. If using the LFUDA replacement policy you should increase the value of maximum_object_size above its default of 4096 KB to maximize the potential byte hit rate improvement of LFUDA.
Heap LRULRU policy implemented using a heap

The policies utilize a dynamic aging mechanism that prevents cache pollution that can otherwise occur with frequency-based 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.


Cache Dynamic Content

With dynamic cache enabled, you can also apply refresh_patterns to sites like Windows Updates.

pfsense/squid/options_which_affect_the_cache.1585561298.txt.gz · Last modified: 2020/07/15 09:30 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki