[bind10-dev] auth statistics

Michal 'vorner' Vaner michal.vaner at nic.cz
Thu Aug 30 08:33:18 UTC 2012


Hello

This is what I'd do if I wrote the code.

On Wed, Aug 29, 2012 at 06:53:27PM -0700, JINMEI Tatuya / 神明達哉 wrote:
> - how to represent these counters (it may be different for different
>   types of statistics, e.g., generic counters like total # of incoming
>   requests vs per-RR type queries).

For some generic ones (total number of queries, etc), I'd have a separate
variable each. They need special code to decide if they should be incremented
anyway.

With anything based on some „number“ of an incoming or outgoing packet (RRType,
QType, etc.), I'd create an array of counters directly indexed by the number.
All the numbers in DNS messages are relatively small (eg. mostly 2-bytes long).
Indeed, that would be slightly wasting (eg. 64k RRTypes, but most of them never
used), but I don't think it would be that bad, because:
 • This is few kB for the whole program. It would be different, if we wanted to
   have a separate counter for each (zone, RRType) combination, but I don't
   think we want that.
 • At least Linux, but I guess other modern OSes don't allocate pages of memory
   until they are used for the first time. As the RRTypes are allocated close to
   each other, they'd fit into one or two memory pages and the rest would just
   never get allocated. So it would take the address space, but not the actual
   real memory.

The results would, of course, contain only the used ones. Also, we could compact
them together if we wanted, but I'd do it when we send the statistics (or in the
stats daemon somehow) than during the processing.

Also, I wouldn't be afraid to have multiple arrays for multiple „parameters“
(one for qtype, one for rrtype, etc), instead of one long array. If we went this
way to the extreme, well, the whole memory is one huge array, why use variables
then?

> - how to update these counters with minimizing performance impact on
>   query processing, maybe with prototyping and benchmarking

One point extra here. I'd like to be able to turn statistics collection off in
auth completely. Not just not request it from b10-stats, but don't store it.

With regards

-- 
There is one difference between linux and windows.
With windows, you pay for the software, but you get all the T-shirts for free.
With linux, you get all the software for free, but you buy the T-shirts.

Michal 'vorner' Vaner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <https://lists.isc.org/pipermail/bind10-dev/attachments/20120830/5cfd2a7f/attachment.bin>


More information about the bind10-dev mailing list