<div dir="ltr"><div>Folks,</div><div><br></div><div>It my first time here, i'm Fabio. </div><div>My apologizes if my questions looks like a children :D</div><div>I'm a newbie in Varnish Cache, but I'm studying hard.</div>

<div><br></div><div>I manage a web server with one single domain (popular fitness/health wordpress blog in Brazil) which receives 50 K page views/day. When the person goes to tv shows, we receive peaks of 230 K page views/day with 5 or 6 K simultaneous users.</div>

<div>I've got a very good hit ratio, and all pages are showing fast.<br></div><div><br></div><div>Everything works ok, except when the cache is purged after a new post or causeless (I just can not understand it yet). </div>

<div>The css of home page gone away and wordpress admin not works properly.</div><div><br></div><div>When i clear the cache (with command: varnishadm "ban req.url ~ /"), everything works ok again, but not for long time.</div>

<div><br></div><div>Can u help me, saying if i forgot or missed some syntax or parameter in my configuration, which goes below.</div><div><br></div><div>#######################</div><div>default.vcl</div><div>#######################</div>

<div><br></div><div><div>backend default {</div><div>        .host = "127.0.0.1";</div><div>        .port = "8081";</div><div>                .connect_timeout = 300s;</div><div>                .first_byte_timeout = 300s;</div>

<div>                .between_bytes_timeout = 300s;</div><div>                .url = "/";</div><div>                .interval = 5s;</div><div>                .timeout = 1 s;</div><div>                .window = 5;</div>

<div>                .threshold = 3;</div><div>}</div><div><br></div><div>#acl purge {</div><div>#        "localhost";</div><div>#} </div><div>sub vcl_recv {</div><div> </div><div>        # Allow the back-end to serve up stale content if it is responding slowly.</div>

<div>        set req.grace = 2m;</div><div> </div><div>        # Always cache the following file types for all users.</div><div>        if ( req.url ~ "(?i)\.(png|gif|jpeg|jpg|ico|swf|css|js|html|htm)(\?[a-z0-9]+)?$" ) { </div>

<div>                unset req.http.cookie;</div><div>        }</div><div> </div><div>        # Don't serve cached pages to logged in users</div><div>        if ( req.http.cookie ~ "wordpress_logged_in" || req.url ~ "vaultpress=true" ) {</div>

<div>                return( pass );</div><div>        }</div><div> </div><div>        # Drop any cookies sent to WordPress.</div><div>        if ( ! ( req.url ~ "wp-(login|admin)" ) ) {</div><div>                unset req.http.cookie;</div>

<div>        }</div><div># Purge Cache</div><div>#        if (req.request == "PURGE") {</div><div>#                if (!client.ip ~ purge) {</div><div>#                        error 405 "Not allowed.";</div>

<div>#                }</div><div>#                return (lookup);</div><div>#        }</div><div> </div><div>        # Handle compression correctly. Different browsers send different</div><div>        # "Accept-Encoding" headers, even though they mostly all support the same</div>

<div>        # compression mechanisms. By consolidating these compression headers into</div><div>        # a consistent format, we can reduce the size of the cache and get more hits.</div><div>        # @see: <a href="http://varnish.projects.linpro.no/wiki/FAQ/Compression">http://varnish.projects.linpro.no/wiki/FAQ/Compression</a></div>

