Mercurial > hg > nginx-quic
annotate src/http/modules/ngx_http_upstream_least_conn_module.c @ 4836:e368b822d034
Gzip static: "always" parameter in "gzip_static" directive.
With "always" gzip static returns gzipped content in all cases, without
checking if client supports it. It is useful if there are no uncompressed
files on disk anyway.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 10 Sep 2012 16:48:25 +0000 |
parents | 4c36e15651f7 |
children | a384c60d55f3 |
rev | line source |
---|---|
4654
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
1 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
2 /* |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
3 * Copyright (C) Maxim Dounin |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
4 * Copyright (C) Nginx, Inc. |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
5 */ |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
6 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
7 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
8 #include <ngx_config.h> |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
9 #include <ngx_core.h> |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
10 #include <ngx_http.h> |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
11 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
12 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
13 typedef struct { |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
14 ngx_uint_t *conns; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
15 } ngx_http_upstream_least_conn_conf_t; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
16 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
17 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
18 typedef struct { |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
19 /* the round robin data must be first */ |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
20 ngx_http_upstream_rr_peer_data_t rrp; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
21 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
22 ngx_uint_t *conns; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
23 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
24 ngx_event_get_peer_pt get_rr_peer; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
25 ngx_event_free_peer_pt free_rr_peer; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
26 } ngx_http_upstream_lc_peer_data_t; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
27 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
28 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
29 static ngx_int_t ngx_http_upstream_init_least_conn_peer(ngx_http_request_t *r, |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
30 ngx_http_upstream_srv_conf_t *us); |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
31 static ngx_int_t ngx_http_upstream_get_least_conn_peer( |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
32 ngx_peer_connection_t *pc, void *data); |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
33 static void ngx_http_upstream_free_least_conn_peer(ngx_peer_connection_t *pc, |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
34 void *data, ngx_uint_t state); |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
35 static void *ngx_http_upstream_least_conn_create_conf(ngx_conf_t *cf); |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
36 static char *ngx_http_upstream_least_conn(ngx_conf_t *cf, ngx_command_t *cmd, |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
37 void *conf); |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
38 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
39 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
40 static ngx_command_t ngx_http_upstream_least_conn_commands[] = { |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
41 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
42 { ngx_string("least_conn"), |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
43 NGX_HTTP_UPS_CONF|NGX_CONF_NOARGS, |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
44 ngx_http_upstream_least_conn, |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
45 0, |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
46 0, |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
47 NULL }, |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
48 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
49 ngx_null_command |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
50 }; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
51 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
52 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
53 static ngx_http_module_t ngx_http_upstream_least_conn_module_ctx = { |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
54 NULL, /* preconfiguration */ |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
55 NULL, /* postconfiguration */ |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
56 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
57 NULL, /* create main configuration */ |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
58 NULL, /* init main configuration */ |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
59 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
60 ngx_http_upstream_least_conn_create_conf, /* create server configuration */ |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
61 NULL, /* merge server configuration */ |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
62 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
63 NULL, /* create location configuration */ |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
64 NULL /* merge location configuration */ |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
65 }; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
66 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
67 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
68 ngx_module_t ngx_http_upstream_least_conn_module = { |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
69 NGX_MODULE_V1, |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
70 &ngx_http_upstream_least_conn_module_ctx, /* module context */ |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
71 ngx_http_upstream_least_conn_commands, /* module directives */ |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
72 NGX_HTTP_MODULE, /* module type */ |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
73 NULL, /* init master */ |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
74 NULL, /* init module */ |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
75 NULL, /* init process */ |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
76 NULL, /* init thread */ |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
77 NULL, /* exit thread */ |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
78 NULL, /* exit process */ |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
79 NULL, /* exit master */ |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
80 NGX_MODULE_V1_PADDING |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
81 }; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
82 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
83 |
4759
4c36e15651f7
Fixed compilation with -Wmissing-prototypes.
Ruslan Ermilov <ru@nginx.com>
parents:
4656
diff
changeset
|
84 static ngx_int_t |
4654
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
85 ngx_http_upstream_init_least_conn(ngx_conf_t *cf, |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
86 ngx_http_upstream_srv_conf_t *us) |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
87 { |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
88 ngx_uint_t n; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
89 ngx_http_upstream_rr_peers_t *peers; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
90 ngx_http_upstream_least_conn_conf_t *lcf; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
91 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
92 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, cf->log, 0, |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
93 "init least conn"); |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
94 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
95 if (ngx_http_upstream_init_round_robin(cf, us) != NGX_OK) { |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
96 return NGX_ERROR; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
97 } |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
98 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
99 peers = us->peer.data; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
100 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
101 n = peers->number; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
102 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
103 if (peers->next) { |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
104 n += peers->next->number; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
105 } |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
106 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
107 lcf = ngx_http_conf_upstream_srv_conf(us, |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
108 ngx_http_upstream_least_conn_module); |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
109 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
110 lcf->conns = ngx_pcalloc(cf->pool, sizeof(ngx_uint_t) * n); |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
111 if (lcf->conns == NULL) { |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
112 return NGX_ERROR; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
113 } |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
114 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
115 us->peer.init = ngx_http_upstream_init_least_conn_peer; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
116 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
117 return NGX_OK; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
118 } |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
119 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
120 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
121 static ngx_int_t |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
122 ngx_http_upstream_init_least_conn_peer(ngx_http_request_t *r, |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
123 ngx_http_upstream_srv_conf_t *us) |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
124 { |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
125 ngx_http_upstream_lc_peer_data_t *lcp; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
126 ngx_http_upstream_least_conn_conf_t *lcf; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
127 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
128 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
129 "init least conn peer"); |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
130 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
131 lcf = ngx_http_conf_upstream_srv_conf(us, |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
132 ngx_http_upstream_least_conn_module); |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
133 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
134 lcp = ngx_palloc(r->pool, sizeof(ngx_http_upstream_lc_peer_data_t)); |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
135 if (lcp == NULL) { |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
136 return NGX_ERROR; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
137 } |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
138 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
139 lcp->conns = lcf->conns; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
140 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
141 r->upstream->peer.data = &lcp->rrp; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
142 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
143 if (ngx_http_upstream_init_round_robin_peer(r, us) != NGX_OK) { |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
144 return NGX_ERROR; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
145 } |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
146 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
147 r->upstream->peer.get = ngx_http_upstream_get_least_conn_peer; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
148 r->upstream->peer.free = ngx_http_upstream_free_least_conn_peer; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
149 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
150 lcp->get_rr_peer = ngx_http_upstream_get_round_robin_peer; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
151 lcp->free_rr_peer = ngx_http_upstream_free_round_robin_peer; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
152 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
153 return NGX_OK; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
154 } |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
155 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
156 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
157 static ngx_int_t |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
158 ngx_http_upstream_get_least_conn_peer(ngx_peer_connection_t *pc, void *data) |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
159 { |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
160 ngx_http_upstream_lc_peer_data_t *lcp = data; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
161 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
162 time_t now; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
163 uintptr_t m; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
164 ngx_int_t rc, total; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
165 ngx_uint_t i, n, p, many; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
166 ngx_http_upstream_rr_peer_t *peer, *best; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
167 ngx_http_upstream_rr_peers_t *peers; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
168 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
169 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0, |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
170 "get least conn peer, try: %ui", pc->tries); |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
171 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
172 if (lcp->rrp.peers->single) { |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
173 return lcp->get_rr_peer(pc, &lcp->rrp); |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
174 } |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
175 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
176 pc->cached = 0; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
177 pc->connection = NULL; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
178 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
179 now = ngx_time(); |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
180 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
181 peers = lcp->rrp.peers; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
182 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
183 best = NULL; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
184 total = 0; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
185 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
186 #if (NGX_SUPPRESS_WARN) |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
187 many = 0; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
188 p = 0; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
189 #endif |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
190 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
191 for (i = 0; i < peers->number; i++) { |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
192 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
193 n = i / (8 * sizeof(uintptr_t)); |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
194 m = (uintptr_t) 1 << i % (8 * sizeof(uintptr_t)); |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
195 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
196 if (lcp->rrp.tried[n] & m) { |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
197 continue; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
198 } |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
199 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
200 peer = &peers->peer[i]; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
201 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
202 if (peer->down) { |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
203 continue; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
204 } |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
205 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
206 if (peer->max_fails |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
207 && peer->fails >= peer->max_fails |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
208 && now - peer->checked <= peer->fail_timeout) |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
209 { |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
210 continue; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
211 } |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
212 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
213 /* |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
214 * select peer with least number of connections; if there are |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
215 * multiple peers with the same number of connections, select |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
216 * based on round-robin |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
217 */ |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
218 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
219 if (best == NULL |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
220 || lcp->conns[i] * best->weight < lcp->conns[p] * peer->weight) |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
221 { |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
222 best = peer; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
223 many = 0; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
224 p = i; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
225 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
226 } else if (lcp->conns[i] * best->weight |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
227 == lcp->conns[p] * peer->weight) |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
228 { |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
229 many = 1; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
230 } |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
231 } |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
232 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
233 if (best == NULL) { |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
234 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, pc->log, 0, |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
235 "get least conn peer, no peer found"); |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
236 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
237 goto failed; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
238 } |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
239 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
240 if (many) { |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
241 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, pc->log, 0, |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
242 "get least conn peer, many"); |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
243 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
244 for (i = p; i < peers->number; i++) { |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
245 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
246 n = i / (8 * sizeof(uintptr_t)); |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
247 m = (uintptr_t) 1 << i % (8 * sizeof(uintptr_t)); |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
248 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
249 if (lcp->rrp.tried[n] & m) { |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
250 continue; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
251 } |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
252 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
253 peer = &peers->peer[i]; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
254 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
255 if (peer->down) { |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
256 continue; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
257 } |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
258 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
259 if (lcp->conns[i] * best->weight != lcp->conns[p] * peer->weight) { |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
260 continue; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
261 } |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
262 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
263 if (peer->max_fails |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
264 && peer->fails >= peer->max_fails |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
265 && now - peer->checked <= peer->fail_timeout) |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
266 { |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
267 continue; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
268 } |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
269 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
270 peer->current_weight += peer->effective_weight; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
271 total += peer->effective_weight; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
272 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
273 if (peer->effective_weight < peer->weight) { |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
274 peer->effective_weight++; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
275 } |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
276 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
277 if (peer->current_weight > best->current_weight) { |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
278 best = peer; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
279 p = i; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
280 } |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
281 } |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
282 } |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
283 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
284 best->current_weight -= total; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
285 best->checked = now; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
286 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
287 pc->sockaddr = best->sockaddr; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
288 pc->socklen = best->socklen; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
289 pc->name = &best->name; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
290 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
291 lcp->rrp.current = p; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
292 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
293 n = p / (8 * sizeof(uintptr_t)); |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
294 m = (uintptr_t) 1 << p % (8 * sizeof(uintptr_t)); |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
295 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
296 lcp->rrp.tried[n] |= m; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
297 lcp->conns[p]++; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
298 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
299 if (pc->tries == 1 && peers->next) { |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
300 pc->tries += peers->next->number; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
301 } |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
302 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
303 return NGX_OK; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
304 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
305 failed: |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
306 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
307 if (peers->next) { |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
308 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, pc->log, 0, |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
309 "get least conn peer, backup servers"); |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
310 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
311 lcp->conns += peers->number; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
312 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
313 lcp->rrp.peers = peers->next; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
314 pc->tries = lcp->rrp.peers->number; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
315 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
316 n = lcp->rrp.peers->number / (8 * sizeof(uintptr_t)) + 1; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
317 for (i = 0; i < n; i++) { |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
318 lcp->rrp.tried[i] = 0; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
319 } |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
320 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
321 rc = ngx_http_upstream_get_least_conn_peer(pc, lcp); |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
322 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
323 if (rc != NGX_BUSY) { |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
324 return rc; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
325 } |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
326 } |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
327 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
328 /* all peers failed, mark them as live for quick recovery */ |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
329 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
330 for (i = 0; i < peers->number; i++) { |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
331 peers->peer[i].fails = 0; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
332 } |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
333 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
334 pc->name = peers->name; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
335 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
336 return NGX_BUSY; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
337 } |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
338 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
339 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
340 static void |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
341 ngx_http_upstream_free_least_conn_peer(ngx_peer_connection_t *pc, |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
342 void *data, ngx_uint_t state) |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
343 { |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
344 ngx_http_upstream_lc_peer_data_t *lcp = data; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
345 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
346 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, pc->log, 0, |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
347 "free least conn peer %ui %ui", pc->tries, state); |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
348 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
349 if (lcp->rrp.peers->single) { |
4656
90ddd4abfdd2
Upstream: least_conn compilation fixes.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4654
diff
changeset
|
350 lcp->free_rr_peer(pc, &lcp->rrp, state); |
90ddd4abfdd2
Upstream: least_conn compilation fixes.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4654
diff
changeset
|
351 return; |
4654
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
352 } |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
353 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
354 if (state == 0 && pc->tries == 0) { |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
355 return; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
356 } |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
357 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
358 lcp->conns[lcp->rrp.current]--; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
359 |
4656
90ddd4abfdd2
Upstream: least_conn compilation fixes.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4654
diff
changeset
|
360 lcp->free_rr_peer(pc, &lcp->rrp, state); |
4654
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
361 } |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
362 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
363 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
364 static void * |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
365 ngx_http_upstream_least_conn_create_conf(ngx_conf_t *cf) |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
366 { |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
367 ngx_http_upstream_least_conn_conf_t *conf; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
368 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
369 conf = ngx_pcalloc(cf->pool, |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
370 sizeof(ngx_http_upstream_least_conn_conf_t)); |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
371 if (conf == NULL) { |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
372 return NULL; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
373 } |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
374 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
375 /* |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
376 * set by ngx_pcalloc(): |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
377 * |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
378 * conf->conns = NULL; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
379 */ |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
380 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
381 return conf; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
382 } |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
383 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
384 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
385 static char * |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
386 ngx_http_upstream_least_conn(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
387 { |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
388 ngx_http_upstream_srv_conf_t *uscf; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
389 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
390 uscf = ngx_http_conf_get_module_srv_conf(cf, ngx_http_upstream_module); |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
391 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
392 uscf->peer.init_upstream = ngx_http_upstream_init_least_conn; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
393 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
394 uscf->flags = NGX_HTTP_UPSTREAM_CREATE |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
395 |NGX_HTTP_UPSTREAM_WEIGHT |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
396 |NGX_HTTP_UPSTREAM_MAX_FAILS |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
397 |NGX_HTTP_UPSTREAM_FAIL_TIMEOUT |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
398 |NGX_HTTP_UPSTREAM_DOWN |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
399 |NGX_HTTP_UPSTREAM_BACKUP; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
400 |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
401 return NGX_CONF_OK; |
a2ca3a6ee680
Upstream: least_conn balancer module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
402 } |