Changeset 53b245


Ignore:
Timestamp:
2006-09-06 22:41:13 (8 years ago)
Author:
Poul-Henning Kamp <phk@…>
Branches:
2.0, 2.1, tags/varnish-2.0, tags/varnish-2.0-beta1, tags/varnish-2.0-beta1@3141, tags/varnish-2.0-beta2, tags/varnish-2.0-beta2@3221, tags/varnish-2.0-rc1, tags/varnish-2.0-rc1@3266, tags/varnish-2.0-tp1, tags/varnish-2.0-tp1@2734, tags/varnish-2.0-tp2, tags/varnish-2.0-tp2@2803, tags/varnish-2.0.1, tags/varnish-2.0.2, tags/varnish-2.0.3, tags/varnish-2.0.4, tags/varnish-2.0.5, tags/varnish-2.0.6, tags/varnish-2.1.0, tags/varnish-2.1.1, tags/varnish-2.1.2, tags/varnish-2.1.3, tags/varnish-2.1.4
Children:
a0ba22
Parents:
b3ff8a8
git-author:
Poul-Henning Kamp <phk@…> (2006-09-06 22:41:13)
git-committer:
Poul-Henning Kamp <phk@…> (2006-09-06 22:41:13)
Message:

Move a bunch of work from the acceptor thread to the worker thread
for better scaling.

git-svn-id:  http://www.varnish-cache.org/svn/trunk@932 d4fa192b-c00b-0410-8231-f00ffab90ce4

Location:
bin/varnishd
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • bin/varnishd/cache.h

    r005816 r53b245  
    300300void vca_return_session(struct sess *sp); 
    301301void vca_close_session(struct sess *sp, const char *why); 
     302void VCA_Prep(struct sess *sp); 
    302303void VCA_Init(void); 
    303304 
     
    316317/* cache_center.c [CNT] */ 
    317318void CNT_Session(struct sess *sp); 
     319void CNT_Init(void); 
    318320 
    319321/* cache_cli.c [CLI] */ 
  • bin/varnishd/cache_acceptor.c

    re6eadc r53b245  
    4242static struct acceptor *vca_act; 
    4343 
    44 static unsigned         xids; 
    4544static pthread_t        vca_thread_acct; 
    4645 
     
    5251        struct sess *sp; 
    5352        int i; 
    54         struct linger linger; 
    5553 
    5654        VSL_stats->client_conn++; 
     
    6664        XXXAN(sp); 
    6765 
    68         (void)clock_gettime(CLOCK_REALTIME, &sp->t_open); 
    69         sp->acct.first = sp->t_open.tv_sec; 
    7066        sp->fd = i; 
    7167        sp->id = i; 
    72  
     68        (void)clock_gettime(CLOCK_REALTIME, &sp->t_open); 
     69 
     70        return (sp); 
     71} 
     72 
     73void 
     74VCA_Prep(struct sess *sp) 
     75{ 
     76        struct linger linger; 
     77 
     78        TCP_name(sp->sockaddr, sp->sockaddrlen, 
     79            sp->addr, sizeof sp->addr, sp->port, sizeof sp->port); 
     80        VSL(SLT_SessionOpen, sp->fd, "%s %s", sp->addr, sp->port); 
     81        sp->acct.first = sp->t_open.tv_sec; 
    7382#ifdef SO_LINGER /* XXX Linux*/ 
    7483        linger.l_onoff = 0; 
     
    94103        } 
    95104#endif 
    96  
    97         TCP_name(addr, l, sp->addr, sizeof sp->addr, sp->port, sizeof sp->port); 
    98         VSL(SLT_SessionOpen, sp->fd, "%s %s", sp->addr, sp->port); 
    99         return (sp); 
    100105} 
    101106 
     
    112117        sp->step = STP_RECV; 
    113118        VSL_stats->client_req++; 
    114         sp->xid = xids++; 
    115         VSL(SLT_ReqStart, sp->fd, "XID %u", sp->xid); 
    116119        WRK_QueueSession(sp); 
    117120} 
     
    182185                sp->step = STP_FIRST; 
    183186                VSL_stats->client_req++; 
    184                 sp->xid = xids++; 
    185                 VSL(SLT_ReqStart, sp->fd, "XID %u", sp->xid); 
    186187                WRK_QueueSession(sp); 
    187188        } 
     
    195196{ 
    196197 
    197         srandomdev(); 
    198         xids = random(); 
    199198 
    200199        /* XXX: Add selector mechanism at some point */ 
  • bin/varnishd/cache_center.c

    r7ebc55e r53b245  
    3939#include "cache.h" 
    4040 
     41static unsigned xids; 
    4142 
    4243/*-------------------------------------------------------------------- 
     
    239240        int i; 
    240241 
     242        VCA_Prep(sp); 
    241243        for (;;) { 
    242244                i = http_RecvSome(sp->fd, sp->http); 
     
    591593 
    592594        clock_gettime(CLOCK_REALTIME, &sp->t_req); 
     595        sp->xid = ++xids; 
     596        VSL(SLT_ReqStart, sp->fd, "XID %u", sp->xid); 
    593597 
    594598        AZ(sp->vcl); 
     
    685689DOT } 
    686690*/ 
     691 
     692void 
     693CNT_Init(void) 
     694{ 
     695 
     696        srandomdev(); 
     697        xids = random(); 
     698} 
  • bin/varnishd/cache_main.c

    r1da289 r53b245  
    2626        printf("Child starts\n"); 
    2727 
     28        CNT_Init(); 
    2829        VCL_Init(); 
    2930 
Note: See TracChangeset for help on using the changeset viewer.