<div>        if ( req.http.Accept-Encoding ) {</div><div> </div><div>                if ( req.http.Accept-Encoding ~ "gzip" ) {</div><div>                        # If the browser supports it, we'll use gzip.</div>

<div>                        set req.http.Accept-Encoding = "gzip";</div><div>                }</div><div> </div><div>                else if ( req.http.Accept-Encoding ~ "deflate" ) {</div><div>                        # Next, try deflate if it is supported.</div>

<div>                        set req.http.Accept-Encoding = "deflate";</div><div>                }</div><div> </div><div>                else {</div><div>                        # Unknown algorithm. Remove it and send unencoded.</div>

<div>                        unset req.http.Accept-Encoding;</div><div>                }</div><div> </div><div>        }</div><div>  if ( req.request == "POST") {</div><div>        ban("req.http.host == " + req.http.Host);</div>

<div>        return(pass);</div><div>    }</div><div>}</div><div><br></div><div>sub vcl_fetch {</div><div> </div><div>        # Allow items to be stale if needed.</div><div>        set beresp.grace = 2m;</div><div><br></div>

<div>        # Tempo de cache depois de transferido do Backend (Apache)</div><div>        set beresp.ttl = 48h;</div><div>                return (deliver);</div><div> </div><div>        # Drop any cookies WordPress tries to send back to the client.</div>

<div>        if ( ! req.url ~ "wp-(login|admin)" && ! req.http.cookie ~ "wordpress_logged_in" ) {</div><div>                unset beresp.http.set-cookie;</div><div>        }</div><div> </div><div>

}</div><div><br></div><div>sub vcl_hit {</div><div>  if (req.request == "PURGE") {</div><div>    purge;</div><div>    error 200 "Purged.";</div><div>  }</div><div>}</div><div><br></div><div>sub vcl_miss {</div>

<div>        if (req.request == "PURGE") {</div><div>                purge;</div><div>                error 200 "Purged.";</div><div>        }</div><div>}</div><div><br></div><div>sub vcl_deliver {</div>

<div>  if (obj.hits > 0) {</div><div>    set resp.http.X-Varnish-Cache = "HIT";</div><div>  }</div><div>  else {</div><div>    set resp.http.X-Varnish-Cache = "MISS";</div><div>  }</div><div>}</div>

</div><div><br></div><div>######################</div><div>varnishstat</div><div>######################</div><div><br></div><div><div>[root~]# varnishstat -1</div><div>client_conn             256621        11.19 Client connections accepted</div>

<div>client_drop                  0         0.00 Connection dropped, no sess/wrk</div><div>client_req              878216        38.28 Client requests received</div><div>cache_hit               672456        29.31 Cache hits</div>

<div>cache_hitpass                0         0.00 Cache hits for pass</div><div>cache_miss              170160         7.42 Cache misses</div><div>backend_conn              5702         0.25 Backend conn. success</div><div>

backend_unhealthy            0         0.00 Backend conn. not attempted</div><div>backend_busy                 0         0.00 Backend conn. too many</div><div>backend_fail                76         0.00 Backend conn. failures</div>

<div>backend_reuse           199994         8.72 Backend conn. reuses</div><div>backend_toolate           2152         0.09 Backend conn. was closed</div><div>backend_recycle         202152         8.81 Backend conn. recycles</div>

<div>backend_retry               11         0.00 Backend conn. retry</div><div>fetch_head                   0         0.00 Fetch head</div><div>fetch_length            201283         8.77 Fetch with Length</div><div>fetch_chunked             3968         0.17 Fetch chunked</div>

<div>fetch_eof                    0         0.00 Fetch EOF</div><div>fetch_bad                    0         0.00 Fetch had bad headers</div><div>fetch_close                 60         0.00 Fetch wanted close</div><div>fetch_oldhttp                0         0.00 Fetch pre HTTP/1.1 closed</div>

<div>fetch_zero                   0         0.00 Fetch zero len</div><div>fetch_failed                34         0.00 Fetch failed</div><div>fetch_1xx                    0         0.00 Fetch no body (1xx)</div><div>fetch_204                    0         0.00 Fetch no body (204)</div>

<div>fetch_304                  319         0.01 Fetch no body (304)</div><div>n_sess_mem                 220          .   N struct sess_mem</div><div>n_sess                     128          .   N struct sess</div><div>n_object                  7354          .   N struct object</div>

<div>n_vampireobject              0          .   N unresurrected objects</div><div>n_objectcore              7435          .   N struct objectcore</div><div>n_objecthead              7449          .   N struct objecthead</div>

<div>n_waitinglist               88          .   N struct waitinglist</div><div>n_vbc                        5          .   N struct vbc</div><div>n_wrk                      100          .   N worker threads</div><div>n_wrk_create               100         0.00 N worker threads created</div>

