Making dns_erlang Fast: Binary Tricks for the BEAM

NewTech & AIblog.dnsimple.comSince 2010

Making dns_erlang Fast: Binary Tricks for the BEAM

How binary pattern matching, append-friendly accumulators and SWAR cut our nameserver's CPU per query by 12%, with lessons for any BEAM app.

Quick read

A technical blog post explaining how the dns_erlang DNS library was optimised on the BEAM using binary-aware techniques. It shows concrete changes and measurements that reduce CPU per query and increase throughput for Erlang/Elixir binary protocol code.

  • Use a single append-friendly binary accumulator for encodes
  • Rely on sub-binaries and match contexts to avoid copies
  • Apply SWAR and small-integer awareness for faster parsing

Reactions

No reactions yet. Record a short about this link and it shows up here, in Reels and in the community feed.

Is blog.dnsimple.com your site? Sign in to verify it and get a Verified badge, full stats and a link-back badge.

A closer look at Making dns_erlang Fast: Binary Tricks for the BEAM

What this post is about

This is a technical writeup describing how the dns_erlang DNS library was optimised by its authors. It focuses on binary pattern matching, append-friendly accumulators and SWAR tricks for reducing CPU per query on the BEAM. The author explains where the code runs (DNSimple’s cache edge and the authoritative origin running erldns) and why DNS parsing/encoding is hot code: each query through a nameserver goes through dns_erlang twice, once to decode and once to encode.

What you can learn and do from the article

The post teaches concrete BEAM-level ideas: how binaries are represented (small binaries on the process heap, larger binaries as shared off-heap binaries), how sub-binaries and match contexts avoid copies, how append-only accumulators can avoid repeated copying, the integer tagging limits that make small vs bignum values different, and how to inspect binary optimisations with erlc +bin_opt_info or ERL_COMPILER_OPTIONS=bin_opt_info. It also reports empirical results (benchmarked with Benchee on two machines, OTP 29 with the JIT) and explains specific encoder changes, for example replacing many intermediate binaries with a single accumulator that starts with a 12-byte header placeholder.

Who will find this useful

Erlang and Elixir developers who parse or produce binary protocols will get the most from the article, especially teams caring about high-throughput servers. The examples and patterns target people who want to write code that the BEAM compiler and JIT can prove safe to optimise, and who value working through parity tests and benchmarks when changing hot paths.

Questions people ask about Making dns_erlang Fast: Binary Tricks for the BEAM

Does the post show measurable improvements?
Yes; the author reports that library changes reduced CPU per query by 12% and increased queries served per second by 14% on a production-shaped workload, measured with Benchee.
Can I see where binary optimisations apply in my code?
Yes; the post points out you can compile with erlc +bin_opt_info or set ERL_COMPILER_OPTIONS=bin_opt_info to get reports of match contexts and where optimisations are kept or given up.
Are the encoder changes safe and tested?
The author describes running a parity harness that proved byte-for-byte parity with the old code, including error cases, across 26,434 cases for name decoding.

Making dns_erlang Fast: Binary Tricks for the BEAM was shared on NexURLs by Nexis on November 4, 2026, in Tech & AI.

What we found on this site

Served through
Netlify
Home page answered in
470 ms
Trackers
Google Analytics
Ads
None found
RSS feed
Yes
AI crawlers
Lets them in
Set up for phones
Yes
Real-visitor speed
Passes Core Web Vitals
Popularity
Top 100,000 domain (Cloudflare)
Google safety check
No threats found
Domain registered
2010
Domain renews
April 2029

Checked November 4, 2026 from the site’s own code and public records. See how the rest of the web compares in the NexURLs Internet Report.

Quick answers

What is Making dns_erlang Fast?

Making dns_erlang Fast (blog.dnsimple.com): A technical blog post explaining how the dns_erlang DNS library was optimised on the BEAM using binary-aware techniques. It shows concrete changes and measurements that reduce CPU per query and increase throughput for Erlang/Elixir binary protocol code.

Who shared Making dns_erlang Fast on NexURLs?

It was shared by Nexis in November 2026. Every link on NexURLs is shared by a real member and passes a safety check before it goes out.

What are some sites like Making dns_erlang Fast?

Members found these close to it: Sam Who, A Very Fast IPv4 Parser, in Swift, Work on GEFS. The full list is on this page under Sites like Making dns_erlang Fast.

Sites like Making dns_erlang Fast

More Tech & AI finds

All Tech & AI websites →

Feeling lucky? Try the random website generator.

Where people went next

Nobody has added a next stop yet. Be the first.

Five finds like this, every morning

Five great websites every morning, picked by people and written up by AI. Free, and one click to stop.

Remember Me
Scroll to Top

More

📰 Latest Posts
📊 Community Stats
👋 New Members
👥 Popular Groups