[ldns-users] Question about ldns packet timings

Robert Edmonds edmonds at debian.org
Fri Mar 20 21:10:32 UTC 2015

Ryan Braud wrote:
> Hi everyone, I'm not sure if this is the correct list for this question,
> but I had a question/enhancement request for ldns.  Currently, the function
> ldns_pkt_querytime() returns the amount of time a request took, measured
> with gettimeofday().  I was wondering if there was a good reason why this
> time is not calculated from a kernel timestamp via the SIOCGSTAMP ioctl?
> We are using libldns in our production environment and when the processor
> gets busy, we end up with random spikes in latency due to scheduling
> overhead, etc.

Hi, Ryan:

Doesn't SIOCGSTAMP only give you the timestamp of the last received
packet?  If you want the "real" request latency, wouldn't you want
kernel timestamps on both the sent and received packets?

(I think you can do this, at least on Linux, with SO_TIMESTAMPING.)

Robert Edmonds
edmonds at debian.org

More information about the ldns-users mailing list