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. Check the documentation at nginx.org.
The upstream_keepalive module enables keep-alive connections for upstream servers. Currently it supports memcached upstreams.
Note: This will not work with HTTP upstreams.
syntax keepalive num [single]
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:
Download the module.