[bind10-dev] How to implement query counters in auth module?

Naoki Kambe kambe at jprs.co.jp
Fri Sep 17 06:46:03 UTC 2010


Thank you for good comments and good ideas. I need to learn more about
these.

BTW, I think this topic is out of scope of #191. #191 is too big and
too long-term for one ticket. So I'll create another new ticket for a
statistics implement in auth module. We'll discuss more in this
ticket. Is that OK? I'll rollback r2921 etc.
Thanks,

Naoki Kambe

From: Jelte Jansen <jelte at isc.org>
Subject: Re: [bind10-dev] How to implement query counters in auth module?
Date: Wed, 15 Sep 2010 15:49:29 +0200

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On 09/15/2010 12:56 PM, Naoki Kambe wrote:
> > Hi Jelte-san,
> > 
> > Thanks for comments.
> > 
> >> I took a look at the commit you made yesterday (r2921), and as you already
> >> commented in the source, that is an extremely inefficient way to do the
> >> counting; it constructs a msgq message, sends it, and waits for a response from
> >> the stats module.
> >>
> >> AFAICT, this would happen on every query...
> > Yes, that's right. But I want to resolve this problem.
> > 
> >> If we do go for a 'push' approach similar to this I'd much rather see it
> >> implemented as something that sends the stats out periodically (like once every
> >> X seconds, or even minutes), optionally with a command on the command channel
> >> that tells it to send it out right away. Perhaps asio timers can help out here?
> > Yeah, I think this periodical approach is more reasonable. I try to research this "asio timers".
> > 
> > BTW, I want to know how to hold statistics data in auth until it sends to stats.
> > 
> 
> More generally than for auth; I think each module that collects statistics
> should have a module-specific data structure (or class in the case of c++), that
> holds those statistics. That class would have module-specific calls for
> incrementing counters, and setting other statistics values. It would also have
> either a way to convert the statistics it created to a message that can be sent
> to the statistics module (or perhaps it could even do that automatically, but in
> that sense I don't really know at this point how we would get the interaction
> with the cc session into it). For such common functionality we could make an
> abstract base class that each 'statistics-stub' would implement;
> 
> Something like:
> 
> class Statistics {
> public:
> 	virtual ElementPtr createMsg() = 0;
> 	virtual reset() = 0;
> }
> 
> 
> Then for auth specifically, if we want to gather statistics on udp and tcp queries;
> 
> class AuthStatistics : public Statistics {
> public:
> 	AuthStatistics() : udp_q_count(0), tcp_q_count(0);
> 	increaseUDPCount();
> 	increaseTCPCount();
> 	virtual ElementPtr createMsg();
> 	virtual reset();
> private:
> 	udp_q_count;
> 	tcp_q_count;
> }
> 
> AuthStatistics::createMsg() {
> 	<create that message and send it, like the example does now>
> 	if (success) {
> 		reset();
> 	}
> }
> 
> or something like that.
> 
> Then the big question is how to make that run periodically, and perhaps instead
> of having a createMsg() make a sendStats() that does all the message handling too...
> 
> Another question is whether we really want the statistics module to respond to
> this, we could also make it fire-and-forget (saving us the danger of having the
> auth module hang for [timeout] seconds if the statistics collector disappeared)
> 
> Jelte
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> 
> iEYEARECAAYFAkyQzukACgkQ4nZCKsdOncWvRACfb18BSzPhfSXSduhCWShrhOhM
> TKwAoI8Nflz5ZvHpM4G9Khw3p7+9xt98
> =0Y5s
> -----END PGP SIGNATURE-----
> 



More information about the bind10-dev mailing list