[Dnsmasq-discuss] how to add a short delay to DNS response?

Jeff Ferland jeff at nimbula.com
Tue Feb 5 20:53:13 GMT 2013


On 2013-02-05, at 12:15 , compek at gmail.com wrote:
> for education purposes I would like to learn how slow DNS responses
> impact on an application' performance. My intention is to insert a
> usleep(100000); in forward.c to add an additional 100ms to "Query time".

There are some other tricks you can try besides changing the code itself. See http://stackoverflow.com/q/614795/90322 and http://serverfault.com/q/336089/3139. The first one has lots of broad answers, the second lets you use rules to classify only a certain stream as delayed.

> Could you suggest a right placement for the "usleep" in forward.c (or
> other source file) so that it will apply only once during a transaction?

That'd take a bit of time to look at. One important thing to consider is that if you don't delay in a separate thread, everything else in the daemon will also be queueing up behind the delay. Also, how do you define a transaction in DNS? Are you delaying every reply? I think in almost every case, the combination of tc and iptables will serve you better.

-Jeff


More information about the Dnsmasq-discuss mailing list