Loading…
An Introduction to DNS Traffic Management
2023-10-18
- Source
- Shopify
- Published
- Added to Yomu
Summary
DNS traffic management applies data-driven DNS responses to direct clients to different service endpoints, extending DNS’s basic role of mapping domain names to IP addresses. The post introduces DNS through its history from HOSTS.TXT, explains zones, records, nameservers, root servers, TTL, and negative TTL, then connects caching behavior to routing decisions. Low TTLs can make changes visible sooner, but repeated DNS resolution adds latency: with a one-second resolution time, a 15-second TTL could add 5,760 seconds per day, compared with 1,440 seconds at 60 seconds; resolver behavior can also make delays slightly longer. Use cases include active-passive failover, active-active traffic sharing, progressive green-blue deployments, and location-based routing, while Shopify’s system evolved into an automated, self-served platform serving more than 40 domains across 12 teams and over 100M requests per 24 hours.
Context
Distributed systems need resilient ways to direct requests, fail over unavailable services, distribute load, deploy changes progressively, and select performant endpoints by location. DNS traffic management addresses these needs, but DNS caching and resolution time create a trade-off between routing freshness and connection performance.
Approach / What changed
The approach uses DNS responses to direct clients to service endpoints according to configured percentages, endpoint health, deployment stages, or requester location. TTL controls how long answers remain cached, while Shopify’s implementation evolved from manually configured approaches into an automated, self-served system.
Takeaways
- A 15-second TTL can improve the freshness of DNS traffic decisions, but with one second of DNS resolution time it can add 5,760 seconds of resolution time over a day; a 60-second TTL would add 1,440 seconds.
- Active-passive DNS management redirects traffic to a secondary cluster when the primary becomes unavailable and can return traffic after recovery, subject to TTL-related delay.
- DNS traffic management supports active-active load sharing, green-blue progressive deployments, and location-based answers for selecting endpoints by client region.