Mailing List Archive

Varnishstat: bandwith usage
Hi!
I have a question about measuring bandwith usage with varnishstat.
I would expect 'Total header bytes' and 'Total header bytes' to be
the total number of bytes sent to clients since varnishd was started?
Measuring these numbers at different points in time could therefore be
used to calculate the bandwith usage. So here are my measurements:

* Initial values:
556874988 Total header bytes
20238688347 Total body bytes

* 75 minutes later:
848969031 Total header bytes
30800272652 Total body bytes

The problem is that the correct values are 40 times larger
than what I get from varnishstat. So is this a bug in varnishstat?
I notice that the total body bytes is larger than 2^32, perhaps there is
an integer overflow somewhere? Or am I interpreting these values wrong?

- Andreas
Varnishstat: bandwith usage [ In reply to ]
In message <20070611225521.C34016 at verden.pvv.ntnu.no>, =?ISO-8859-1?Q?Andreas_R
=F8sdal?= writes:

>* Initial values:
>556874988 Total header bytes
>20238688347 Total body bytes
>
>* 75 minutes later:
>848969031 Total header bytes
>30800272652 Total body bytes
>
>The problem is that the correct values are 40 times larger
>than what I get from varnishstat. So is this a bug in varnishstat?

You're probably running out of the 32bit counter, we need to expand
some of those to 64 bits...

Can I get you to open a ticket in the varnish trac system ?

--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
Varnishstat: bandwith usage [ In reply to ]
Andreas R?sdal <andrearo at pvv.ntnu.no> writes:
> I would expect 'Total header bytes' and 'Total header bytes' to be
> the total number of bytes sent to clients since varnishd was started?

Yes.

> Measuring these numbers at different points in time could therefore be
> used to calculate the bandwith usage. So here are my measurements:
>
> * Initial values:
> 556874988 Total header bytes
> 20238688347 Total body bytes
>
> * 75 minutes later:
> 848969031 Total header bytes
> 30800272652 Total body bytes

A bit of simple arithmetic gives 10853678348 bytes (10 GB) served in 75
minutes, or 2411928 Bps, or 19295428 bps (19.3 Mbps) which is a fair
amount of traffic.

> The problem is that the correct values are 40 times larger than what I
> get from varnishstat.

How do you derive "the correct values"? 40 times what you have here is
nearly 800 Mbps, or twice as much as the daily average of Norway's most
visited web site (vg.no).

> I notice that the total body bytes is larger than 2^32, perhaps there
> is an integer overflow somewhere?

No, these are 64-bit counters.

Perhaps there is an integer overflow in your calculator? ;)

DES
--
Dag-Erling Sm?rgrav
Senior Software Developer
Linpro AS - www.linpro.no
Varnishstat: bandwith usage [ In reply to ]
"Poul-Henning Kamp" <phk at phk.freebsd.dk> writes:
> You're probably running out of the 32bit counter, we need to expand
> some of those to 64 bits...

It *is* a 64-bit counter.

DES
--
Dag-Erling Sm?rgrav
Senior Software Developer
Linpro AS - www.linpro.no