timeout

TIMEOUT

Timeout parameters in Squid can be based on overall connection timeouts, peer-specific timeouts, site/domain-specific timeouts, request-specific timeouts etc. Proper setting of timeout values is critical to optimal Squid performance. Relevant parameters for timeout settings are listed here.

connect_timeout

peer_connect_timeout

read_timeout

request_timeout

persistent_request_timeout

client_lifetime

half_closed_clients

pconn_timeout

ident_timeout

shutdown_lifetime

TAG NAME

connect_timeout

Description

An option to force Squid to close connections after a specified time

Build Option

Default

Usage

connect_timeout time-units

Default

connect_timeout 2 minutes

Synopsis
Some systems (notably older Linux versions) can not be relied upon to time out connect requests. For this reason, this option specifies the timeout for how long Squid should wait for the connection to complete. This value defaults to 120 seconds (2 minutes).

Arguments

time-units

Connection timeout period

Example(s)
connect_timeout 180 seconds

TAG NAME

peer_connect_timeout

Description

This parameter specifies how long to wait for a pending TCP connection to a peer cache

Build Option

Default

Usage

peer_connect_timeout time-units

Default

peer_connect_timeout 30 seconds

Synopsis
default is 30 seconds. You may also set different timeout values for individual neighbors with the 'connect-timeout' option on a cache_peer line.

Note: Setting of peer_connect_timeout to more than 30 seconds will be a performance issue.

Arguments

time-units

Time to wait for pending TCP connection

Example(s)
peer_connect_timeout 45 seconds

TAG NAME

read_timeout

Description

Used to set the timeout period for server-side connections

Build Option

Default

Usage

read_timeout time-units

Default

read_timeout 15 minutes

Synopsis
On each successful read() request the timeout is reset to this amount. If no data is read within this period of time, the request is aborted and logged with ERR_READ_TIMEOUT.

Arguments

time-units

Reset time duration

Example(s)
read_timeout 10 minutes

TAG NAME

request_timeout

Description

Defines the timeout for HTTP requests from clients

Build Option

Default

Usage

request_timeout time-units

Default

request_timeout 5 minutes

Synopsis
Using this, instruct Squid to wait for an HTTP request after initial connection establishment. By default the value is 5 minutes.

Arguments

time-units

Wait time period after initial connection establishment

Example(s)
request_timeout 8 minutes

TAG NAME

persistent_request_timeout

Description

This defines the time period to wait for the next HTTP request on a persistent connection after the previous request
completes

Build Option

Default

Usage

persistent_request_timeout time-units

Default

persistent_request_timeout 1 minute

Synopsis
This tag defines the time period between completion of a HTTP request and starting of the next request on persistent connection.

Arguments

time-units

Time duration between the requests

Example(s)
persistent_request_timeout 1 minute

TAG NAME

client_lifetime

Description

The time limit Squid sets for a client to remain connected to the cache process

Build Option

Default

Usage

client_lifetime time-units

Default

client_lifetime 1 day

Synopsis

This defines the maximum amount of time that a client (browser) is allowed to remain connected to the cache process. This is merely a safeguard against clients that disappear without properly shutting down. It is designed to prevent a large number of sockets from being tied up in a CLOSE_WAIT state. The default for this option is 1440 minutes, or 1 day.

Note: The default value is intended to be much larger than any client would ever need to be connected to your cache. You should probably change client_lifetime only as a last resort. If you seem to have many client connections tying up file descriptors, we recommend first tuning the read_timeout, request_timeout, pconn_timeout and quick_abort values. If the more file descriptors are in use then the memory in use will also increase, which is also a performance issue.

Arguments

time-units

Client lifetime with the cache

Example(s)
client_lifetime 1000 minutes

TAG NAME

half_closed_clients

Description

Defines Squid's behavior towards some types of clients that close the sending side of a connection while leaving the
receiving side open

Build Option

Default

Usage

half_closed_clients on/off

Default

half_closed_clients on

Synopsis
Turning this option off will cause Squid to immediately close connections when a read(2) returns "no more data to read". It's usually safe to leave this at the default value of on.

Arguments

on/off

Enable or disable this action

Example(s)
half_closed_clients off

TAG NAME

pconn_timeout

Description

Defines the timeout value for persistent connections

Build Option

Default

Usage

pconn_timeout time-units

Default

pconn_timeout 120 seconds

Synopsis
When this timeout is set, Squid will close persistent connections if they are idle for this amount of time. Persistent connections will be disabled entirely if this option is set to a value less than 10 seconds. The default is 120 seconds.

Arguments

time-units

Time period to wait for closing idle connections

Example(s)
pconn_timeout 2 minutes

TAG NAME

ident_timeout

Description

Maximum time to wait for IDENT lookups to complete

Build Option

Default

Usage

ident_timeout time-units

Default

ident_timeout 10 seconds

Synopsis
The timeout, usually in seconds. If this is set too high, you may be susceptible to denial or service from having too many outstanding ident requests. The default for this is 10 seconds.

Arguments

time-units

Time duration to wait during ident lookups

Example(s)
ident_timeout 5 seconds

TAG NAME

shutdown_lifetime

Description

This is the time Squid allows for existing connections to continue after it has received a shutdown signal

Build Option

Default

Usage

shutdown_lifetime time-units

Default

shutdown_lifetime 30 seconds

Synopsis
When SIGTERM or SIGHUP is received, the cache is put into "shutdown pending" mode until all active sockets are closed. It will stop accepting new connections immediately, but connections already in progress will continue to be served for this amount of time. Defaults to 30 seconds, which is a good safe value. Any active clients after this many seconds will receive a "timeout" message.

Note: If this time is set to be too low then some file descriptors may remain open which will be a performance issue in memory usage.

Arguments

time-units

Time period of "shutdown pending" mode

Example(s)
shutdown_lifetime 20 seconds