FAQ

Page Discussion History

Difference between revisions of "HttpUpstreamKeepaliveModule"

(Installation)
 
Line 1: Line 1:
 
= ngx_http_upstream_keepalive =
 
= ngx_http_upstream_keepalive =
 +
 +
"HEADS UP: Description below is obsolete and needs editing.  Keepalive connections to upstream servers are in the main code since 1.1.4, including the latest stable branch of 1.2.x"
  
 
''This module is not distributed with the Nginx source. Installation instructions are [[#Installation|below]].''
 
''This module is not distributed with the Nginx source. Installation instructions are [[#Installation|below]].''

Revision as of 09:25, 7 June 2012

ngx_http_upstream_keepalive

"HEADS UP: Description below is obsolete and needs editing. Keepalive connections to upstream servers are in the main code since 1.1.4, including the latest stable branch of 1.2.x"

This module is not distributed with the Nginx source. Installation instructions are below.

The upstream_keepalive module enables keep-alive connections for upstream servers. Currently it supports memcached upstreams.

Note: This will not work with HTTP upstreams.

Example:

upstream memcached {
  server 10.0.0.1:11211;
  server 10.0.0.2:11211;
  keepalive 1024 single;
}

keepalive

syntax keepalive num [single]

context upstream

Enables keep-alive connections for the upstream.

Num specifies the max number of connections to keep open before, if the max is reached it will close the least recently used connections.

Single treats everything as a single host. With this flag connections to different backends are treated as equal.

This module was tested to work with standard round-robin balancing, but it's believed to be compatible with more sophisticated balancers. The only requirement is to activate them *before* this module, e.g:

upstream memcached {
  server 10.0.0.1:11211;
  server 10.0.0.2:11211;
  ip_hash;
  keepalive 512;
}

Installation

Download the module.

  --add-module=<path>