<div>n_wrk_failed                 0         0.00 N worker threads not created</div><div>n_wrk_max                    0         0.00 N worker threads limited</div><div>n_wrk_lqueue                 0         0.00 work request queue length</div>

<div>n_wrk_queued                 0         0.00 N queued work requests</div><div>n_wrk_drop                   0         0.00 N dropped work requests</div><div>n_backend                    1          .   N backends</div>
<div>
n_expired               162687          .   N expired objects</div><div>n_lru_nuked                  0          .   N LRU nuked objects</div><div>n_lru_moved             457757          .   N LRU moved objects</div><div>
losthdr                      0         0.00 HTTP header overflows</div>
<div>n_objsendfile                0         0.00 Objects sent with sendfile</div><div>n_objwrite              746317        32.53 Objects sent with write</div><div>n_objoverflow                0         0.00 Objects overflowing workspace</div>

<div>s_sess                  256609        11.18 Total Sessions</div><div>s_req                   878216        38.28 Total Requests</div><div>s_pipe                      32         0.00 Total pipe</div><div>s_pass                   35568         1.55 Total pass</div>

<div>s_fetch                 205596         8.96 Total fetch</div><div>s_hdrbytes           301843193     13156.22 Total header bytes</div><div>s_bodybytes        26851914941   1170375.06 Total body bytes</div><div>sess_closed              17724         0.77 Session Closed</div>

<div>sess_pipeline             6099         0.27 Session Pipeline</div><div>sess_readahead            2246         0.10 Session Read Ahead</div><div>sess_linger             856500        37.33 Session Linger</div><div>sess_herd               861705        37.56 Session herd</div>

<div>shm_records           46079248      2008.42 SHM records</div><div>shm_writes             2958209       128.94 SHM writes</div><div>shm_flushes                  0         0.00 SHM flushes due to overflow</div><div>shm_cont                  1658         0.07 SHM MTX contention</div>

<div>shm_cycles                  21         0.00 SHM cycles through buffer</div><div>sms_nreq                   132         0.01 SMS allocator requests</div><div>sms_nobj                     0          .   SMS outstanding allocations</div>

<div>sms_nbytes                   0          .   SMS outstanding bytes</div><div>sms_balloc               55176          .   SMS bytes allocated</div><div>sms_bfree                55176          .   SMS bytes freed</div>
<div>
backend_req             205663         8.96 Backend requests made</div><div>n_vcl                        1         0.00 N vcl total</div><div>n_vcl_avail                  1         0.00 N vcl available</div><div>n_vcl_discard                0         0.00 N vcl discarded</div>

<div>n_ban                      661          .   N total active bans</div><div>n_ban_gone                 659          .   N total gone bans</div><div>n_ban_add                  661         0.03 N new bans added</div><div>

n_ban_retire                 0         0.00 N old bans deleted</div><div>n_ban_obj_test          162881         7.10 N objects tested</div><div>n_ban_re_test           162891         7.10 N regexps tested against</div><div>

n_ban_dups                 658         0.03 N duplicate bans removed</div><div>hcb_nolock              842631        36.73 HCB Lookups without lock</div><div>hcb_lock                  7470         0.33 HCB Lookups with lock</div>

<div>hcb_insert                7470         0.33 HCB Inserts</div><div>esi_errors                   0         0.00 ESI parse errors (unlock)</div><div>esi_warnings                 0         0.00 ESI parse warnings (unlock)</div>

<div>accept_fail                  0         0.00 Accept failures</div><div>client_drop_late             0         0.00 Connection dropped late</div><div>uptime                   22943         1.00 Client uptime</div><div>

dir_dns_lookups              0         0.00 DNS director lookups</div><div>dir_dns_failed               0         0.00 DNS director failed lookups</div><div>dir_dns_hit                  0         0.00 DNS director cached lookups hit</div>

<div>dir_dns_cache_full           0         0.00 DNS director full dnscache</div><div>vmods                        0          .   Loaded VMODs</div><div>n_gzip                       0         0.00 Gzip operations</div><div>

