aus*_*sip 9 domain-name-system performance bind slow-connection recursive
我们刚刚使用 Bind 9.10 的最新稳定版本设置了递归 DNS 服务器
我们发现递归 DNS 查找非常慢。1 - 3 秒之间的任何时间。一旦在缓存中查找,DNS 就会按预期在几毫秒内解析。
我们正在使用 ROOT 提示进行递归查找,这似乎是缓慢的来源。如果我们配置转发器,DNS 解析将归结为 100 - 300 毫秒的合理递归时间。
对于我们正在设置的服务,我不想依赖转发器,我更喜欢使用 root 提示。
这是来自我们的named.conf文件的主要配置。任何有助于提高性能的指针都会很棒。
options{
allow-recursion { any; };
allow-query-cache { any; };
allow-query { any; };
listen-on port 53 { any; };
listen-on-v6 port 53 { any; };
dnssec-enable yes;
dnssec-validation yes;
dnssec-lookaside auto;
zone-statistics yes;
max-cache-ttl 3600;
max-ncache-ttl 3600;
/* Path to ISC DLV key */
bindkeys-file "/etc/named.iscdlv.key";
managed-keys-directory "/var/named/dynamic";
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/stats/named_stats.txt";
memstatistics-file "/var/named/stats/named_mem_stats.txt";
rate-limit {
responses-per-second 10;
log-only yes;
};
prefetch 5;};
zone "." {
type hint;
file "named.ca";};
include "/var/named/conf/logging.conf";
Run Code Online (Sandbox Code Playgroud)
我们发现了问题。这是一个 NIC 硬件卸载问题。
运行tcpdump -vvv -s 0 -l -n port 53
发现[bad udp cksum 6279!]
每个 DNS 查询的一些错误。
在谷歌上浏览一下,我就找到了正确的方向。事实证明,由于我们的 CentOS 系统在 XenServer 上作为 VM 运行(VMWare 等报告的类似问题)默认启用 NIC 硬件卸载。
运行ethtool -k eth0 | grep on
显示如下
x-checksumming: on
tx-checksum-ipv4: on
scatter-gather: on
tx-scatter-gather: on
tcp-segmentation-offload: off
tx-tcp-segmentation: off
tx-tcp-ecn-segmentation: off
tx-tcp6-segmentation: off
udp-fragmentation-offload: off [fixed]
generic-segmentation-offload: on
generic-receive-offload: on
tx-gso-robust: on [fixed]
tx-fcoe-segmentation: off [fixed]
tx-gre-segmentation: off [fixed]
tx-udp_tnl-segmentation: off [fixed]
Run Code Online (Sandbox Code Playgroud)
运行ethtool -K eth0 tx off rx off
禁用 TCP TX 卸载。我重新启动了网络服务
service network restart
Run Code Online (Sandbox Code Playgroud)
并测试了 BIND。我们现在从 BIND 获得非常快速的响应时间
dig centos.org
; <<>> DiG 9.10.2-P4-RedHat-9.10.2-P4.el6 <<>> centos.org
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 61933
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4000
;; QUESTION SECTION:
;centos.org.INA
;; ANSWER SECTION:
centos.org.60INA85.12.30.227
;; Query time: 268 msec
;; SERVER: 192.168.10.25#53(192.168.10.25)
;; WHEN: Thu Sep 17 08:25:39 AEST 2015
;; MSG SIZE rcvd: 55
Run Code Online (Sandbox Code Playgroud)