Manage connections

Caching Proxy creates a new thread to handle each client request. If no threads are available, the proxy server holds requests until more threads become available.

As the number of active threads increases, the proxy server consumes more memory. Specify the maximum number of active threads as the value for the MaxActiveThreads directive.

The listen backlog is the number of pending requests for client connections that the server logs before it refuses connections with new clients. Base this setting on the number of requests that the server can process in a few seconds. A server must respond to a client connection before it times out. Specify the maximum number of connections that can be held in the backlog as the value for the ListenBacklog directive.

The proxy server can maintain persistent client/server connections. With a persistent connection, the server accepts multiple requests from the client and sends responses over the same TCP/IP connection. Using persistent connections reduces latency for clients and lowers the CPU load on the proxy server, at the low cost of a small increase in server memory. Overall throughput is increased when the server does not establish a separate TCP/IP connection for each request and response, and the TCP/IP connection can be used with greatest efficiency when the connection is persistent.

Server-side connection pooling applies the benefits of persistent connections on the server side by allowing the reuse of existing connections between a proxy server and the origin servers. Each reused connection saves three TCP packets (two 3-way handshake packets to set up the connection, and one to close it). The benefits of server-side connection pooling include:
  • Less network congestion (by minimizing the opening and closing of connections)
  • Less CPU time that is used in routers, clients, and servers
  • Less memory that is used on clients and servers
  • On cache misses, quicker proxy response (by avoiding opening and closing connections)
Note: Connection pooling is recommended only in a controlled environment. It can degrade performance where the origin servers are not HTTP 1.1 compliant. Note also that it is critical that the origin servers are set up properly. The following is a simple example from the Apache 1.3.19 configuration file:
  • #KeepAlive: Whether or not to allow persistent connections (more than one request per #connection). Set to Off to deactivate#
  • KeepAlive On
  • #MaxKeepAliveRequests: The maximum number of requests to allow during a persistent connection. Set to 0 to allow an unlimited amount. Leave this number high for maximum performance#
  • Max KeepAliveRequests 0
  • #KeepAliveTimeout: Number of seconds to wait for the next request from the same client on the same connection#
  • KeepAliveTimeout 240
These settings keep connections to the web servers open as long as they are being used and allow the proxy, rather than the origin server, to manage the connections. Therefore, the connections are pooled only when needed.

When server-side connection pooling is enabled, HTTP connections to the origin servers are pooled. SSL connections are also pooled in configurations where the SSLEnable directive for the proxy is set to on.

Configure how connection pooling is maintained by specifying the maximum number of idle sockets to hold per server at any one time, how long the server waits before terminating an idle persistent connection, and the time interval at which the garbage collection thread checks for timed-out connections (the default is 2 minutes).

Define the amount of time that various connections remain open as values for the InputTimeout,OutputTimeout, PersistTimeout, ReadTimeout, and ScriptTimeout directives.

Associated directives

Configuration and Administration forms

The following Configuration and Administration forms edit the values of the associated directives:

  • Server Configuration –> System Management –> Performance –> Maximum number of active threads
  • Server Configuration –> System Management –> Performance –> Size of listen backlog
  • Proxy Configuration –> Proxy Performance –> Allow persistent connections
  • Server Configuration –> System Management –> Performance –> Maximum Requests
  • Server Configuration –> System Management –> Performance –> Persist timeout
  • Server Configuration –> System Management –> Timeouts –> Input timeout
  • Server Configuration –> System Management –> Timeouts –> Read timeout
  • Server Configuration –> System Management –> Timeouts –> Output timeout
  • Server Configuration –> System Management –> Timeouts –> Script timeout
  • Server Configuration –> System Management –> Timeouts –> Persist timeout
Note:
  1. You cannot use the Configuration and Administration forms to edit the ServerConnPool, MaxsocketPerServer, ServerConnTimeout, or ServerConnGCRun directives.
  2. The PersistTimeout can be edited from either the Server Configuration –> System Management –> Performance form or the Server Configuration –> System Management –> Timeouts form.