n_gunzip                 26083         1.14 Gunzip operations</div><div>sess_pipe_overflow           0          .   Dropped sessions due to session pipe overflow</div><div>LCK.sms.creat                1         0.00 Created locks</div>

<div>LCK.sms.destroy              0         0.00 Destroyed locks</div><div>LCK.sms.locks              396         0.02 Lock Operations</div><div>LCK.sms.colls                0         0.00 Collisions</div><div>LCK.smp.creat                0         0.00 Created locks</div>

<div>LCK.smp.destroy              0         0.00 Destroyed locks</div><div>LCK.smp.locks                0         0.00 Lock Operations</div><div>LCK.smp.colls                0         0.00 Collisions</div><div>LCK.sma.creat                1         0.00 Created locks</div>

<div>LCK.sma.destroy              0         0.00 Destroyed locks</div><div>LCK.sma.locks            84162         3.67 Lock Operations</div><div>LCK.sma.colls                0         0.00 Collisions</div><div>LCK.smf.creat                1         0.00 Created locks</div>

<div>LCK.smf.destroy              0         0.00 Destroyed locks</div><div>LCK.smf.locks           689712        30.06 Lock Operations</div><div>LCK.smf.colls                0         0.00 Collisions</div><div>LCK.hsl.creat                0         0.00 Created locks</div>

<div>LCK.hsl.destroy              0         0.00 Destroyed locks</div><div>LCK.hsl.locks                0         0.00 Lock Operations</div><div>LCK.hsl.colls                0         0.00 Collisions</div><div>LCK.hcb.creat                1         0.00 Created locks</div>

<div>LCK.hcb.destroy              0         0.00 Destroyed locks</div><div>LCK.hcb.locks             7712         0.34 Lock Operations</div><div>LCK.hcb.colls                0         0.00 Collisions</div><div>LCK.hcl.creat                0         0.00 Created locks</div>

<div>LCK.hcl.destroy              0         0.00 Destroyed locks</div><div>LCK.hcl.locks                0         0.00 Lock Operations</div><div>LCK.hcl.colls                0         0.00 Collisions</div><div>LCK.vcl.creat                1         0.00 Created locks</div>

<div>LCK.vcl.destroy              0         0.00 Destroyed locks</div><div>LCK.vcl.locks              928         0.04 Lock Operations</div><div>LCK.vcl.colls                0         0.00 Collisions</div><div>LCK.stat.creat               1         0.00 Created locks</div>

<div>LCK.stat.destroy             0         0.00 Destroyed locks</div><div>LCK.stat.locks          256709        11.19 Lock Operations</div><div>LCK.stat.colls               0         0.00 Collisions</div><div>LCK.sessmem.creat            1         0.00 Created locks</div>

<div>LCK.sessmem.destroy            0         0.00 Destroyed locks</div><div>LCK.sessmem.locks         259356        11.30 Lock Operations</div><div>LCK.sessmem.colls              0         0.00 Collisions</div><div>LCK.wstat.creat                1         0.00 Created locks</div>

<div>LCK.wstat.destroy              0         0.00 Destroyed locks</div><div>LCK.wstat.locks            46183         2.01 Lock Operations</div><div>LCK.wstat.colls                0         0.00 Collisions</div><div>LCK.herder.creat               1         0.00 Created locks</div>

<div>LCK.herder.destroy             0         0.00 Destroyed locks</div><div>LCK.herder.locks               1         0.00 Lock Operations</div><div>LCK.herder.colls               0         0.00 Collisions</div><div>LCK.wq.creat                   2         0.00 Created locks</div>

<div>LCK.wq.destroy                 0         0.00 Destroyed locks</div><div>LCK.wq.locks             1805936        78.71 Lock Operations</div><div>LCK.wq.colls                   0         0.00 Collisions</div><div>LCK.objhdr.creat            7557         0.33 Created locks</div>

<div>LCK.objhdr.destroy           108         0.00 Destroyed locks</div><div>LCK.objhdr.locks         3858977       168.20 Lock Operations</div><div>LCK.objhdr.colls               0         0.00 Collisions</div><div>LCK.exp.creat                  1         0.00 Created locks</div>

