Mailing List Archive

#1859: Average Hitrate Reported by Varnishstat Inaccurate
#1859: Average Hitrate Reported by Varnishstat Inaccurate
---------------------------------+-------------------------
Reporter: batty | Type: defect
Status: new | Priority: normal
Milestone: | Component: varnishstat
Version: 4.1.1 | Severity: normal
Keywords: varnishtat hit rate |
---------------------------------+-------------------------
We're in the process of upgrading from varnish 3.0.3 to varnish 4.1.1.
During the upgrade it was noticed that the average hit rate reported by
varnishstat in 4.1.1 does not match the hit rate calculated from the
individual hit/miss metrics. We have two servers running, one still on
version 3.0.3 and one updated to version 4.1.1. I restarted both servers
at roughly the same time and immediately began running varnishstat each.

The average hit rate according to varnish 4.1.1 is: 0.2465 0.3085
0.3127[[br]]
The average hit rate according to varnish 3.0.3 is: 0.6592 0.6402
0.6182

Here is a varnishstat -1 dump from each server:[[br]]
varnishstat -1 4.1.1: http://pastebin.com/tP5AE995 [[br]]
varnishstat -1 3.0.3: http://pastebin.com/cg51CuUS

Relevant metrics from 4.1.1:
{{{
MAIN.cache_hit 47970 20.23 Cache hits
MAIN.cache_miss 22402 9.45 Cache misses
}}}

Relevant metrics from 3.0.3:
{{{
cache_hit 46306 19.81 Cache hits
cache_miss 23223 9.94 Cache misse
}}}

From what I understand hit rate is calculated as cache_hit / (cache_hit +
cache_miss) so...

For varnish 4.1.1:[[br]]
47970 / (47970 + 22402) = .6816

For varnish 3.0.3:[[br]]
46306 / (46306 + 23223) = .6659

Both of these calculations correspond roughly to the average hit rate
being reported by varnishstat in 3.0.3, however varnish 4.1.1 is reporting
the much lower (0.2465 0.3085 0.3127).

Is the hit rate being reported by varnishtat calculated differently in
4.1.1? I reported this the IRC channel and it was suggested I file a
ticket.

--
Ticket URL: <https://www.varnish-cache.org/trac/ticket/1859>
Varnish <https://varnish-cache.org/>
The Varnish HTTP Accelerator

_______________________________________________
varnish-bugs mailing list
varnish-bugs@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-bugs
Re: #1859: Average Hitrate Reported by Varnishstat Inaccurate [ In reply to ]
#1859: Average Hitrate Reported by Varnishstat Inaccurate
---------------------------------+--------------------
Reporter: batty | Owner:
Type: defect | Status: new
Priority: normal | Milestone:
Component: varnishstat | Version: 4.1.1
Severity: normal | Resolution:
Keywords: varnishtat hit rate |
---------------------------------+--------------------

Comment (by batty):

{{{
varnishd -V
varnishd (varnish-4.1.1 revision 66bb824)
Copyright (c) 2006 Verdens Gang AS
Copyright (c) 2006-2015 Varnish Software AS
}}}

Installed 4.1.1 from: https://repo.varnish-
cache.org/redhat/varnish-4.1/el6/x86_64/varnish/

These two packages are installed:
{{{
varnish-4.1.1-2.el6.x86_64
varnish-libs-4.1.1-2.el6.x86_64
}}}

--
Ticket URL: <https://www.varnish-cache.org/trac/ticket/1859#comment:1>
Varnish <https://varnish-cache.org/>
The Varnish HTTP Accelerator

_______________________________________________
varnish-bugs mailing list
varnish-bugs@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-bugs
Re: #1859: Average Hitrate Reported by Varnishstat Inaccurate [ In reply to ]
#1859: Average Hitrate Reported by Varnishstat Inaccurate
---------------------------------+--------------------
Reporter: batty | Owner:
Type: defect | Status: new
Priority: normal | Milestone:
Component: varnishstat | Version: 4.1.1
Severity: normal | Resolution:
Keywords: varnishtat hit rate |
---------------------------------+--------------------

Comment (by batty):

This does not appear to be an issue in version 4.0.3. We downgraded one
server in our tier to version 4.0.3 so that it is running beside 4.1.1.
The servers are load balanced using a least connection algorithm. I ran
varnishstat on each and let it run for 5 minutes. Here are the results
reported for hitrate n:

4.0.3
{{{
Hitrate n: 10 100 299
avg(n): 0.6947 0.6813 0.6921
}}}

4.1.1
{{{
Hitrate n: 10 100 305
avg(n): 0.1956 0.1585 0.1578
}}}

Here are the hit/miss metrics since varnish was last restarted for each:

4.0.3
{{{
MAIN.cache_hit 2788195 16.45 Cache hits
MAIN.cache_miss 1357351 8.01 Cache misses

2788195 / (2788195 + 1357351) = .6726
}}}

4.1.1
{{{
MAIN.cache_hit 3776402 17.96 Cache hits
MAIN.cache_miss 1736464 8.26 Cache misses

3776402 / (3776402 + 1736464) = .6850
}}}

The ~69% hit rate reported by varnishstat in version 4.0.3 is accurate.
The rate reported by version 4.1.1 seems way off.

Note: The total hit/miss metric counts are not similar between the two
servers because the server running varnish 4.1.1 has been running longer.

--
Ticket URL: <https://www.varnish-cache.org/trac/ticket/1859#comment:2>
Varnish <https://varnish-cache.org/>
The Varnish HTTP Accelerator

_______________________________________________
varnish-bugs mailing list
varnish-bugs@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-bugs