Replace fdset with simpler API
This relates to issue #65 (closed).
The reasons are:
- fdsets are not used in UDP, since simple syscalls have lower latency for smaller number of sockets
- TCP/XFR handlers are threaded, so each is able to serve at most (65536-c)/threads, if it is in the number of thousands it is very likely that some connections are stalling on purpose - with regular traffic there will be most of the connections active
- epoll/kqueue requires additional hashtable to lookup
fd -> context
, which adds to latency - since fdsets must make no assumption of the underlying implementation, some copying or conversion is required when iterating, this adds to latency
- generally speaking, the specific implementations are useful when there is a lots of inactive/persistent clients but this is not a case with DNS, where:
- number of xfers are limited anyway and work as fast as possible
- TCP clients are forcefully disconnected when idling or present a one-shot query