我注意到非常奇怪但一致的性能行为Google 公共 DNS 8.8.8.8
。尽管缓存了 DNS 记录,但响应时间仍在 范围内20-30ms
,这似乎很高。当我切换到开放DNS,缓存响应时间下降到1ms
。不用说,刚刚将所有服务器切换到 OpenDNS。有人能解释一下 Google Public DNS 的这种糟糕的性能行为吗?
以下是挖对于每个测试用例:
Google 公共 DNS
未缓存(389 毫秒)
➜ ~ dig @8.8.8.8 commando.io
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6_4.6 <<>> @8.8.8.8 commando.io
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 655
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;commando.io. IN A
;; ANSWER SECTION:
commando.io. 300 IN A 192.241.225.51
;; Query time: 389 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Sun Sep 22 12:08:37 2013
;; MSG SIZE rcvd: 45
缓存(24 毫秒)
➜ ~ dig @8.8.8.8 commando.io
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6_4.6 <<>> @8.8.8.8 commando.io
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 55425
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;commando.io. IN A
;; ANSWER SECTION:
commando.io. 295 IN A 192.241.225.51
;; Query time: 24 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Sun Sep 22 12:08:42 2013
;; MSG SIZE rcvd: 45
开放DNS
未缓存(46 毫秒)
➜ ~ dig commando.io
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6_4.6 <<>> commando.io
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 49578
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;commando.io. IN A
;; ANSWER SECTION:
commando.io. 300 IN A 192.241.225.51
;; Query time: 46 msec
;; SERVER: 208.67.222.222#53(208.67.222.222)
;; WHEN: Sun Sep 22 12:09:43 2013
;; MSG SIZE rcvd: 45
缓存(1 毫秒)
➜ ~ dig commando.io
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6_4.6 <<>> commando.io
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 42532
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;commando.io. IN A
;; ANSWER SECTION:
commando.io. 273 IN A 192.241.225.51
;; Query time: 1 msec
;; SERVER: 208.67.222.222#53(208.67.222.222)
;; WHEN: Sun Sep 22 12:10:10 2013
;; MSG SIZE rcvd: 45
答案1
这可能与接近度有关——1ms 的响应时间表明从路由角度来看,您所访问的 OpenDNS 服务器距离您的系统非常近。
DNS 查询时间与原始往返时间 (ping) 相比如何?