]> err.no Git - varnish/commitdiff
Originally we shaved 64 bytes from the session to the worker thread
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Wed, 14 Jan 2009 20:28:27 +0000 (20:28 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Wed, 14 Jan 2009 20:28:27 +0000 (20:28 +0000)
by keeping the current requests accounting stats in the worker thread.

For reasons which will be explained in the next commit, this is no
longer a good idea, and this commit moves these counters from
the worker thread to the session at a slight but all in all
trivial cost in memory footprint.

Remove the call to SES_Charge() when we hit a busy object, it is
not necessary to clean the worker thread counters here now.

Move these counters from the worker thread to the see

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3512 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache.h
varnish-cache/bin/varnishd/cache_center.c
varnish-cache/bin/varnishd/cache_pipe.c
varnish-cache/bin/varnishd/cache_response.c
varnish-cache/bin/varnishd/cache_session.c
varnish-cache/bin/varnishd/cache_vrt_esi.c

index d0df6f9415961c25b8d7e0345c5714162f015724..22135bd5d061fb209386fd6af9f215fbb105351c 100644 (file)
@@ -199,7 +199,6 @@ struct worker {
 
        struct VCL_conf         *vcl;
        struct srcaddr          *srcaddr;
-       struct acct             acct;
 
        unsigned char           *wlb, *wlp, *wle;
        unsigned                wlr;
@@ -370,6 +369,7 @@ struct sess {
 
        struct workreq          workreq;
        struct acct             acct;
+       struct acct             acct_req;
 
        /* pointers to hash string components */
        unsigned                nhashptr;
index 884357793f2a3947dea79da44ae17adfb5587604..258fbeb2cd5a41be85a99f29604d8f7c0277f2b5 100644 (file)
@@ -427,7 +427,7 @@ cnt_fetch(struct sess *sp)
                EXP_Insert(sp->obj);
                HSH_Unbusy(sp);
        }
-       sp->wrk->acct.fetch++;
+       sp->acct_req.fetch++;
        sp->step = STP_DELIVER;
        return (0);
 }
@@ -457,7 +457,7 @@ cnt_first(struct sess *sp)
        /* Receive a HTTP protocol request */
        HTC_Init(sp->htc, sp->ws, sp->fd);
        sp->wrk->lastused = sp->t_open;
-       sp->wrk->acct.sess++;
+       sp->acct_req.sess++;
        SES_RefSrcAddr(sp);
        do
                i = HTC_Rx(sp->htc);
@@ -591,7 +591,6 @@ cnt_lookup(struct sess *sp)
                if (params->diag_bitmap & 0x20)
                        WSP(sp, SLT_Debug,
                            "on waiting list <%s>", sp->objhead->hash);
-               SES_Charge(sp);
                return (1);
        }
 
@@ -721,7 +720,7 @@ cnt_pass(struct sess *sp)
                return (0);
        }
        assert(sp->handling == VCL_RET_PASS);
-       sp->wrk->acct.pass++;
+       sp->acct_req.pass++;
        HSH_Prealloc(sp);
        sp->obj = sp->wrk->nobj;
        sp->wrk->nobj = NULL;
@@ -763,7 +762,7 @@ cnt_pipe(struct sess *sp)
        CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
        CHECK_OBJ_NOTNULL(sp->vcl, VCL_CONF_MAGIC);
 
-       sp->wrk->acct.pipe++;
+       sp->acct_req.pipe++;
        http_FilterHeader(sp, HTTPH_R_PIPE);
 
        VCL_pipe_method(sp);
@@ -871,7 +870,7 @@ cnt_start(struct sess *sp)
        VSL_stats->client_req++;                        /* XXX not locked */
        sp->t_req = TIM_real();
        sp->wrk->lastused = sp->t_req;
-       sp->wrk->acct.req++;
+       sp->acct_req.req++;
 
        /* Assign XID and log */
        sp->xid = ++xids;                               /* XXX not locked */
index 5ed25ff292cb29184f7d70d12184b0143070b061..4ae3f83bef37c29ebdb4f02adb9986fc9df50391 100644 (file)
@@ -84,10 +84,10 @@ PipeSession(struct sess *sp)
        TCP_blocking(vc->fd);
 
        WRW_Reserve(w, &vc->fd);
-       w->acct.hdrbytes += http_Write(w, bereq->http, 0);
+       sp->acct_req.hdrbytes += http_Write(w, bereq->http, 0);
 
        if (sp->htc->pipeline.b != NULL)
-               w->acct.bodybytes +=
+               sp->acct_req.bodybytes +=
                    WRW_Write(w, sp->htc->pipeline.b, Tlen(sp->htc->pipeline));
 
        if (WRW_FlushRelease(w)) {
index aad5431fbef60cd393913975b284eb92cd929b37..c23da11e601a9b797adb3f08b9c3104054add9f1 100644 (file)
@@ -140,7 +140,7 @@ RES_WriteObj(struct sess *sp)
        WRW_Reserve(sp->wrk, &sp->fd);
 
        if (sp->esis == 0)
-               sp->wrk->acct.hdrbytes += http_Write(sp->wrk, sp->http, 1);
+               sp->acct_req.hdrbytes += http_Write(sp->wrk, sp->http, 1);
 
        if (sp->wantbody && !VTAILQ_EMPTY(&sp->obj->esibits)) {
                if (WRW_FlushRelease(sp->wrk)) {
@@ -161,7 +161,7 @@ RES_WriteObj(struct sess *sp)
                        CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
                        CHECK_OBJ_NOTNULL(st, STORAGE_MAGIC);
                        u += st->len;
-                       sp->wrk->acct.bodybytes += st->len;
+                       sp->acct_req.bodybytes += st->len;
 #ifdef SENDFILE_WORKS
                        /*
                         * XXX: the overhead of setting up sendfile is not
index 444e46133f0bb323fe0b40be2e3ada6c410d0080..8878baf7ab420c5ca6c10b42607aef3b654e102c 100644 (file)
@@ -222,7 +222,7 @@ ses_sum_acct(struct acct *sum, const struct acct *inc)
 void
 SES_Charge(struct sess *sp)
 {
-       struct acct *a = &sp->wrk->acct;
+       struct acct *a = &sp->acct_req;
        struct acct b;
 
        ses_sum_acct(&sp->acct, a);
index e000798f8c7274c1f95a795d3fe4a8fb7f838ccd..a75a1cf5f71d50e3e3d6d6d45cc835ce25a500a1 100644 (file)
@@ -808,7 +808,7 @@ ESI_Deliver(struct sess *sp)
                if (Tlen(eb->verbatim)) {
                        if (sp->http->protover >= 1.1)
                                (void)WRW_Write(sp->wrk, eb->chunk_length, -1);
-                       sp->wrk->acct.bodybytes += WRW_Write(sp->wrk,
+                       sp->acct_req.bodybytes += WRW_Write(sp->wrk,
                            eb->verbatim.b, Tlen(eb->verbatim));
                        if (sp->http->protover >= 1.1)
                                (void)WRW_Write(sp->wrk, "\r\n", -1);