ogham / dog

A command-line DNS client.
https://dns.lookup.dog/
European Union Public License 1.2
6.19k stars 177 forks source link

Why are there large time differences between dig and dog? #102

Open mdav43 opened 2 years ago

mdav43 commented 2 years ago

Cross posting from here: https://github.com/cleanbrowsing/dnsperftest/issues/74

Apologies - I wasn't able to locate an answer using google or stackoverflow.

Why is there a large time difference caused when substituting the dig command for the dog command? Is there an overhead in dig thats bypassed in dog?

To replicate, replace:

ttime=`$dig +tries=1 +time=2 +stats @$pip $d |grep "Query time:" | cut -d : -f 2- | cut -d " " -f 2`

with

ttime=`$dog $d @$pip --time | grep "Ran in" | cut -c 8-15 | cut -d "m" -f 1`

also add the following at the top of the file after ~line 5/6


{ command -v drill > /dev/null && dog=drill; } || { command -v dog > /dev/null && dog=dog; } || { echo "error: dog was not found. Please install dog."; exit 1; }

As an example - here are my DNS perfs (i amended so you can see which domain its hitting)

With DIG (DiG 9.10.6)

                     www.go  amazon  facebo  carous  www.re  wikipe  twitte  gmail.  instag  whatsa  Average 
192.168.1.37         57 ms   49 ms   50 ms   1000 ms 55 ms   56 ms   53 ms   50 ms   50 ms   49 ms     146.90
192.168.1.1          50 ms   50 ms   49 ms   50 ms   49 ms   50 ms   50 ms   1000 ms 58 ms   54 ms     146.00
cloudflare           54 ms   54 ms   50 ms   49 ms   51 ms   53 ms   53 ms   52 ms   52 ms   53 ms     52.10
level3               1000 ms 62 ms   53 ms   49 ms   51 ms   172 ms  49 ms   50 ms   50 ms   50 ms     158.60
google               52 ms   51 ms   50 ms   49 ms   49 ms   52 ms   49 ms   51 ms   51 ms   50 ms     50.40
quad9                50 ms   53 ms   50 ms   49 ms   53 ms   50 ms   53 ms   49 ms   51 ms   50 ms     50.80
freenom              51 ms   51 ms   49 ms   51 ms   49 ms   50 ms   50 ms   49 ms   1000 ms 58 ms     145.80
opendns              52 ms   49 ms   53 ms   49 ms   54 ms   53 ms   52 ms   49 ms   51 ms   50 ms     51.20
norton               51 ms   1000 ms 56 ms   51 ms   50 ms   52 ms   52 ms   50 ms   49 ms   52 ms     146.30
cleanbrowsing        49 ms   53 ms   55 ms   50 ms   1000 ms 57 ms   50 ms   49 ms   50 ms   49 ms     146.20
yandex               50 ms   52 ms   52 ms   50 ms   49 ms   54 ms   49 ms   51 ms   51 ms   51 ms     50.90
adguard              50 ms   51 ms   50 ms   53 ms   50 ms   49 ms   49 ms   49 ms   49 ms   50 ms     50.00
neustar              51 ms   51 ms   51 ms   51 ms   51 ms   56 ms   53 ms   53 ms   51 ms   50 ms     51.80
comodo               50 ms   54 ms   54 ms   53 ms   54 ms   53 ms   53 ms   52 ms   50 ms   49 ms     52.20
nextdns              51 ms   51 ms   53 ms   53 ms   54 ms   53 ms   1000 ms 56 ms   49 ms   50 ms     147.00

vs with DOG (Dog -v v0.1.0)


192.168.1.37         15 ms   5 ms    6 ms    12 ms   5 ms    23 ms   7 ms    16 ms   5 ms    5 ms      9.90
192.168.1.1          7 ms    9 ms    5 ms    5 ms    5 ms    5 ms    17 ms   7 ms    4 ms    5 ms      6.90
...others similar