ezyang’s blog

the arc of software bends towards understanding

Reduce Ubuntu latency by disabling mDNS

This is a very quick and easy fix that has made latency on Ubuntu servers I maintain go from three to four seconds to instantaneous. If you've noticed that you have high latency on ssh or scp (or even other software like remctl), and you have control over your server, try this on the server: aptitude remove libnss-mdns. It turns out that multicast DNS on Ubuntu has a longstanding bug on Ubuntu where they didn't correctly tune the timeouts, which results in extremely bad performance on reverse DNS lookups when an IP has no name.

Removing multicast DNS will break some applications which rely on multicast DNS; however, if you're running Linux you probably won't notice. There are a number of other solutions listed on the bug I linked above which you're also welcome to try.

3 Responses to “Reduce Ubuntu latency by disabling mDNS”

  1. LJ says:

    ohmygodIcouldkissyou. thank you so much – this un-broke my entire testbed. ;-)

  2. Dave says:

    OMG3someIcomingWithMoreKisses, lol Thank you so much!

  3. ViiJay says:

    Holy. Shit.
    Seriously I have searched for this issue a long time and this is it. Just uninstall one simple package which messes up my whole DNS setup under linux.

    My issue was that could ping my local server with just the name like: “ping bob” and I got a reply. If I would use instead “ping bob.mydomain.local” it just didn’t work. Within Linux I just couldn’t get it to work. Within a Windows machine I had no trouble at all. First I thought there was my pfsense firewall acting up in some way but after a long period of time and countless internet searches I found this simply article and there it is. The solution for my problem.

    Thank you very much. Very. Very. Very. Much.


Leave a Comment