Draft DNS resolve speed preview script for Linux for quick troubleshoot DNS resolve speed issues

#!/bin/bash
DOMAINS="ibm.com yahoo.com google.com oracle.com bmw.com audi.com cnn.com bbc.com dw.com wikipedia.org mit.edu"
for domain in $DOMAINS; do
  echo $domain
  dig  $domain |grep Query
done

Example execution

time ./dns_bench.sh

Example output

ibm.com
;; Query time: 32 msec
yahoo.com
;; Query time: 1 msec
google.com
;; Query time: 2 msec
oracle.com
;; Query time: 31 msec
bmw.com
;; Query time: 34 msec
audi.com
;; Query time: 122 msec
cnn.com
;; Query time: 31 msec
bbc.com
;; Query time: 36 msec
dw.com
;; Query time: 36 msec
wikipedia.org
;; Query time: 1 msec
mit.edu
;; Query time: 32 msec

real    0m0.468s
user    0m0.068s
sys     0m0.028s

example second run

ibm.com
;; Query time: 0 msec
yahoo.com
;; Query time: 0 msec
google.com
;; Query time: 0 msec
oracle.com
;; Query time: 0 msec
bmw.com
;; Query time: 0 msec
audi.com
;; Query time: 0 msec
cnn.com
;; Query time: 0 msec
bbc.com
;; Query time: 0 msec
dw.com
;; Query time: 0 msec
wikipedia.org
;; Query time: 0 msec
mit.edu
;; Query time: 0 msec

real    0m0.110s
user    0m0.080s
sys     0m0.012s


  • No labels