This option permits checks to reuse idle connections if available instead of
opening a dedicated one. The connection is reinserted in the pool on check
completion. The main objective is to limit the number of connections opening
- and closure on a specific server.
+ and closure on a specific server. This feature is compatible only with
+ http-check rulesets. It is silently ignored for other check types.
- Note that for configuration simplicity, this option is silently ignored if
- any specific check connect option is defined, either on the server line or
- via a custom tcp-check connect rule.
+ For configuration simplicity, this option is silently ignored if any specific
+ check connect option is defined, either on the server line or via a custom
+ tcp-check connect rule.
This option is automatically enabled for servers acting as passive reverse
HTTP gateway, as for those servers connect is only supported through reuse.
}
}
+/* Reports a diag if check-reuse-pool is active while backend check ruleset is
+ * non HTTP.
+ */
+static void srv_diag_check_reuse(int *ret, struct server *srv, struct proxy *px)
+{
+ if (srv->do_check && srv->check.reuse_pool) {
+ if ((px->tcpcheck_rules.flags & TCPCHK_RULES_PROTO_CHK) != TCPCHK_RULES_HTTP_CHK) {
+ diag_warning(ret, "parsing [%s:%d] : 'server %s': check-reuse-pool is ineffective for non http-check rulesets.\n",
+ srv->conf.file, srv->conf.line, srv->id);
+ }
+ }
+}
+
/* Perform a series of diagnostics on every servers from the configuration. */
static void run_servers_diag(int *ret)
{
struct server *srv;
for (px = proxies_list; px; px = px->next) {
- for (srv = px->srv; srv; srv = srv->next)
+ for (srv = px->srv; srv; srv = srv->next) {
srv_diag_cookies(ret, srv, &cookies_tree);
+ srv_diag_check_reuse(ret, srv, px);
+ }
/* clear the cookies tree before passing to the next proxy */
while ((cookie_node = ebpt_first(&cookies_tree))) {
struct tcpcheck_rule *next;
struct buffer *auto_sni = NULL;
int status, port;
+ int check_type;
TRACE_ENTER(CHK_EV_TCPCHK_CONN, check);
+ check_type = check->tcpcheck_rules->flags & TCPCHK_RULES_PROTO_CHK;
+
next = get_next_tcpcheck_rule(check->tcpcheck_rules, rule);
/* current connection already created, check if it is established or not */
}
}
-
- if (!(check->state & CHK_ST_AGENT) && check->reuse_pool &&
+ /* For http-check rulesets connection reuse may be used (check-reuse-pool). */
+ if (check_type == TCPCHK_RULES_HTTP_CHK && check->reuse_pool &&
!tcpcheck_use_nondefault_connect(check, connect) &&
!srv_is_transparent(s)) {
struct ist pool_conn_name = IST_NULL;