Mercurial > hg > ngx_http_upstream_keepalive
annotate README @ 45:489c5d4318ff draft
Keepalive: "single" parameter deprecated.
The original idea was to optimize edge cases in case of interchangeable
backends, i.e. don't establish a new connection if we have any one
cached. This causes more harm than good though, as it screws up
underlying balancer's idea about backends used and may result in
various unexpected problems.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 25 Jun 2012 22:55:53 +0400 |
parents | a84573f16a0c |
children | 92125e266aa4 |
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 | 4 be used with memcached upstreams. Support for fastcgi, http and https |
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 Sample configuration: |
c1a2ef20a2a7
Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
23 |
c1a2ef20a2a7
Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
24 upstream memd { |
c1a2ef20a2a7
Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
25 server 127.0.0.1:11211; |
c1a2ef20a2a7
Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
26 server 10.0.0.2:11211; |
c1a2ef20a2a7
Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
27 keepalive 10; |
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 |
c1a2ef20a2a7
Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
30 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
|
31 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
|
32 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
|
33 |
c1a2ef20a2a7
Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
34 upstream memd { |
c1a2ef20a2a7
Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
35 server 127.0.0.1:11211; |
c1a2ef20a2a7
Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
36 server 10.0.0.2:11211; |
c1a2ef20a2a7
Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
37 ip_hash; |
c1a2ef20a2a7
Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
38 keepalive 10; |
c1a2ef20a2a7
Keepalive: add license and some documentation.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
39 } |
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 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
|
42 nginx configure. |