view README @ 27:f3b50effc1d4

Keepalive: add proxy tests.
author Maxim Dounin <>
date Tue, 26 Jul 2011 12:52:34 +0400
parents f3e74fbd0f0b
children a84573f16a0c
line wrap: on
line source

Keepalive balancer module for nginx.

This module implements cache for backend connections.  As of now, it may
be used with memcached upstreams.

Note: don't even try it with http backends.  It won't work.

Note: it's for nginx 0.7.* and up, won't work with nginx 0.6.*.

Configuration directives:

    keepalive <num> [single]

        Scope: upstream

        Switches on keepalive module for the upstream in question.


            - <num>
              Maximum number of connections to cache.  If there isn't enough
              room to cache new connections - last recently used connections
              will be kicked off the cache.

            - single
              Treat everything as single host.  With this flag connections
              to different backends are treated as equal.

Sample configuration:

    upstream memd {
        keepalive 10;

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 memd {
        keepalive 10;

To compile nginx with keepalive module, use "--add-module <path>" option to
nginx configure.