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

Naoki Kambe kambe at jprs.co.jp
Wed Sep 15 10:56:54 UTC 2010


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.

Thanks,

Naoki Kambe
> 
> Jelte
> 
> On 09/15/2010 06:07 AM, Naoki Kambe wrote:
> > I committed an example code to the auth module yesterday. Please see also
> > r2921 in branches/trac191-rebased/src/bin/auth/.
> > 
> > Naoki Kambe
> > 
> > From: Naoki Kambe <kambe at jprs.co.jp>
> > Subject: [bind10-dev] How to implement query counters in auth module?
> > Date: Mon, 13 Sep 2010 21:36:56 +0900 (JST)
> > 
> >> Jinmei-san, Evan-san,
> >>
> >> This is a question related to trac #191.  We need to add some
> >> implements into the auth module in order that the stats module works
> >> along with the auth module. Because the auth module doesn't either
> >> seem to have query counters nor throw counters to the stats module. So
> >> the stats module can't collect query counters from the auth module in
> >> current source files. I want to know how to implement that. Can you
> >> give me any suggestions? I think I may add following implements into
> >> auth_srv.cc and/or some source files in the auth module:
> >>
> >>   Implement:
> >>     - Received Query counters
> >>       + They are ones over UDP and TCP.
> >>       + The variables of counters are shared with several auth
> >>       	processes(responders).
> >>     - Throwing the counts toward the stats module periodically
> >>
> >>   An example code:	# This may be wrong or inefficient.
> >>     // a query counter over UDP
> >>     static int udp_queries = 0
> >>     // receives queries and increase counters
> >>     ...
> >>     // construct command
> >>     static string udp_queries_str;
> >>     sprintf(udp_queries_str, "%d", udp_queries);
> >>     static string stats_command = "{ \"command\": ["
> >>        		  	       	+ "  \"increase\","
> >>        		  	       	+ "   { \"stats_data\": {"
> >>        		  	       	+ "       \"auth.queries.udp\": " + udp_queries_str
> >>        		  	       	+ "     }"
> >>        		  	       	+ "   }"
> >>        		  	       	+ "  ]"
> >>        		  	       	+ "}";
> >>     // throw the count
> >>     stats_session->group_sendmsg(stats_command, "Stats", "*", "*");
> >>     // reset counter and return to init
> >>     udp_queries = 0;
> >>
> >>       ... I think the case of TCP is almost same above.
> >>
> >>   Please refer to the wikipage for details:
> >>    http://bind10.isc.org/wiki/StatsModule
> >>
> >> Thanks,
> >>
> >> Naoki Kambe
> >> _______________________________________________
> >> bind10-dev mailing list
> >> bind10-dev at lists.isc.org
> >> https://lists.isc.org/mailman/listinfo/bind10-dev
> >>
> > _______________________________________________
> > bind10-dev mailing list
> > bind10-dev at lists.isc.org
> > https://lists.isc.org/mailman/listinfo/bind10-dev
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> 
> iEYEARECAAYFAkyQnrAACgkQ4nZCKsdOncXMhgCgvORc8KnAjy8xGXz31UPCUT2i
> btoAnj8xclb4O7hqYWjg61MmCc/mB0FK
> =yQV+
> -----END PGP SIGNATURE-----
> 



More information about the bind10-dev mailing list