janeczku/go-dnsmasq

high response time when using go-dnsmasq

Opened this issue · 3 comments

Hi,

I'm using go-dnsmasq as a sidecar for nginx,

when using go-dnsmasq to query a k8s service the response time about 0.5 sec

Server:		localhost
Address:	127.0.0.1#53

Name:	vault.default.svc.cluster.local
Address: 100.68.156.43


real	0m1.010s
user	0m0.004s
sys	0m0.004s

verbose logs

time="2017-12-10T16:30:32Z" level=debug msg="[63317] Doing absolute lookup" 
time="2017-12-10T16:30:32Z" level=debug msg="[63317] Querying upstream 100.64.0.10:53 for qname 'vault.default.svc.cluster.local.'" 
time="2017-12-10T16:30:32Z" level=debug msg="[63317] Response code from upstream: NOERROR" 
time="2017-12-10T16:30:32Z" level=debug msg="[63317] Absolute lookup yielded result. Response to client: NOERROR" 
time="2017-12-10T16:30:32Z" level=debug msg="[63317] Response time: **767.279**µs" 

when querying k8s directly :

root@management-proxy:/# time nslookup vault 100.64.0.10
Server:		100.64.0.10
Address:	100.64.0.10#53

Name:	vault.default.svc.cluster.local
Address: 100.68.156.43


real	0m0.008s
user	0m0.004s
sys	0m0.000s

container configuration:

  - name: dnsmasq
    image: janeczku/go-dnsmasq:release-1.0.7
    args:
      - --listen
      - "127.0.0.1:53"
      - --hostsfile=/etc/hosts
      - --verbose

any suggestion ?

same result when querying google.com

root@management-proxy:/# time nslookup google.com 100.64.0.10
Server:		100.64.0.10
Address:	100.64.0.10#53

Non-authoritative answer:
Name:	google.com
Address: 209.85.202.100
Name:	google.com
Address: 209.85.202.101
Name:	google.com
Address: 209.85.202.102
Name:	google.com
Address: 209.85.202.113
Name:	google.com
Address: 209.85.202.138
Name:	google.com
Address: 209.85.202.139


real	0m0.011s
user	0m0.000s
sys	0m0.008s
root@management-proxy:/# time nslookup google.com localhost
Server:		localhost
Address:	127.0.0.1#53

Non-authoritative answer:
Name:	google.com
Address: 209.85.202.139
Name:	google.com
Address: 209.85.202.100
Name:	google.com
Address: 209.85.202.101
Name:	google.com
Address: 209.85.202.102
Name:	google.com
Address: 209.85.202.113
Name:	google.com
Address: 209.85.202.138


real	0m5.016s
user	0m0.004s
sys	0m0.004s

r0l1 commented

Can confirm this issue.

r0l1 commented

This is not an issue with go-dnsmasq. This is an issue with nslookup.

Try:

time nslookup google.com 127.0.0.1