tuning

OPTIONS FOR TUNING THE CACHE

This section describes the important parameters that determine Squid cache performance.

wais_relay_host

wais_relay_port

request_header_max_size

request_body_max_size

refresh_pattern

quick_abort_min

quick_abort_max

quick_abort_pct

read_ahead_gap

negative_ttl

positive_dns_ttl

negative_dns_ttl

range_offset_limit

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_size size(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] regex min percent max [options]

Default

-

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.

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 16 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 5 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