This is an old revision of the document!
Table of Contents
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:
Policy | Explanation | Comment |
---|---|---|
LRU | Squid's original list based LRU policy | Keeps recently referenced objects. |
Heap GDSF | Greedy-Dual Size Frequency | 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. |
Heap LFUDA | Least Frequently Used with Dynamic Aging | 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. 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 LRU | LRU 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.
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.
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 memory size)
Specifies the ideal amount of physical RAM (in megabytes) to be used for In-Transit objects, Hot Objects and Negative-Cached objects.
- Minimum value: 1 (MB).
- Default: 64 (MB).
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.
Cache Dynamic Content
With dynamic cache enabled, you can also apply refresh_patterns to sites like Windows Updates.