[bind10-dev] Socket statistics (ticket2156)

fujiwara at jprs.co.jp fujiwara at jprs.co.jp
Fri Aug 31 11:22:32 UTC 2012


I have two issues about socket statistics.

1. socket statistics items are hard to count.
2. where to hold counters ?

please comment.

1. socket statistics items are hard to count.

Statistics items are listed in wiki page.

  https://bind10.isc.org/wiki/StatisticsItems

  {unix,ipv4,ipv6}
  .{udp,tcp}
  .{open,openfail,close,bindfail,connfail,conn,
    acceptfail,accept,senderr,recverr}

BIND 10's C++ code uses Boost ASIO to hide socket details.
I think it is hard to count as listed.

At first, I added counters where logging codes exist.
    git b3d9dd1d5624efbd25f04b025ebc34e1bf533c26

    SOCKET_ASIODNS_FD_ADD_TCP,         ///< adding a new TCP server
    SOCKET_ASIODNS_FD_ADD_UDP,         ///< adding a new UDP server
    SOCKET_ASIODNS_FETCH_COMPLETED,    ///< upstream fetch has now completed
    SOCKET_ASIODNS_FETCH_STOPPED,      ///< upstream fetch has been stopped
    SOCKET_ASIODNS_SOCKET_OPEN_ERROR,  ///< error opening socket
    SOCKET_ASIODNS_READ_DATA_ERROR,    ///< error reading data
    SOCKET_ASIODNS_READ_TIMEOUT,       ///< receive timeout
    SOCKET_ASIODNS_SEND_DATA_ERROR,    ///< error sending data
    SOCKET_ASIODNS_UNKNOWN_ORIGIN,     ///< unknown origin for ASIO error
    SOCKET_ASIODNS_UNKNOWN_RESULT,     ///< unknown result

Now, I added some accept/open counters.
    git 6c6ff24ac1eaf91473d79c765c5ccb05b899abdb

    SOCKET_ASIODNS_IPV4_TCP_ACCEPT,    ///< number of IPv4 TCP accept
    SOCKET_ASIODNS_IPV6_TCP_ACCEPT,    ///< number of IPv6 TCP accept
    SOCKET_ASIODNS_IPV4_TCP_ACCEPTFAIL, ///< number of IPv4 TCP acceptfail
    SOCKET_ASIODNS_IPV6_TCP_ACCEPTFAIL, ///< number of IPv6 TCP acceptfail
    SOCKET_ASIODNS_TCP_OPEN,           /// number of TCP OPEN

Does this approach reasonable ?
Or add some codes into asiolink and asiodns to count as listed ?

2. where to hold counters ?

class isc::io_service::IOService seems to be a base class for socket
related codes. May I add counters in it ?

Where do you think to add a socket statistics counter ?

# Currently, I used global isc::statistics::Counter class.
# It is easy, but it is not C++ way.

--
Kazunori Fujiwara, JPRS <fujiwara at jprs.co.jp>


More information about the bind10-dev mailing list