我注意到来自Google Public DNS 的非常奇怪但一致的性能行为8.8.8.8
。即使缓存了 DNS 记录,响应时间也在 20 的范围内20-30ms
,这似乎很高。当我切换到OpenDNS时,缓存的响应时间下降到1ms
. 不用说,只是将所有服务器都切换到 OpenDNS。任何人都可以从 Google 公共 DNS 中解释这种糟糕的性能行为吗?
以下是每个测试用例的dig输出:
谷歌公共 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
缓存(1ms)
➜ ~ 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
这可能与邻近性有关——1ms 的响应时间表明从路由的角度来看,您所访问的 OpenDNS 服务器非常靠近您的系统。
DNS 查询时间与原始往返时间 (ping) 相比如何?