r2557 - in trunk/varnish-cache: bin/varnishd include
phk at projects.linpro.no
phk at projects.linpro.no
Fri Mar 7 11:58:12 CET 2008
Author: phk
Date: 2008-03-07 11:58:12 +0100 (Fri, 07 Mar 2008)
New Revision: 2557
Modified:
trunk/varnish-cache/bin/varnishd/cache.h
trunk/varnish-cache/bin/varnishd/cache_center.c
trunk/varnish-cache/bin/varnishd/cache_expire.c
trunk/varnish-cache/bin/varnishd/cache_synthetic.c
trunk/varnish-cache/bin/varnishd/shmlog.c
trunk/varnish-cache/include/stat_field.h
Log:
Keep track of how often we flush the private shm buffer due to overflows.
Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h 2008-03-07 10:36:40 UTC (rev 2556)
+++ trunk/varnish-cache/bin/varnishd/cache.h 2008-03-07 10:58:12 UTC (rev 2557)
@@ -520,7 +520,7 @@
void VSL(enum shmlogtag tag, int id, const char *fmt, ...);
void WSLR(struct worker *w, enum shmlogtag tag, int id, txt t);
void WSL(struct worker *w, enum shmlogtag tag, int id, const char *fmt, ...);
-void WSL_Flush(struct worker *w);
+void WSL_Flush(struct worker *w, int overflow);
#define WSP(sess, tag, fmt, ...) \
WSL((sess)->wrk, tag, (sess)->fd, fmt, __VA_ARGS__)
#define WSPR(sess, tag, txt) \
Modified: trunk/varnish-cache/bin/varnishd/cache_center.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_center.c 2008-03-07 10:36:40 UTC (rev 2556)
+++ trunk/varnish-cache/bin/varnishd/cache_center.c 2008-03-07 10:58:12 UTC (rev 2557)
@@ -228,7 +228,7 @@
sp->t_open = sp->t_end;
sp->t_req = NAN;
sp->t_resp = NAN;
- WSL_Flush(sp->wrk);
+ WSL_Flush(sp->wrk, 0);
/* If we did an ESI include, don't mess up our state */
if (sp->esis > 0)
@@ -879,7 +879,7 @@
WSL(sp->wrk, SLT_Debug, sp->id,
"thr %p STP_%s sp %p obj %p vcl %p",
pthread_self(), state, sp, sp->obj, sp->vcl);
- WSL_Flush(sp->wrk);
+ WSL_Flush(sp->wrk, 0);
} else {
VSL(SLT_Debug, sp->id,
"thr %p STP_%s sp %p obj %p vcl %p",
@@ -925,7 +925,7 @@
CHECK_OBJ_ORNULL(w->nobjhead, OBJHEAD_MAGIC);
}
assert(!isnan(w->used));
- WSL_Flush(w);
+ WSL_Flush(w, 0);
}
/*
Modified: trunk/varnish-cache/bin/varnishd/cache_expire.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_expire.c 2008-03-07 10:36:40 UTC (rev 2556)
+++ trunk/varnish-cache/bin/varnishd/cache_expire.c 2008-03-07 10:58:12 UTC (rev 2557)
@@ -280,7 +280,7 @@
CHECK_OBJ_ORNULL(oe, OBJEXP_MAGIC);
if (oe == NULL || oe->timer_when > t) { /* XXX: > or >= ? */
UNLOCK(&exp_mtx);
- WSL_Flush(&ww);
+ WSL_Flush(&ww, 0);
AZ(sleep(1));
VCL_Refresh(&sp->vcl);
t = TIM_real();
Modified: trunk/varnish-cache/bin/varnishd/cache_synthetic.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_synthetic.c 2008-03-07 10:36:40 UTC (rev 2556)
+++ trunk/varnish-cache/bin/varnishd/cache_synthetic.c 2008-03-07 10:58:12 UTC (rev 2557)
@@ -59,7 +59,7 @@
int fd;
int ttl = 0; /* XXX: ?? */
- WSL_Flush(sp->wrk);
+ WSL_Flush(sp->wrk, 0);
assert(status >= 100 && status <= 999);
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC);
Modified: trunk/varnish-cache/bin/varnishd/shmlog.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/shmlog.c 2008-03-07 10:36:40 UTC (rev 2556)
+++ trunk/varnish-cache/bin/varnishd/shmlog.c 2008-03-07 10:58:12 UTC (rev 2557)
@@ -170,7 +170,7 @@
/*--------------------------------------------------------------------*/
void
-WSL_Flush(struct worker *w)
+WSL_Flush(struct worker *w, int overflow)
{
unsigned char *p;
unsigned l;
@@ -179,6 +179,7 @@
if (l == 0)
return;
LOCKSHM(&vsl_mtx);
+ VSL_stats->shm_flushes += overflow;
VSL_stats->shm_writes++;
VSL_stats->shm_records += w->wlr;
if (loghead->ptr + l + 1 >= loghead->size)
@@ -216,7 +217,7 @@
/* Wrap if necessary */
if (w->wlp + SHMLOG_NEXTTAG + l + 1 >= w->wle)
- WSL_Flush(w);
+ WSL_Flush(w, 1);
p = w->wlp;
w->wlp += SHMLOG_NEXTTAG + l;
assert(w->wlp < w->wle);
@@ -247,7 +248,7 @@
/* Wrap if we cannot fit a full size record */
if (w->wlp + SHMLOG_NEXTTAG + 255 + 1 >= w->wle)
- WSL_Flush(w);
+ WSL_Flush(w, 1);
p = w->wlp;
n = vsnprintf((char *)(p + SHMLOG_DATA), 256, fmt, ap);
Modified: trunk/varnish-cache/include/stat_field.h
===================================================================
--- trunk/varnish-cache/include/stat_field.h 2008-03-07 10:36:40 UTC (rev 2556)
+++ trunk/varnish-cache/include/stat_field.h 2008-03-07 10:58:12 UTC (rev 2557)
@@ -88,6 +88,7 @@
MAC_STAT(shm_records, uint64_t, 'a', "SHM records")
MAC_STAT(shm_writes, uint64_t, 'a', "SHM writes")
+MAC_STAT(shm_flushes, uint64_t, 'a', "SHM flushes due to overflow")
MAC_STAT(shm_cont, uint64_t, 'a', "SHM MTX contention")
MAC_STAT(sm_nreq, uint64_t, 'a', "allocator requests")
More information about the varnish-commit
mailing list