[master] a4747b3 Add a parameter to tune the backend connection idle timeout.
Poul-Henning Kamp
phk at FreeBSD.org
Tue Jun 23 13:16:24 CEST 2015
commit a4747b3e39a53bdc250f1a404c410ad534510fa3
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Jun 23 11:16:03 2015 +0000
Add a parameter to tune the backend connection idle timeout.
diff --git a/bin/varnishd/cache/cache_backend_tcp.c b/bin/varnishd/cache/cache_backend_tcp.c
index c9d57d1..75f216d 100644
--- a/bin/varnishd/cache/cache_backend_tcp.c
+++ b/bin/varnishd/cache/cache_backend_tcp.c
@@ -60,7 +60,6 @@ struct tcp_pool {
struct lock mtx;
struct waitfor waitfor;
- volatile double timeout;
VTAILQ_HEAD(, vbc) connlist;
int n_conn;
@@ -165,10 +164,9 @@ VBT_Ref(const struct suckaddr *ip4, const struct suckaddr *ip6)
VTAILQ_INIT(&tp->connlist);
VTAILQ_INIT(&tp->killlist);
VTAILQ_INSERT_HEAD(&pools, tp, list);
- tp->timeout = 60;
INIT_OBJ(&tp->waitfor, WAITFOR_MAGIC);
tp->waitfor.func = tcp_handle;
- tp->waitfor.tmo = &tp->timeout;
+ tp->waitfor.tmo = &cache_param->backend_idle_timeout;
return (tp);
}
diff --git a/bin/varnishd/cache/cache_vcl.c b/bin/varnishd/cache/cache_vcl.c
index 40b630a..6df2a2f 100644
--- a/bin/varnishd/cache/cache_vcl.c
+++ b/bin/varnishd/cache/cache_vcl.c
@@ -330,7 +330,7 @@ VCL_Name(const struct vcl *vcl)
const struct vrt_backend_probe *
VCL_DefaultProbe(const struct vcl *vcl)
{
-
+
CHECK_OBJ_NOTNULL(vcl, VCL_MAGIC);
return (vcl->conf->default_probe);
}
diff --git a/include/tbl/params.h b/include/tbl/params.h
index 1581374..22addb0 100644
--- a/include/tbl/params.h
+++ b/include/tbl/params.h
@@ -195,6 +195,20 @@ PARAM(
/* func */ NULL
)
+PARAM(
+ /* name */ backend_idle_timeout,
+ /* tweak */ timeout,
+ /* min */ "1",
+ /* max */ NULL,
+ /* default */ "60",
+ /* units */ "seconds",
+ /* flags */ 0,
+ /* s-text */
+ "Timeout before we close unused backend connections.",
+ /* l-text */ "",
+ /* func */ NULL
+)
+
/**********************************************************************/
#if 0 /* NOT YET */
More information about the varnish-commit
mailing list