r640 - trunk/varnish-cache/bin/varnishd
phk at projects.linpro.no
phk at projects.linpro.no
Fri Aug 4 21:36:36 CEST 2006
Author: phk
Date: 2006-08-04 21:36:35 +0200 (Fri, 04 Aug 2006)
New Revision: 640
Modified:
trunk/varnish-cache/bin/varnishd/cache.h
trunk/varnish-cache/bin/varnishd/cache_acceptor.c
trunk/varnish-cache/bin/varnishd/cache_backend.c
trunk/varnish-cache/bin/varnishd/cache_center.c
trunk/varnish-cache/bin/varnishd/cache_pass.c
trunk/varnish-cache/bin/varnishd/cache_pipe.c
trunk/varnish-cache/bin/varnishd/cache_response.c
trunk/varnish-cache/bin/varnishd/cache_session.c
Log:
More comprehensive performance stats and a few asserts, just in case.
Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h 2006-08-04 11:10:57 UTC (rev 639)
+++ trunk/varnish-cache/bin/varnishd/cache.h 2006-08-04 19:36:35 UTC (rev 640)
@@ -235,7 +235,9 @@
const char *doclose;
struct http *http;
+ struct timespec t_open;
struct timespec t_req;
+ struct timespec t_resp;
struct timespec t_idle;
enum step step;
Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-04 11:10:57 UTC (rev 639)
+++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-08-04 19:36:35 UTC (rev 640)
@@ -49,6 +49,7 @@
sp = SES_New(addr, l);
assert(sp != NULL); /* XXX handle */
+ (void)clock_gettime(CLOCK_REALTIME, &sp->t_open);
sp->fd = i;
sp->id = i;
@@ -246,6 +247,7 @@
SES_Delete(sp);
return;
}
+ (void)clock_gettime(CLOCK_REALTIME, &sp->t_open);
VSL(SLT_SessionReuse, sp->fd, "%s %s", sp->addr, sp->port);
assert(sizeof sp == write(pipes[1], &sp, sizeof sp));
}
@@ -364,6 +366,7 @@
SES_Delete(sp);
return;
}
+ (void)clock_gettime(CLOCK_REALTIME, &sp->t_open);
VSL(SLT_SessionReuse, sp->fd, "%s %s", sp->addr, sp->port);
if (http_RecvPrepAgain(sp->http))
vca_handover(sp, 0);
Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_backend.c 2006-08-04 11:10:57 UTC (rev 639)
+++ trunk/varnish-cache/bin/varnishd/cache_backend.c 2006-08-04 19:36:35 UTC (rev 640)
@@ -195,8 +195,10 @@
TAILQ_REMOVE(&bp->connlist, vc, list);
} else {
vc2 = TAILQ_FIRST(&vbe_head);
- if (vc2 != NULL)
+ if (vc2 != NULL) {
+ VSL_stats->backend_unused--;
TAILQ_REMOVE(&vbe_head, vc2, list);
+ }
}
AZ(pthread_mutex_unlock(&vbemtx));
if (vc == NULL)
@@ -229,6 +231,7 @@
if (vc->fd < 0) {
vc->backend = NULL;
TAILQ_INSERT_HEAD(&vbe_head, vc, list);
+ VSL_stats->backend_unused++;
vc = NULL;
} else {
vc->backend = bp;
@@ -262,6 +265,7 @@
vc->backend = NULL;
AZ(pthread_mutex_lock(&vbemtx));
TAILQ_INSERT_HEAD(&vbe_head, vc, list);
+ VSL_stats->backend_unused++;
AZ(pthread_mutex_unlock(&vbemtx));
}
Modified: trunk/varnish-cache/bin/varnishd/cache_center.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_center.c 2006-08-04 11:10:57 UTC (rev 639)
+++ trunk/varnish-cache/bin/varnishd/cache_center.c 2006-08-04 19:36:35 UTC (rev 640)
@@ -79,9 +79,21 @@
DOT ]
*/
+static double
+cnt_dt(struct timespec *t1, struct timespec *t2)
+{
+ double dt;
+
+ dt = (t2->tv_sec - t1->tv_sec);
+ dt += (t2->tv_nsec - t1->tv_nsec) * 1e-9;
+ return (dt);
+}
+
static int
cnt_done(struct sess *sp)
{
+ double dh, dp, da;
+ struct timespec te;
assert(sp->obj == NULL);
assert(sp->vbc == NULL);
@@ -90,6 +102,14 @@
VCL_Rel(sp->vcl);
sp->vcl = NULL;
+ clock_gettime(CLOCK_REALTIME, &te);
+ dh = cnt_dt(&sp->t_open, &sp->t_req);
+ dp = cnt_dt(&sp->t_req, &sp->t_resp);
+ da = cnt_dt(&sp->t_resp, &te);
+ VSL(SLT_ReqServTime, sp->fd, "%u %ld.%09ld %.9f %.9f %.9f",
+ sp->xid, (long)sp->t_req.tv_sec, (long)sp->t_req.tv_nsec,
+ dh, dp, da);
+
SES_Charge(sp);
vca_return_session(sp);
return (1);
@@ -523,6 +543,7 @@
char *b;
sp->t0 = time(NULL);
+ assert(sp->vcl == NULL);
sp->vcl = VCL_Get();
assert(sp->obj == NULL);
Modified: trunk/varnish-cache/bin/varnishd/cache_pass.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_pass.c 2006-08-04 11:10:57 UTC (rev 639)
+++ trunk/varnish-cache/bin/varnishd/cache_pass.c 2006-08-04 19:36:35 UTC (rev 640)
@@ -149,6 +149,8 @@
assert(vc != NULL);
sp->vbc = NULL;
+ clock_gettime(CLOCK_REALTIME, &sp->t_resp);
+
http_ClrHeader(sp->http);
http_CopyResp(sp->fd, sp->http, vc->http);
http_FilterHeader(sp->fd, sp->http, vc->http, HTTPH_A_PASS);
Modified: trunk/varnish-cache/bin/varnishd/cache_pipe.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_pipe.c 2006-08-04 11:10:57 UTC (rev 639)
+++ trunk/varnish-cache/bin/varnishd/cache_pipe.c 2006-08-04 19:36:35 UTC (rev 640)
@@ -68,6 +68,8 @@
return;
}
+ clock_gettime(CLOCK_REALTIME, &sp->t_resp);
+
memset(fds, 0, sizeof fds);
fds[0].fd = vc->fd;
fds[0].events = POLLIN | POLLERR;
Modified: trunk/varnish-cache/bin/varnishd/cache_response.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_response.c 2006-08-04 11:10:57 UTC (rev 639)
+++ trunk/varnish-cache/bin/varnishd/cache_response.c 2006-08-04 19:36:35 UTC (rev 640)
@@ -128,15 +128,9 @@
{
struct storage *st;
unsigned u = 0;
- double dt;
- struct timespec t_resp;
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
- clock_gettime(CLOCK_REALTIME, &t_resp);
- dt = (t_resp.tv_sec - sp->t_req.tv_sec);
- dt += (t_resp.tv_nsec - sp->t_req.tv_nsec) * 1e-9;
- VSL(SLT_ReqServTime, sp->fd, "%ld.%09ld %.9f",
- (long)sp->t_req.tv_sec, (long)sp->t_req.tv_nsec, dt);
+ clock_gettime(CLOCK_REALTIME, &sp->t_resp);
if (sp->obj->response == 200 && sp->http->conds && res_do_conds(sp))
return;
Modified: trunk/varnish-cache/bin/varnishd/cache_session.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_session.c 2006-08-04 11:10:57 UTC (rev 639)
+++ trunk/varnish-cache/bin/varnishd/cache_session.c 2006-08-04 19:36:35 UTC (rev 640)
@@ -217,6 +217,8 @@
struct acct *b = &sp->acct;
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
+ assert(sp->obj == NULL);
+ assert(sp->vcl == NULL);
VSL_stats->n_sess--;
ses_relsrcaddr(sp);
VSL(SLT_StatSess, sp->id, "%s %s %d %ju %ju %ju %ju %ju %ju %ju",
More information about the varnish-commit
mailing list