OPTIONS FOR TUNING THE CACHE
This section describes the important parameters that determine Squid cache performance.
TAG NAME |
wais_relay_host, wais_relay_port |
Description
|
Defines WAIS host and port to relay WAIS requests
|
Build Option
|
Default
|
Usage
|
wais_relay_host hostname wais_relay_port portnumber
|
Default
|
wais_relay_host localhost wais_relay_port 8000
|
Synopsis
WAIS, or Wide Area Information System, is a system to catalog and search large amounts of data via a WAIS or WWW browser. This defaults to localhost and 8000.
Arguments
hostname
|
Machine name
|
portnumber
|
Port where to bind the socket
|
Example(s) wais_relay_host localhost wais_relay_port 8000
|
|
TAG NAME |
request_header_max_size |
Description
|
This specifies the maximum size for HTTP headers in a request
|
Build Option
|
Default
|
Usage
|
request_header_max_size size(KB)
|
Default
|
request_header_max_size 10 KB
|
Synopsis
Size of HTTP headers in a request can be controlled using this tag. Request headers are usually relatively small (about 512 bytes). Placing a limit on the request header size will catch certain bugs (for example with persistent connections) and possibly buffer-overflow or denial-of-service attacks.
Arguments
size
|
Maximum size of request header
|
Example(s) request_header_max_size 100 KB
|
|
TAG NAME |
request_body_max_size |
Description
|
Specifies the maximum size for an HTTP request body
|
Build Option
|
Default
|
Usage
|
request_body_max_sizesize(KB)
|
Default
|
request_body_max_size 0 KB
|
Synopsis
This is the maximum size of a PUT/POST request. A user who attempts to send a request with a body larger than this limit receives an "Invalid Request" error message. If you set this parameter to a zero (the default), there will be no limit imposed.
Arguments
size
|
Maximum size of request body
|
Example(s) request_body_max_size 10 KB
|
|
TAG NAME |
refresh_pattern |
Description
|
Used to define the manner how Squid treats the objects in the cache
|
Build Option
|
Default
|
Usage
|
refresh_pattern [-i] regexmin percent max [options]
|
Default (Suggested)
|
refresh_pattern ^ftp: 1440 20% 10080 refresh_pattern ^gopher: 1440 0% 1440 refresh_pattern . 0 20% 4320
|
Synopsis
The way how the objects in the cache be refreshed is defined using this tag. By default, regular expressions are CASE-SENSITIVE. To make them case-insensitive, use the -i option.
Basically a cached object is:
FRESH
|
if expires < now, else STALE
|
STALE
|
if age > max
|
FRESH
|
if lm-factor < percent, else STALE
|
FRESH
|
if age < min
|
else
|
STALE
|
The refresh_pattern lines are checked in the order listed here. The first entry which matches is used. If none of the entries match, then the default will be used.
Arguments
regex
|
regular expression
|
Min
|
time (in minutes), an object without an explicit expire time should be considered fresh.
|
percent
|
percentage of the objects age (time since last modification age) an object without explicit expire time will be considered fresh.
|
Max
|
upper limit on how long objects without an explicit expiry time will be considered fresh.
|
Options:
override-expire
|
enforces min age even if the server sent a Expires: header. Doing this VIOLATES the HTTP standard. Enabling this feature could make you liable for problems which it causes.
|
override-lastmod
|
enforces min age even on objects that was modified recently.
|
reload-into-ims
|
changes client no-cache or ``reload'' to If-Modified-Since requests. Doing this VIOLATES the HTTP standard. Enabling this feature could make you liable for problems which it causes.
|
ignore-reload
|
ignores a client no-cache or ``reload'' header. Doing this VIOLATES the HTTP standard. Enabling this feature could make you liable for problems which it causes.
|
ignore-no-cache
|
ignores any ``Pragma: no-cache'' and ``Cache-control: no-cache'' headers received from a server.
|
ignore-private
|
ignores any ``Cache-control: private'' headers received from a server. Doing this VIOLATES the HTTP standard. Enabling this feature could make you liable for problems which it causes.
|
ignore-auth
|
caches responses to requests with authorization, irrespective of ``Cache-control'' headers received from a server. Doing this VIOLATES the HTTP standard. Enabling this feature could make you liable for problems which it causes.
|
stale-while-revalidate=NN
|
Squid perform an asyncronous cache validation if the object isn't more stale than NN.
|
ignore-stale-while-revalidate
|
Squid ignore any 'Cache-Control:stale-while-revalidate=NN' headers received from a server.
|
max-stale=NN
|
This option provides a maximum staleness factor.
|
negative-ttl=NN
|
This overrides the global negative_ttl parameter selectively for URLs matching this pattern.
|
Example(s) refresh_pattern ^ftp: 1440 20% 10080 refresh_pattern ^gopher: 1440 0% 1440 refresh_pattern . 0 20% 4320
|
|
TAG NAME |
quick_abort_min, quick_abort_max, quick_abort_pct |
Description
|
Signals the cache how to continue downloads during abort signals sent by the clients
|
Buid Option
|
Default
|
Usage
|
quick_abort_min size quick_abort_max size quick_abort_pct percent
|
Default
|
quick_abort_min 16 KB quick_abort_max 16 KB quick_abort_pct 95
|
Synopsis
The cache by default continues downloading aborted requests which are almost completed (less than 16 KB remaining). This may be undesirable on slow (e.g. SLIP) links and/or very busy caches. Impatient users may tie up file descriptors and bandwidth by repeatedly requesting and immediately aborting downloads.
Arguments
size
|
Minimum and maximum transfer size
|
percent
|
Percentage of transfer
|
When the user aborts a request, Squid will check the quick_abort values to the amount of data transferred until then. If the transfer has less than quick_abort_min KB remaining, it will finish the retrieval. If the transfer has more than quick_abort_max KB remaining, it will abort the retrieval. If more than quick_abort_pct of the transfer has completed, it will finish the retrieval. If you do not want any retrieval to continue after the client has aborted, set both quick_abort_min and quick_abort_max to '0 KB'. If you want retrievals to always continue if they are being cached then set quick_abort_min to '-1 KB'. Example(s) quick_abort_min 30 KB quick_abort_max 30 KB quick_abort_pct 80
|
|
TAG NAME |
read_ahead_gap |
Description
|
Define the amount of data the cache will buffer ahead of what has been sent to the client when retrieving an object from another server
|
Buid Option
|
Default
|
Usage
|
read_ahead_gap buffer-size
|
Default
|
read_ahead_gap 17 KB
|
Synopsis This tag determines the prefetch cache buffer size for holding objects from another server while sending to the client. Arguments
buffer-size
|
Size of the cache buffer
|
Example(s) read_ahead_gap 30 KB
|
|
TAG NAME |
negative_ttl |
Description
|
Defines Time-to-Live (TTL) for failed requests
|
Buid Option
|
Default
|
Usage
|
negative_ttl time-units
|
Default
|
negative_ttl 5 minutes
|
Synopsis
Certain types of failures (such as "connection refused" and "404 Not Found") are negatively-cached for a configurable amount of time. The default is 5 minutes. Note that this is different from negative caching of DNS lookups.
Arguments
time-units
|
Timeout for negatively cached objects
|
Example(s) negative_ttl 1 minutes
|
|
TAG NAME |
positive_dns_ttl |
Description
|
Defines Time-to-Live (TTL) for positive caching of successful DNS lookups
|
Buid Option
|
Default
|
Usage
|
positive_dns_ttl time-units
|
Default
|
positive_dns_ttl 6 hours
|
Synopsis
For positive caching of successful DNS lookups, this defines Time-to-Live period. Default is 6 hours (360 minutes). If you want to minimize the use of Squid's ipcache, set this to 1, not 0.
Arguments
time-units
|
Timeout for positive cachings
|
Example(s) positive_dns_ttl 24 hours
|
|
TAG NAME |
negative_dns_ttl |
Description
|
Time-to-Live (TTL) for negative caching of failed DNS lookups
|
Buid Option
|
Default
|
Usage
|
negative_dns_ttl time-units
|
Default
|
negative_dns_ttl 1 minutes
|
Synopsis
Sometimes DNS lookups may get failed. This parameter defines the Time-To-Live period for failed DNS lookups. Normally this will be a small value.
Arguments
time-units
|
Timeout period
|
Example(s) negative_dns_ttl 1 minutes
|
|
TAG NAME |
range_offset_limit |
Description
|
Sets a upper limit on how far into the file a Range request may be to cause Squid to prefetch the whole file
|
Buid Option
|
Default
|
Usage
|
range_offset_limit bytes
|
Default
|
range_offset_limit 0 KB
|
Synopsis
If beyond this limit then Squid forwards the Range request as it is and the result is NOT cached. This is to stop a far ahead range request (lets say start at 17MB) from making Squid fetch the whole object up to that point before sending anything to the client. A value of -1 causes Squid to always fetch the object from the beginning so that it may cache the result. (2.0 style) A value of 0 causes Squid to never fetch more than the client requested. (default)
Arguments
bytes
|
Upper limit for the range request
|
Example(s) range_offset_limit 17 MB
|
|
TAG NAME |
collapsed_forwarding |
Description
|
Enables multiple requests for the same URI to be processed as one request.
|
Buid Option
|
Default
|
Usage
|
collapsed_forwarding on | off
|
Default
|
collapsed_forwarding off
|
Synopsis
This option enables multiple requests for the same URI to be processed as one request. Normally disabled to avoid increased latency on dynamic content, but there can be benefit from enabling this in accelerator setups where the web servers are the bottleneck and reliable and returns mostly cacheable information.
Arguments
on/off
|
Enable or disable this process
|
|
|
TAG NAME |
refresh_stale_hit |
Description
|
Changes the refresh algorithm to allow concurrent requests while an object is being refreshed to be processed.
|
Buid Option
|
Default
|
Usage
|
refresh_stale_hit time-units
|
Default
|
refresh_stale_hit 0 seconds
|
Synopsis
This option changes the refresh algorithm to allow concurrent requests while an object is being refreshed to be processed as cache hits if the object expired less than X seconds ago.
Default is 0 to disable this feature. This option is mostly interesting in accelerator setups where a few objects is accessed very frequently.
Arguments
time-units
|
Timeout for refresh
|
|
|
TAG NAME |
external_refresh_check |
Description
|
This option defines an external helper for determining whether to refresh a stale response.
|
Buid Option
|
Default
|
Usage
|
external_refresh_check [options] FORMAT.. /path/to/helper [helper_args]
|
Default
|
none
|
Synopsis
This option defines an external helper for determining whether to refresh a stale response. It will be called when Squid receives a request for a cached response that is stale.
FORMAT
%CACHE_URI
|
The URI of the cached response
|
%RES Header
|
HTTP response header value
|
%AGE
|
The age of the cached response
|
Example(s) external_refresh_check %AGE path to file
|
|