Question about varnishstat and hitrate

Connor Walls connor.walls at skillpages.com
Wed Nov 2 11:15:21 CET 2011


Great, thanks very much!

-Connor

From: Stig Bakken [mailto:stig at zedge.net]
Sent: 02 November 2011 10:15
To: Connor Walls
Cc: varnish-misc at varnish-cache.org
Subject: Re: Question about varnishstat and hitrate

Varnish's cache hit rate is a percentage of hits among requests that went through vcl_lookup, not all requests.

 - Stig

On Wed, Nov 2, 2011 at 10:53 AM, Connor Walls <connor.walls at skillpages.com<mailto:connor.walls at skillpages.com>> wrote:
Hi,

I had a question about the numbers generated in varnishstat. Looking at the current hitrate average for one of our boxes is giving an average of 0.4833 for the last 1000 requests, and the hitrate is in and around this number on all of our varnish boxes. We are also recording the output of varnishlog to a file, including a “X-Cache” header, as per this article: https://www.varnish-cache.org/trac/wiki/VCLExampleHitMissHeader. Now, what I’m curious about is whenever I look at the responses that have been logged, <5% of them are being served from the cache, which is at odds with the 48% that varnishstat is reporting. Is the hitrate average only taking into account pages that are passed, and not pages that are fetched? Why is there such a discrepancy between the two values?

Here’s a sample output from varnishstat, if it helps explain things better.

4+18:04:37                                           domU-12-31-39-10-74-A8
Hitrate ratio:       10      100     1000
Hitrate avg:     0.3646   0.4249   0.4833

     1528600         3.96         3.72 Client connections accepted
    10346326        23.77        25.19 Client requests received
     5244804         0.99        12.77 Cache hits
        9509         0.00         0.02 Cache hits for pass
      147772         0.00         0.36 Cache misses
       22490         0.00         0.05 Backend conn. success
     4731723        21.79        11.52 Backend conn. reuses
       12459         0.00         0.03 Backend conn. was closed
     4744236        19.81        11.55 Backend conn. recycles
        9505         0.00         0.02 Fetch head
     4727908        20.80        11.51 Fetch with Length
        1751         0.00         0.00 Fetch chunked
         422          .            .   N struct sess_mem
          96          .            .   N struct sess
        4104          .            .   N struct object
        4148          .            .   N struct objectcore
        4115          .            .   N struct objecthead
          48          .            .   N struct vbe_conn
          53          .            .   N worker threads
        7788         0.00         0.02 N worker threads created
           0         0.00         0.00 N queued work requests
       32999         0.00         0.08 N overflowed work requests
           1          .            .   N backends
      136098          .            .   N expired objects
      397731          .            .   N LRU moved objects
     8861590        17.82        21.58 Objects sent with write
     1528600         3.96         3.72 Total Sessions
    10346326        23.77        25.19 Total Requests
     4600511        20.80        11.20 Total pass
     4744331        20.80        11.55 Total fetch
  5613543692<tel:5613543692>     14549.86     13669.00 Total header bytes
50230527274     64650.96    122311.52 Total body bytes
      398864         1.98         0.97 Session Closed
           1         0.00         0.00 Session Pipeline
     9989106        21.79        24.32 Session Linger
     4717398        17.82        11.49 Session herd
   731094771      2065.68      1780.22 SHM records
    29558086        95.06        71.97 SHM writes
       14131         0.00         0.03 SHM MTX contention
         353         0.00         0.00 SHM cycles through buffer
     3518804        16.83         8.57 SMA allocator requests
        8184          .            .   SMA outstanding allocations
    46354320          .            .   SMA outstanding bytes
12051521527          .            .   SMA bytes allocated
12005167207          .            .   SMA bytes free
      357190         1.98         0.87 SMS allocator requests
           0          .            .   SMS outstanding allocations
           0          .            .   SMS outstanding bytes
   135529138          .            .   SMS bytes allocated
   135529138          .            .   SMS bytes freed
     4744578        20.80        11.55 Backend requests made
           1         0.00         0.00 N vcl total
           1         0.00         0.00 N vcl available
      240460          .            .   N total active purges
      353239         1.98         0.86 N new purges added
      112779         0.99         0.27 N old purges deleted
      510753         0.99         1.24 N objects tested
    32284561       412.94        78.61 N regexps tested against
      155686         0.99         0.38 N duplicate purges removed


Thanks for any help,
Connor Walls


_______________________________________________
varnish-misc mailing list
varnish-misc at varnish-cache.org<mailto:varnish-misc at varnish-cache.org>
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc



--
Stig Bakken
CTO, Zedge.net - free your phone!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20111102/24ec1fac/attachment-0003.html>


More information about the varnish-misc mailing list