Why is domain name resolution slow in Sierra

Solution 1:

I assume you already executed all usually proposed mDSNResponder tasks to reset it, clear caches etc.

.dev is a proper "New gTLDs" since 2014. Probably you are using Google Chrome to access your site(s) which often uses its own DNS query service. The flaky name resolution management in OS X as well as the Google Chrome "service" (which both seem to ignore /etc/hosts entries sometimes and then fail to resolve a real firstdomain.dev in the WAN) suggest to simply use another TLD like .development, .devhome or .devwork.

And/or set up dnsmasq with homebrew and use localhost/127.0.0.1 as only DNS server in your network preferences. Setup proper IP addresses instead of a lot of 127.0.0.1 IP-addresses in the config files.

Solution 2:

It turns out the problem was actually mod_authz_host in the VM. It was trying to do a reverse lookup on the dummy domains and sometimes timing out, sometimes not. Since I have no need for mod_authz_host I could safely remove it. It is curious how the upgrade to Sierra caused this though.