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

Mailing List Archive: Varnish: Dev

[PATCH 2/2] Make the exp_timer flush the log and counters every 0.5 seconds.

 

 

Varnish dev RSS feed   Index | Next | Previous | View Threaded


martin at varnish-software

Apr 23, 2012, 1:02 AM

Post #1 of 1 (194 views)
Permalink
[PATCH 2/2] Make the exp_timer flush the log and counters every 0.5 seconds.

---
bin/varnishd/cache/cache_expire.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/bin/varnishd/cache/cache_expire.c b/bin/varnishd/cache/cache_expire.c
index 5272f8c..9e7c7d3 100644
--- a/bin/varnishd/cache/cache_expire.c
+++ b/bin/varnishd/cache/cache_expire.c
@@ -339,18 +339,22 @@ exp_timer(struct worker *wrk, void *priv)
struct objcore *oc_array[EXP_TIMER_N];
int i, n;
struct lru *lru;
- double t;
+ double t, tlog;
struct object *o;
struct vsl_log vsl;

(void)priv;
VSL_Setup(&vsl, NULL, 0);
t = VTIM_real();
+ tlog = 0;
oc = NULL;
while (1) {
- if (oc == NULL) {
+ if (t - tlog < 0.5) {
VSL_Flush(&vsl, 0);
WRK_SumStat(wrk);
+ tlog = t;
+ }
+ if (oc == NULL) {
VTIM_sleep(cache_param->expiry_sleep);
t = VTIM_real();
}
@@ -367,7 +371,7 @@ exp_timer(struct worker *wrk, void *priv)
* We may have expired so many objects that our timestamp
* got out of date, refresh it and check again.
*/
- if (oc->timer_when > t)
+ if (oc->timer_when > t || t - oc->timer_when > 0.5)
t = VTIM_real();
if (oc->timer_when > t) {
Lck_Unlock(&exp_mtx);
--
1.7.4.1


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

Varnish dev RSS feed   Index | Next | Previous | View Threaded
 
 


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