r4185 - in trunk/varnish-cache: bin/varnishd bin/varnishtest/tests include lib/libvcl
phk at projects.linpro.no
phk at projects.linpro.no
Mon Aug 17 13:53:02 CEST 2009
Author: phk
Date: 2009-08-17 13:53:01 +0200 (Mon, 17 Aug 2009)
New Revision: 4185
Modified:
trunk/varnish-cache/bin/varnishd/cache_backend_poll.c
trunk/varnish-cache/bin/varnishtest/tests/r00306.vtc
trunk/varnish-cache/bin/varnishtest/tests/s00002.vtc
trunk/varnish-cache/bin/varnishtest/tests/v00014.vtc
trunk/varnish-cache/include/vrt.h
trunk/varnish-cache/lib/libvcl/vcc_backend.c
trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c
Log:
Add a ".initial" property to backend probe specifications.
This is the number of good probes we pretend to have already seen when
we start up, in order to speed up getting healthy backends.
The default value is one less than the .threshold, so the backend
will be set healthy if it manages to respond correctly to the very
first probe we send to it.
(A bit of this commit leaked in during r4184)
Modified: trunk/varnish-cache/bin/varnishd/cache_backend_poll.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_backend_poll.c 2009-08-17 11:26:19 UTC (rev 4184)
+++ trunk/varnish-cache/bin/varnishd/cache_backend_poll.c 2009-08-17 11:53:01 UTC (rev 4185)
@@ -306,9 +306,6 @@
vt->backend->vcl_name, logmsg, bits,
vt->good, vt->probe.threshold, vt->probe.window,
vt->last, vt->avg, vt->resp_buf);
-
- if (!vt->stop)
- TIM_sleep(vt->probe.interval);
}
/*--------------------------------------------------------------------
@@ -340,24 +337,20 @@
if (vt->probe.threshold == 0)
vt->probe.threshold = 3;
- if (vt->probe.threshold == ~0)
+ if (vt->probe.threshold == ~0U)
vt->probe.initial = vt->probe.threshold - 1;
if (vt->probe.initial > vt->probe.threshold)
vt->probe.initial = vt->probe.threshold;
-printf("Initial %u\n", vt->probe.initial);
-
printf("Probe(\"%s\", %g, %g)\n",
vt->req, vt->probe.timeout, vt->probe.interval);
-if (0) {
for (u = 0; u < vt->probe.initial; u++) {
vbp_start_poke(vt);
vt->happy |= 1;
vbp_has_poked(vt);
}
-}
while (!vt->stop) {
vbp_start_poke(vt);
Modified: trunk/varnish-cache/bin/varnishtest/tests/r00306.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/r00306.vtc 2009-08-17 11:26:19 UTC (rev 4184)
+++ trunk/varnish-cache/bin/varnishtest/tests/r00306.vtc 2009-08-17 11:53:01 UTC (rev 4185)
@@ -27,6 +27,7 @@
.host = "127.0.0.1"; .port = "9180";
.probe = {
.url = "/";
+ .initial = 0;
}
}
director foo random {
Modified: trunk/varnish-cache/bin/varnishtest/tests/s00002.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/s00002.vtc 2009-08-17 11:26:19 UTC (rev 4184)
+++ trunk/varnish-cache/bin/varnishtest/tests/s00002.vtc 2009-08-17 11:53:01 UTC (rev 4185)
@@ -18,6 +18,7 @@
.interval = 1s;
.window = 2;
.threshold = 1;
+ .initial = 0;
}
}
sub vcl_fetch {
Modified: trunk/varnish-cache/bin/varnishtest/tests/v00014.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/v00014.vtc 2009-08-17 11:26:19 UTC (rev 4184)
+++ trunk/varnish-cache/bin/varnishtest/tests/v00014.vtc 2009-08-17 11:53:01 UTC (rev 4185)
@@ -20,6 +20,7 @@
.interval = 1s;
.window = 3;
.threshold = 2;
+ .initial = 0;
}
}
Modified: trunk/varnish-cache/include/vrt.h
===================================================================
--- trunk/varnish-cache/include/vrt.h 2009-08-17 11:26:19 UTC (rev 4184)
+++ trunk/varnish-cache/include/vrt.h 2009-08-17 11:53:01 UTC (rev 4185)
@@ -54,6 +54,7 @@
double interval;
unsigned window;
unsigned threshold;
+ unsigned initial;
};
/*
Modified: trunk/varnish-cache/lib/libvcl/vcc_backend.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_backend.c 2009-08-17 11:26:19 UTC (rev 4184)
+++ trunk/varnish-cache/lib/libvcl/vcc_backend.c 2009-08-17 11:53:01 UTC (rev 4185)
@@ -341,7 +341,8 @@
struct fld_spec *fs;
struct token *t_field;
struct token *t_did = NULL, *t_window = NULL, *t_threshold = NULL;
- unsigned window, threshold;
+ struct token *t_initial = NULL;
+ unsigned window, threshold, initial;
fs = vcc_FldSpec(tl,
"?url",
@@ -350,6 +351,7 @@
"?interval",
"?window",
"?threshold",
+ "?initial",
NULL);
ExpectErr(tl, '{');
@@ -357,6 +359,7 @@
window = 0;
threshold = 0;
+ initial = 0;
Fb(tl, 0, "\t.probe = {\n");
while (tl->t->tok != '}') {
@@ -397,6 +400,11 @@
window = vcc_UintVal(tl);
vcc_NextToken(tl);
ERRCHK(tl);
+ } else if (vcc_IdIs(t_field, "initial")) {
+ t_initial = tl->t;
+ initial = vcc_UintVal(tl);
+ vcc_NextToken(tl);
+ ERRCHK(tl);
} else if (vcc_IdIs(t_field, "threshold")) {
t_threshold = tl->t;
threshold = vcc_UintVal(tl);
@@ -442,8 +450,12 @@
vcc_ErrWhere(tl, t_window);
}
Fb(tl, 0, "\t\t.window = %u,\n", window);
- Fb(tl, 0, "\t\t.threshold = %u\n", threshold);
+ Fb(tl, 0, "\t\t.threshold = %u,\n", threshold);
}
+ if (t_initial != NULL)
+ Fb(tl, 0, "\t\t.initial = %u,\n", initial);
+ else
+ Fb(tl, 0, "\t\t.initial = ~0U,\n", initial);
Fb(tl, 0, "\t},\n");
ExpectErr(tl, '}');
vcc_NextToken(tl);
Modified: trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2009-08-17 11:26:19 UTC (rev 4184)
+++ trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2009-08-17 11:53:01 UTC (rev 4185)
@@ -1,5 +1,5 @@
/*
- * $Id: vcc_gen_fixed_token.tcl 4099 2009-06-08 21:40:48Z phk $
+ * $Id: vcc_gen_fixed_token.tcl 4100 2009-06-09 10:41:38Z phk $
*
* NB: This file is machine generated, DO NOT EDIT!
*
@@ -159,8 +159,8 @@
/* ../../include/vcl.h */
- vsb_cat(sb, "/*\n * $Id: vcc_gen_fixed_token.tcl 4099 2009-06-08 21");
- vsb_cat(sb, ":40:48Z phk $\n *\n * NB: This file is machine genera");
+ vsb_cat(sb, "/*\n * $Id: vcc_gen_fixed_token.tcl 4100 2009-06-09 10");
+ vsb_cat(sb, ":41:38Z phk $\n *\n * NB: This file is machine genera");
vsb_cat(sb, "ted, DO NOT EDIT!\n *\n * Edit and run vcc_gen_fixed_t");
vsb_cat(sb, "oken.tcl instead\n */\n\nstruct sess;\n");
vsb_cat(sb, "struct cli;\n\ntypedef void vcl_init_f(struct cli *);\n");
@@ -242,12 +242,12 @@
vsb_cat(sb, "\nstruct vrt_backend_probe {\n\tconst char\t*url;\n");
vsb_cat(sb, "\tconst char\t*request;\n\tdouble\t\ttimeout;\n");
vsb_cat(sb, "\tdouble\t\tinterval;\n\tunsigned\twindow;\n");
- vsb_cat(sb, "\tunsigned\tthreshold;\n};\n\n/*\n");
- vsb_cat(sb, " * A backend is a host+port somewhere on the network\n");
- vsb_cat(sb, " */\nstruct vrt_backend {\n\tconst char\t\t\t*vcl_name");
- vsb_cat(sb, ";\n\tconst char\t\t\t*ident;\n\n");
- vsb_cat(sb, "\tconst char\t\t\t*hosthdr;\n\n");
- vsb_cat(sb, "\tconst unsigned char\t\t*ipv4_sockaddr;\n");
+ vsb_cat(sb, "\tunsigned\tthreshold;\n\tunsigned\tinitial;\n");
+ vsb_cat(sb, "};\n\n/*\n * A backend is a host+port somewhere on the");
+ vsb_cat(sb, " network\n */\nstruct vrt_backend {\n");
+ vsb_cat(sb, "\tconst char\t\t\t*vcl_name;\n\tconst char\t\t\t*ident");
+ vsb_cat(sb, ";\n\n\tconst char\t\t\t*hosthdr;\n");
+ vsb_cat(sb, "\n\tconst unsigned char\t\t*ipv4_sockaddr;\n");
vsb_cat(sb, "\tconst unsigned char\t\t*ipv6_sockaddr;\n");
vsb_cat(sb, "\n\tdouble\t\t\t\tconnect_timeout;\n");
vsb_cat(sb, "\tdouble\t\t\t\tfirst_byte_timeout;\n");
@@ -319,8 +319,8 @@
/* ../../include/vrt_obj.h */
- vsb_cat(sb, "/*\n * $Id: vcc_gen_obj.tcl 4066 2009-05-10 21:21:36Z ");
- vsb_cat(sb, "sky $\n *\n * NB: This file is machine generated, DO ");
+ vsb_cat(sb, "/*\n * $Id: vcc_gen_obj.tcl 4099 2009-06-08 21:40:48Z ");
+ vsb_cat(sb, "phk $\n *\n * NB: This file is machine generated, DO ");
vsb_cat(sb, "NOT EDIT!\n *\n * Edit vcc_gen_obj.tcl instead\n");
vsb_cat(sb, " */\n\nstruct sockaddr * VRT_r_client_ip(const struct ");
vsb_cat(sb, "sess *);\nstruct sockaddr * VRT_r_server_ip(struct ses");
More information about the varnish-commit
mailing list