r1034 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Sat Sep 16 22:59:35 CEST 2006


Author: phk
Date: 2006-09-16 22:59:35 +0200 (Sat, 16 Sep 2006)
New Revision: 1034

Modified:
   trunk/varnish-cache/bin/varnishd/cache_session.c
Log:
Use srcaddr mutex for srcaddr stats update to reduce contention on stat_mtx


Modified: trunk/varnish-cache/bin/varnishd/cache_session.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_session.c	2006-09-16 20:52:35 UTC (rev 1033)
+++ trunk/varnish-cache/bin/varnishd/cache_session.c	2006-09-16 20:59:35 UTC (rev 1034)
@@ -201,15 +201,17 @@
 
 	ses_sum_acct(&sp->acct, a);
 	
-	LOCK(&stat_mtx);
 	if (sp->srcaddr != NULL) {
+		LOCK(&sp->srcaddr->sah->mtx);
 		b = &sp->srcaddr->acct;
 		ses_sum_acct(b, a);
 		VSL(SLT_StatAddr, 0, "%s 0 %d %ju %ju %ju %ju %ju %ju %ju",
 		    sp->srcaddr->addr, sp->t_end.tv_sec - b->first,
 		    b->sess, b->req, b->pipe, b->pass,
 		    b->fetch, b->hdrbytes, b->bodybytes);
+		UNLOCK(&sp->srcaddr->sah->mtx);
 	}
+	LOCK(&stat_mtx);
 	VSL_stats->s_sess += a->sess;
 	VSL_stats->s_req += a->req;
 	VSL_stats->s_pipe += a->pipe;




More information about the varnish-commit mailing list