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

compek at gmail.com compek at gmail.com
Thu Feb 7 01:29:08 GMT 2013


On 02/05/2013 09:53 PM, Jeff Ferland wrote:
> 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
>

thank you Jeff for pointing to the right solution. I've tested an 
example with tc+iptables and it works good.

Pavel




More information about the Dnsmasq-discuss mailing list