Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Varnish: Dev
[PATCH 2/2] Add a runtime parameter for expiry_log_threshold.
 

Index | Next | Previous | View Flat


martin at varnish-software

Apr 19, 2012, 7:01 AM


Views: 208
Permalink
[PATCH 2/2] Add a runtime parameter for expiry_log_threshold.

On busy servers, the logging and especially the object counters will
not reflect the work done by the expiry timer is very busy and does
not sleep (and flush the counters and log). This patch adds a
configurable maximum number of objects expired before updating the
counters and flushing the logs.
---
bin/varnishd/cache/cache_expire.c | 7 ++++++-
bin/varnishd/common/params.h | 1 +
bin/varnishd/mgt/mgt_param.c | 6 ++++++
3 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/bin/varnishd/cache/cache_expire.c b/bin/varnishd/cache/cache_expire.c
index edbd52c..dbf21aa 100644
--- a/bin/varnishd/cache/cache_expire.c
+++ b/bin/varnishd/cache/cache_expire.c
@@ -336,15 +336,19 @@ exp_timer(struct worker *wrk, void *priv)
double t;
struct object *o;
struct vsl_log vsl;
+ unsigned i = 0;

(void)priv;
VSL_Setup(&vsl, NULL, 0);
t = VTIM_real();
oc = NULL;
while (1) {
- if (oc == NULL) {
+ if (oc == NULL || i >= cache_param->expiry_log_threshold) {
VSL_Flush(&vsl, 0);
WRK_SumStat(wrk);
+ i = 0;
+ }
+ if (oc == NULL) {
VTIM_sleep(cache_param->expiry_sleep);
t = VTIM_real();
}
@@ -404,6 +408,7 @@ exp_timer(struct worker *wrk, void *priv)
Lck_Unlock(&lru->mtx);

VSC_C_main->n_expired++;
+ i++;

CHECK_OBJ_NOTNULL(oc->objhead, OBJHEAD_MAGIC);
o = oc_getobj(&wrk->stats, oc);
diff --git a/bin/varnishd/common/params.h b/bin/varnishd/common/params.h
index 6e502fd..b30a8b4 100644
--- a/bin/varnishd/common/params.h
+++ b/bin/varnishd/common/params.h
@@ -163,6 +163,7 @@ struct params {

/* Expiry pacer parameters */
double expiry_sleep;
+ unsigned expiry_log_threshold;

/* Acceptor pacer parameters */
double acceptor_sleep_max;
diff --git a/bin/varnishd/mgt/mgt_param.c b/bin/varnishd/mgt/mgt_param.c
index f6493ad..ae6d6d0 100644
--- a/bin/varnishd/mgt/mgt_param.c
+++ b/bin/varnishd/mgt/mgt_param.c
@@ -820,6 +820,12 @@ static const struct parspec input_parspec[] = {
"for it to do.\n",
0,
"1", "seconds" },
+ { "expiry_log_threshold", tweak_uint, &mgt_param.expiry_log_threshold,
+ 1, UINT_MAX,
+ "Maximum number of objects expired without the expiry thread"
+ " sleeping before flushing the log.\n",
+ 0,
+ "100", "objects" },
{ "pipe_timeout", tweak_timeout, &mgt_param.pipe_timeout, 0, 0,
"Idle timeout for PIPE sessions. "
"If nothing have been received in either direction for "
--
1.7.4.1


_______________________________________________
varnish-dev mailing list
varnish-dev [at] varnish-cache
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev

Subject User Time
[PATCH 2/2] Add a runtime parameter for expiry_log_threshold. martin at varnish-software Apr 19, 2012, 7:01 AM

  Index | Next | Previous | View Flat
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.