annotate README @ 24:2ee28064a04a 0.4

Keepalive: correctly close connections on gracefull shutdown. On gracefull shutdown nginx calls read handler on all idle connections with c->close set. Make sure we don't confuse such read handler calls with stale events and actually close connections. This fixes "open socket ... left in connection ..." alerts.
author Maxim Dounin <mdounin@mdounin.ru>
date Wed, 15 Dec 2010 21:12:36 +0300
parents f3e74fbd0f0b
children a84573f16a0c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
1 Keepalive balancer module for nginx.
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
2
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
3 This module implements cache for backend connections. As of now, it may
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
4 be used with memcached upstreams.
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
5
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
6 Note: don't even try it with http backends. It won't work.
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
7
22
f3e74fbd0f0b Keepalive: add CHANGES, minor documentation fixes.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7
diff changeset
8 Note: it's for nginx 0.7.* and up, won't work with nginx 0.6.*.
7
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
9
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
10 Configuration directives:
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
11
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
12 keepalive <num> [single]
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
13
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
14 Scope: upstream
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
15
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
16 Switches on keepalive module for the upstream in question.
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
17
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
18 Parameters:
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
19
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
20 - <num>
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
21 Maximum number of connections to cache. If there isn't enough
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
22 room to cache new connections - last recently used connections
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
23 will be kicked off the cache.
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
24
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
25 - single
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
26 Treat everything as single host. With this flag connections
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
27 to different backends are treated as equal.
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
28
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
29 Sample configuration:
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
30
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
31 upstream memd {
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
32 server 127.0.0.1:11211;
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
33 server 10.0.0.2:11211;
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
34 keepalive 10;
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
35 }
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
36
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
37 This module was tested to work with standard round-robin balancing, but
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
38 it's believed to be compatible with more sophisticated balancers. The only
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
39 requirement is to activate them *before* this module, e.g.:
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
40
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
41 upstream memd {
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
42 server 127.0.0.1:11211;
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
43 server 10.0.0.2:11211;
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
44 ip_hash;
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
45 keepalive 10;
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
46 }
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
47
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
48 To compile nginx with keepalive module, use "--add-module <path>" option to
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
49 nginx configure.