Making dns_erlang Fast: Binary Tricks for the BEAM

by Nelson Vides | October 19, 2026

At Goatmire Elixir this year, I gave a talk about observing a name server that handles millions of packets. Performance came up as a guilty pleasure of mine, and I hinted at some numbers. Afterwards, in the corridors, attendees kept asking the same question: what did you actually do to bring average CPU down so much? This post is the long answer for one big piece of that work: making our DNS library cheaper to run.

First, some context on where this code runs. DNSimple's managed DNS hosting has two layers. Queries for your domains first reach our cache edge, a global anycast network we build and operate ourselves, which answers whatever it already has cached. Everything else goes to the origin: the authoritative name servers that hold every zone and build every answer. The origin runs erldns, our open-source DNS server written in Erlang, and since it does the real work behind every cache miss, every query it answers has to be as cheap as possible.