最近发现某台 NGINX 服务器执行 nginx -t 的时候返回结果非常慢,其他机器非常快,今天决定解决一下,遂用 strace 打印了 nginx -t 执行时的系统调用,抓出来了几个慢的系统调用,类似于 https://i.v2ex.co/rvO8s03v.png 这种,然后我尝试在执行 nginx -t 的同时,循环执行 lsof -d 5 观察到了 NGINX 一直在连接 pdns.dnspod.cn 这个域名,查看了 resolve.conf ,确实首个配置是 nameserver 119.29.29.29 ( dnspod ),第二个是 nameserver 223.5.5.5 (阿里),对调了两者在配置文件中的位置后,nginx -t 变得非常快。现在有两个疑问,第一是为啥 nginx -t 的时候要去测试 DNS ?第二个就是为什么我在 /etc/resolve.conf 中明明写的是 IP 地址( 119.29.29.29 ),nginx 会解析到 pdns.dnspod.cn 这个域名呢?而且 pdns.dnspod.cn 解析出的 IP 也并不是 119.29.29.29 。