annotate README @ 42:c53e018dbcf5

Keepalive: do not reject connections with ready flag set. Instead, call read event handler explicitly to test if there are actually any unexpected data. This fixes unbuffered proxy connections not being cached with epoll and rtsig event methods.
author Maxim Dounin <mdounin@mdounin.ru>
date Thu, 08 Sep 2011 17:12:07 +0400
parents a84573f16a0c
children 489c5d4318ff
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
35
a84573f16a0c Keepalive: update docs.
Maxim Dounin <mdounin@mdounin.ru>
parents: 22
diff changeset
4 be used with memcached upstreams. Support for fastcgi, http and https
a84573f16a0c Keepalive: update docs.
Maxim Dounin <mdounin@mdounin.ru>
parents: 22
diff changeset
5 requires expiremental patches for nginx.
7
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
6
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
7 Configuration directives:
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
8
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
9 keepalive <num> [single]
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
10
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
11 Scope: upstream
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
12
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
13 Switches on keepalive module for the upstream in question.
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
14
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
15 Parameters:
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
16
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
17 - <num>
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
18 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
19 room to cache new connections - last recently used connections
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
20 will be kicked off the cache.
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
21
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
22 - single
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
23 Treat everything as single host. With this flag connections
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
24 to different backends are treated as equal.
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
25
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
26 Sample configuration:
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
27
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
28 upstream memd {
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
29 server 127.0.0.1:11211;
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
30 server 10.0.0.2:11211;
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
31 keepalive 10;
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
32 }
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
33
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
34 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
35 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
36 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
37
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
38 upstream memd {
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
39 server 127.0.0.1:11211;
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
40 server 10.0.0.2:11211;
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
41 ip_hash;
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
42 keepalive 10;
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
43 }
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
44
c1a2ef20a2a7 Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff changeset
45 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
46 nginx configure.