<div>LCK.exp.destroy                0         0.00 Destroyed locks</div><div>LCK.exp.locks             518339        22.59 Lock Operations</div><div>LCK.exp.colls                  0         0.00 Collisions</div><div>LCK.lru.creat                  2         0.00 Created locks</div>

<div>LCK.lru.destroy                0         0.00 Destroyed locks</div><div>LCK.lru.locks             332730        14.50 Lock Operations</div><div>LCK.lru.colls                  0         0.00 Collisions</div><div>LCK.cli.creat                  1         0.00 Created locks</div>

<div>LCK.cli.destroy                0         0.00 Destroyed locks</div><div>LCK.cli.locks               7663         0.33 Lock Operations</div><div>LCK.cli.colls                  0         0.00 Collisions</div><div>LCK.ban.creat                  1         0.00 Created locks</div>

<div>LCK.ban.destroy                0         0.00 Destroyed locks</div><div>LCK.ban.locks             357251        15.57 Lock Operations</div><div>LCK.ban.colls                  0         0.00 Collisions</div><div>LCK.vbp.creat                  1         0.00 Created locks</div>

<div>LCK.vbp.destroy                0         0.00 Destroyed locks</div><div>LCK.vbp.locks                  0         0.00 Lock Operations</div><div>LCK.vbp.colls                  0         0.00 Collisions</div><div>LCK.vbe.creat                  1         0.00 Created locks</div>

<div>LCK.vbe.destroy                0         0.00 Destroyed locks</div><div>LCK.vbe.locks              11551         0.50 Lock Operations</div><div>LCK.vbe.colls                  0         0.00 Collisions</div><div>LCK.backend.creat              1         0.00 Created locks</div>

<div>LCK.backend.destroy            0         0.00 Destroyed locks</div><div>LCK.backend.locks         421628        18.38 Lock Operations</div><div>LCK.backend.colls              0         0.00 Collisions</div><div>SMF.s0.c_req              339798        14.81 Allocator requests</div>

<div>SMF.s0.c_fail                  0         0.00 Allocator failures</div><div>SMF.s0.c_bytes       14666334208    639250.94 Bytes allocated</div><div>SMF.s0.c_freed       14026391552    611358.22 Bytes freed</div><div>
SMF.s0.g_alloc             14721          .   Allocations outstanding</div>
<div>SMF.s0.g_bytes         639942656          .   Bytes outstanding</div><div>SMF.s0.g_space        2006028288          .   Bytes available</div><div>SMF.s0.g_smf               16753          .   N struct smf</div><div>
SMF.s0.g_smf_frag           1982          .   N small free smf</div>
<div>SMF.s0.g_smf_large            50          .   N large free smf</div><div>SMA.Transient.c_req        41668         1.82 Allocator requests</div><div>SMA.Transient.c_fail           0         0.00 Allocator failures</div>

<div>SMA.Transient.c_bytes    215142059      9377.24 Bytes allocated</div><div>SMA.Transient.c_freed    215142059      9377.24 Bytes freed</div><div>SMA.Transient.g_alloc            0          .   Allocations outstanding</div>

<div>SMA.Transient.g_bytes            0          .   Bytes outstanding</div><div>SMA.Transient.g_space            0          .   Bytes available</div><div>VBE.default(127.0.0.1,,8081).vcls            1          .   VCL references</div>

<div>VBE.default(127.0.0.1,,8081).happy           0          .   Happy health probes</div></div><div><br></div><div><div dir="ltr"><div><br></div><div><font color="#999999">Atenciosamente,</font></div><div><font color="#999999">Fábio Fraga Machado</font></div>

<div><font color="#999999"><br></font></div><div><font color="#999999">: Telefone: (48) 4052-9252</font></div><div><font color="#999999">: MSN: </font><span style="color:rgb(153,153,153)"> </span><a href="mailto:fabio@dataspace.com.br" target="_blank">fabio@dataspace.com.br</a></div>

<div><font color="#999999">: GTalk: <a href="mailto:fabio@dataspace.com.br" target="_blank">fabio@dataspace.com.br</a></font></div></div></div>
</div>