/// article

The Problem With Loading The Whole Internet Into Memory

DNS steering systems need information. A steering engine may need IP prefixes, Autonomous System Numbers, country mappings, regions, resolver classifications, health status, routing policies, destination metadata, and temporary runtime information. A simple implementation idea is tempting: Load everything into memory so every query can find what it needs...

By lordfrancs3

DNS steering systems need information. A steering engine may need IP prefixes, Autonomous System Numbers, country mappings, regions, resolver classifications, health status, routing policies, destination metadata, and temporary runtime information. A simple implementation idea is tempting: Load everything into memory so every query can find what it needs immediately. For a small dataset, that can work well. The problem begins when “everything” keeps growing. The process may eventually contain: Every known IP prefix Every ASN mapping Every geographic mapping Every resolver classification Every routing policy Every historical policy version Every health record Every temporary classification Every cached lookup Every statistics object At that point, memory is no longer being used only to make DNS fast. The authoritative server has become a large in-memory database. That creates costs. More memory must be allocated. Startup takes longer. Policy reloads become heavier. Data structures require larger indexes. Old objects need cleanup. Multiple authoritative processes may duplicate the same information. A bad update can suddenly consume large amounts of RAM. Most importantly, the amount of infrastructure required to answer one DNS query can become disconnected from the amount of information that query actually needs. A better engineering principle is: Keep the authoritative query path supplied with the information it needs, without assuming that every piece of Internet data must live permanently inside every DNS process. This article explains why. The Problem Consider an authoritative DNS service answering for: www.example.com It has three possible destinations: Site A 192.0.2.10 Site B 198.51.100.10 Site C 203.0.113.10 A query might require only a few pieces of information. For example: Query: www.example.com Client network: 198.51.100.0/24 ASN: Example ASN Region: Region A Healthy destinations: Site A Site B Matched policy: Region A -> Site A The final decision is small. Answer: 192.0.2.10 But imagine that the server prepares for this query by loading a huge amount of unrelated information: DNS PROCESS | +------------------+------------------+ | | | v v v All IPv4 prefixes All IPv6 prefixes All ASN data | | | +------------------+------------------+ | All geographic data | All resolver records | All policy versions | All historical state | v DNS Query | v One small decision Most of that information may never participate in the decision. The problem is not that memory is being used. Memory is supposed to be used. The problem is loading information simply because it exists rather than because the authoritative service needs it. This Problem Is Older Than Modern DNS Steering The idea behind DNS itself provides a useful lesson. RFC 1034 explains that DNS was designed as a distributed system partly because the total database was expected to become large. It specifically notes that attempts to collect a consistent copy of the entire database become increasingly expensive and difficult, and should therefore be avoided. That design decision is still relevant. DNS did not become successful because every DNS server copied everything on the Internet into memory. DNS distributes responsibility. DNS namespace . | +--------------+--------------+ | | | com org net | example.com | www.example.com Different authoritative servers are responsible for different parts of the namespace. Resolvers obtain information as needed and cache it according to DNS rules. RFC 1034 explicitly describes distributed data, caching, and refresh behavior as basic DNS design principles. A DNS steering engine should remember the same lesson. More information is not automatically better architecture. Core Concept: Working Set Versus Total Dataset The most useful concept here is the working set. The total dataset may contain millions of objects. A particular DNS query may need only a tiny fraction of them. Consider a conceptual dataset: Total available information +------------------------------------------+ | IP prefixes | | ASN mappings | | Country mappings | | Region mappings | | Resolver classifications | | Routing policies | | Destination information | | Health data | | Historical policies | | Statistics | +------------------------------------------+ Now consider one query: www.example.com A Its working set might be: Relevant zone Relevant policy Relevant client prefix Relevant ASN Relevant country Three destinations Three health states That is much smaller. Conceptually: TOTAL DATASET +--------------------------------------------------+ | | | +-------------------------------+ | | | QUERY WORKING SET | | | | | | | | Prefix | | | | ASN | | | | Country | | | | Current policy | | | | Current health | | | +-------------------------------+ | | | | Thousands or millions of unrelated objects | | | +--------------------------------------------------+ The engineering question becomes: How much of the total dataset really needs to live in the authoritative query process? The answer may be less than you initially think. Loading Everything Looks Simple There are legitimate reasons developers are attracted to an all-in-memory design. The query path becomes conceptually simple: Start server | v Load everything | v Keep everything in RAM | v Query arrives | v Look up information | v Return answer The advantages are easy to see. There are no database calls for every query. There are fewer external dependencies in the hot path. Local lookups can be fast. Data structures can be prepared in advance. These are good goals. The problem is the word: everything An efficient query path does not require an unlimited working set. The better target is: Fast local access + Controlled amount of state rather than: Fast local access + Every object we have ever collected Memory Cost Is More Than the Raw Data Size Suppose you have one million prefix records. Imagine the raw serialized representation averages 100 bytes per record. It is tempting to calculate: 1,000,000 x 100 bytes = 100 MB and assume the process needs about 100 MB. Real memory use can be much larger. An in-memory object may also require: Object headers Pointers Alignment Strings Indexes Hash table entries Tree nodes Allocator metadata Reference structures Runtime bookkeeping The result might look more like: Raw record | +--> Object representation | +--> Prefix index | +--> ASN index | +--> Geographic index | +--> Policy references | +--> Allocator overhead If one logical object eventually costs 512 bytes in memory, one million entries would require roughly: 1,000,000 x 512 bytes ≈ 488 MiB Five million such objects would require roughly: ≈ 2.38 GiB Those numbers are hypothetical examples, not measurements of a specific implementation. The point is that: File size != memory footprint Operators need to measure actual resident memory. Then Multiply It by Every Process Suppose one authoritative process consumes: 2 GiB of classification and policy data. If the architecture launches four separate worker processes and each maintains its own copy: Process 1 2 GiB Process 2 2 GiB Process 3 2 GiB Process 4 2 GiB ------ Approx. 8 GiB Implementation details matter. Some operating systems and application runtimes can share some memory under certain conditions. Others duplicate more of it. The important operational question is: Does adding DNS query workers also multiply the large routing dataset? If the answer is yes, query capacity and memory requirements become tightly coupled. That can become expensive very quickly. Startup Cost Grows Too An all-in-memory architecture normally needs to rebuild its state when the process starts. Conceptually: Process starts | v Read prefix data | v Read ASN data | v Read geographic data | v Read resolver classifications | v Read policies | v Build indexes | v Validate objects | v Ready for queries The larger the dataset becomes, the more work startup requires. Suppose a small deployment starts in: 2 seconds Later, the dataset becomes much larger. Startup becomes: 20 seconds Then: 60 seconds Then several minutes. The exact numbers depend on the implementation, but the direction is predictable. More objects require more reading, parsing, allocation, indexing, and validation. Startup time therefore becomes part of availability engineering. Cold Starts Become Dangerous Imagine an authoritative cluster with three nodes. One node restarts. Its memory is empty. It begins loading: All prefixes All ASN mappings All geo mappings All policies All resolver information During that period, two questions matter: Can the server answer DNS yet? How much CPU, disk I/O, and memory pressure does rebuilding create? Now imagine all three servers restart after: A power outage A package upgrade A configuration problem A host reboot A deployment A regional infrastructure event What was merely an inefficient startup path can become an availability issue. Reloads Can Be Worse Than Startup Policy data changes. Network data changes. Health data changes. Resolver classifications change. If the application treats every update as: Throw away everything | v Reload everything | v Rebuild everything then even a small change can have large cost. Consider one prefix change. Old: 198.51.100.0/24 -> Site A New: 198.51.100.0/24 -> Site B The actual policy change is tiny. But an inefficient system might do: 1 prefix changed | v Reload 5,000,000 objects The ratio between the change and the work becomes unreasonable. Update Cost Should Follow Change Size Where Practical An idealized relationship would look more like: Small change | v Small update cost Large change | v Larger update cost rather than: Any change | v Reload entire world Not every implementation can perform perfectly incremental updates. Sometimes rebuilding a complete immutable snapshot is simpler and safer. That can still be a good design. The important point is that snapshot size itself should remain reasonable and controlled. Historical Objects Are Particularly Easy to Accumulate Suppose policy updates happen throughout the day. Policy v101 Policy v102 Policy v103 Policy v104 Policy v105 You may need: Current policy You may also want: Previous policy for rollback. But does the authoritative query process need: Policy v1 Policy v2 Policy v3 ... Policy v105 all in memory? Probably not. Historical information may be useful for: Auditing Incident review Rollback Change history Compliance Debugging But historical storage and active query state are different responsibilities. A cleaner division is: POLICY HISTORY | v Durable storage | selected versions | v Runtime DNS state The query path needs enough information to answer current queries. It does not necessarily need the entire historical record. Not Every Prefix Needs a Runtime Object Suppose your steering policy contains special behavior for only a small set of networks. For example: 198.51.100.0/24 -> Site A 203.0.113.0/24 -> Site B Default -> Site C Why would the authoritative process necessarily need a policy object for every other Internet prefix? It may need a classification mechanism. But classification and policy are different things. Conceptually: Internet prefix | v Classification | v Does special policy exist? / \ yes no | | v v Special Default policy policy Only the prefixes with special behavior may need explicit policy objects. This can dramatically reduce active policy state. ASN Data Has Similar Risks ASN-aware steering can be useful. For example: Network A -> Site A Network B -> Site B Everything else -> Default An implementation might decide to load a complete Internet prefix-to-AS dataset into every DNS worker. That may work. But ask whether every query process truly needs the entire dataset. Possible designs include: Full local table or: Prepared compact index or: Only policy-relevant networks or: Bounded classification cache or combinations of these approaches. There is no universal answer. The important question is whether the chosen dataset size is justified by the routing policy. Geographic Data Creates the Same Pattern Geographic routing may need mappings such as: Prefix -> Country Prefix -> Region Prefix -> Location class Again, it is easy to decide: Load every geographic object available. But a particular steering policy may care only about: PH SG JP US DEFAULT There may be little value in keeping rich geographic metadata such as city names, postal codes, coordinates, and unrelated attributes if the policy only needs a country or region identifier. Prefer the smallest representation that supports the required decision. For example: Large object: prefix country region city postal_code latitude longitude timezone metadata ... versus: Routing object: prefix region_id The second representation contains much less information. If that is all the DNS query needs, the extra data produces cost without improving the decision. Data Shape Matters as Much as Data Quantity Two implementations may contain the same logical data but consume very different amounts of memory. Consider prefix information. Implementation A: Thousands of individual objects with strings, pointers, and metadata Implementation B: Compact search structure with integer identifiers Both may represent the same policy. The second can require much less memory. This leads to another rule: Do not confuse the source-data format with the runtime-data format. The management side may use rich records. The DNS query path may need only a compact projection. Project the Data You Actually Need Suppose a control system stores: Prefix ASN Organization Country Region City Latitude Longitude Source Created time Updated time Confidence Notes Historical owner Import batch The authoritative query process might only require: Prefix Policy ID Region ID A preparation stage can transform the larger dataset into a smaller runtime structure. Conceptually: RICH CONTROL DATA Prefix ASN Country Region Organization Metadata History Audit information | v Compile / prepare | v RUNTIME VIEW Prefix Region ID Policy ID This separation keeps administrative detail out of the query path. ECS Makes the Cardinality Problem More Important EDNS Client Subnet, defined by RFC 7871, allows network-prefix information associated with clients to participate in DNS resolution. This makes network-sensitive answers possible, but it also increases the number of network-specific states that resolvers or steering systems may need to consider. RFC 7871 specifically warns that network-specific answers can increase cache size and memory pressure. It recommends limiting the number of networks retained in caches. This matters because a naive design might do: New ECS prefix | v Create permanent object Then: Another ECS prefix | v Create another permanent object Eventually: Millions of observed prefixes | v Millions of retained objects ECS should be treated as a query signal. It does not mean every observed network must become permanent runtime state. Resolver Information Can Grow the Same Way Without ECS, authoritative DNS normally sees the recursive resolver making the query. Operators may want to classify resolvers. That can be useful. But consider: New resolver IP observed | v Create classification record | v Keep forever Internet-facing services can encounter many resolver addresses over time. If every address becomes permanent state, memory usage becomes traffic-controlled. A safer design might use: Known resolver dataset + Bounded temporary cache + Default behavior for unknown resolvers Article 12 covered why unknown classifications should have safe fallback behavior. That same fallback principle allows the system to remain useful without remembering every resolver forever. The Cost of Indexes Large datasets need efficient lookup structures. Suppose you load: 2 million prefixes You cannot reasonably scan all two million for every DNS query. The system needs an index. For prefix matching, this might conceptually resemble: 0.0.0.0/0 / \ / \ branch branch / \ ... ... For other data, the system might use: Hash tables Trees Tries Arrays Maps Other indexed structures Indexes make queries faster. But indexes consume additional memory. So the real cost becomes: Data + Index + Metadata + Runtime overhead A dataset that looks manageable in storage may become much larger when prepared for fast lookup. Large State Makes Validation More Expensive Routing policy should be validated before activation. Possible checks include: Invalid prefix? Duplicate rule? Unknown destination? Overlapping rule? Invalid weight? Missing default? Broken reference? If runtime policy contains millions of objects, validation can take more CPU and memory. A policy update may therefore become: Download | v Parse | v Allocate | v Index | v Validate | v Activate Each stage becomes more expensive as the dataset grows. This affects operational agility. A one-line policy correction should not require a dangerously heavy deployment process. Garbage Collection and Memory Reclamation Managed runtimes can introduce another concern. Suppose the current policy contains millions of objects. A new policy snapshot is built. For a period, memory might contain: Old policy + New policy Then the old policy is released. The runtime may need to reclaim millions of objects. Conceptually: Normal state 2 GiB During reload 2 GiB old + 2 GiB new = 4 GiB After activation Old objects waiting for reclamation Peak memory can matter more than normal memory. Operators should therefore measure: Steady-state memory Reload peak memory Post-reload memory Repeated reload behavior A system that fits comfortably during normal operation may run out of memory during a policy update. Memory Pressure Becomes Latency Pressure Memory problems are not limited to out-of-memory crashes. Before a process runs completely out of RAM, the host may experience: Allocator pressure Page reclaim Cache eviction Swapping Higher CPU consumption Longer pauses Disk activity If the host starts swapping heavily, DNS response times can suffer. The DNS process may still technically be running. But query performance becomes unpredictable. For infrastructure such as authoritative DNS, predictability matters as much as average speed. Memory Headroom Matters Suppose a server has: 8 GiB RAM and the DNS process normally uses: 7.5 GiB It technically fits. That does not mean the design is safe. The operating system also needs memory. Other processes need memory. Updates may temporarily create duplicate data. Traffic bursts may increase query-local allocations. Logs and monitoring need buffers. A better capacity question is: How much memory remains available under the worst normal operating condition? Do not design only for the steady-state average. Practical Example Consider an authoritative DNS service for: api.example.com It selects among: Site A 192.0.2.20 Site B 198.51.100.20 Site C 203.0.113.20 The organization has a large network-information repository. Imagine it contains: 2,000,000 prefix objects 100,000 resolver objects 50,000 policy objects 500,000 historical policy objects Various geographic metadata Various ASN metadata These are hypothetical numbers for illustration. A naive authoritative service might do: STARTUP | v Load 2,000,000 prefixes | v Load 100,000 resolvers | v Load 50,000 active policies | v Load 500,000 historical objects | v Build all indexes | v Serve DNS But perhaps the active routing configuration actually uses: 10,000 policy-relevant prefixes 2,000 resolver classifications 3 active destinations 1 current policy generation 1 previous generation Compact region identifiers A more focused runtime representation might be: CONTROL DATA Large network dataset | v Prepare | v Select relevant fields | v Build compact state | v DNS RUNTIME +---------------------------+ | Active policies | | Relevant prefix index | | Bounded resolver cache | | Current health | | Compact classifications | +---------------------------+ | v DNS Query The larger dataset still exists. It simply does not all need to exist inside every query worker. Precompute What Can Be Precomputed Suppose several database tables must be combined to determine: Prefix | v ASN | v Region | v Policy | v Destination Doing all of that per query could be expensive. One response is to load the entire database into the DNS process. Another option is to prepare a smaller runtime representation. CONTROL SIDE Prefix data + ASN data + Geo data + Policy data | v Precompute relevant mapping | v Compact runtime structure Then: QUERY SIDE DNS query | v Compact lookup | v Health filter | v Answer This keeps the query path fast without requiring it to become the storage layer for the entire source dataset. Separate Control Data From Serving Data This distinction is useful: Control Data Rich information used to create and manage policy. Examples: Historical policies Audit information Import metadata Detailed geography Network ownership Administrative comments Change history Source information Serving Data Information needed to answer the next DNS query. Examples: Active routing rules Relevant prefix index Current health Destination IDs Current classifications Safe defaults Conceptually: CONTROL PLANE DATA | v Prepare / validate | v SERVING SNAPSHOT | v AUTHORITATIVE DNS | v DNS RESPONSE This separation can make memory and update behavior much easier to reason about. Full Snapshots Can Still Be Useful This article is not arguing that every system must fetch data lazily. That can create different problems. For example: DNS query | v Need ASN | v Database query | v Need country | v Another database query | v Need policy | v Another database query Putting slow storage directly in the DNS query path can create latency and availability dependencies. A prepared in-memory snapshot can be an excellent design. The key difference is: Prepared bounded serving dataset versus: Blind copy of everything available Those are not the same thing. The Other Extreme Is Also Dangerous Do not react to memory problems by removing useful local state entirely. Suppose every query requires: External database External ASN service External geo service Policy API Health API Now DNS availability depends on all of them. DNS Query | +--> Database | +--> Network service | +--> Policy API | +--> Health service | v DNS Answer If one dependency becomes slow, authoritative DNS becomes slow. The goal is balance. BAD Load absolutely everything | v Huge runtime state BETTER Prepared bounded local state | v Fast DNS path BAD Fetch everything per query | v Dependency-heavy path The middle approach often provides the best operational properties. Ask: Does This Object Affect an Answer? For every runtime object, ask: Can this object affect a DNS answer currently being served? If the answer is no, ask why it needs to be inside the authoritative process. For example: Object Needed in Query Process? Current health Usually yes Active routing policy Yes Relevant prefix index Often yes Current destination metadata Yes Previous policy Possibly Policy from six months ago Usually no Audit comments Usually no Import batch metadata Usually no Raw source file Usually no Detailed historical statistics Usually no The exact answer depends on the system. The question itself is valuable. Design Risks 1. Memory Usage Grows With the Source Dataset If every new Internet prefix automatically increases DNS worker memory, external dataset growth becomes an infrastructure capacity issue. Make that relationship intentional, not accidental. 2. Historical Data Leaks Into Runtime Historical records are useful. They usually belong in persistent storage, not permanently inside the DNS serving process. 3. Every Worker Holds the Same Large Dataset Check whether adding workers duplicates memory. Do not assume additional query processes are cheap. 4. Reload Requires Double Memory If a new snapshot is prepared alongside the old one, peak memory can approach twice the normal policy footprint. Measure it. 5. Startup Depends on Huge Imports Large initialization jobs increase restart time and cold-start risk. Know how long a DNS node takes to become ready from an empty process. 6. Small Updates Trigger Full Rebuilds Sometimes complete snapshot replacement is appropriate. But if tiny changes repeatedly require huge rebuilds, update cost deserves attention. 7. Rich Objects Enter the Hot Path The DNS service may need: region_id = 3 It probably does not need an entire geographic database record with dozens of fields to make that decision. Keep runtime representations focused. 8. Duplicate Indexes Consume More RAM Than Expected The same object may appear in several search structures. Measure real memory rather than estimating only from source-file size. 9. Memory Limits Are Discovered by OOM Do not wait for the kernel or container runtime to teach you the maximum safe dataset size. Test it intentionally. 10. Memory Problems Are Solved Only by Adding RAM More RAM can provide needed capacity. But hardware does not fix unbounded growth. If state can grow indefinitely: 16 GiB eventually becomes: 32 GiB then: 64 GiB The underlying design remains unchanged. Operator Rules Rule 1: Inventory What Lives in Memory Document major runtime structures. For example: Active policy Previous policy Prefix index ASN mappings Region mappings Resolver classifications Health state Counters Caches Know why each exists. Rule 2: Separate Source Data From Serving Data Do not automatically load a source record simply because it exists. Ask what fields the query process actually requires. Rule 3: Keep Historical Data Out of the Hot Path Use durable storage for: Audit history Old policies Old health records Previous imports Detailed historical telemetry Load historical information only when operationally needed. Rule 4: Measure Actual Memory Per Object Source file size is not enough. Measure the live process. On Linux: ps -o pid,rss,vsz,%mem,%cpu,cmd -p <PID> You can also inspect: grep -E 'VmRSS|VmSize|VmPeak' /proc/<PID>/status Pay particular attention to: VmRSS VmPeak during policy reloads. Rule 5: Measure Peak Memory, Not Only Normal Memory Record memory during: Startup Normal traffic Maximum cache occupancy Policy rebuild Policy activation Repeated reloads High query concurrency The peak may be much larger than the normal value. Rule 6: Know Startup Time Measure: Process launched | v Ready to answer production DNS If startup time increases steadily as datasets grow, treat it as a capacity metric. Rule 7: Bound Runtime Caches If resolver, prefix, or classification information is learned from traffic, define: Maximum entries Lifetime Eviction behavior Article 13 discussed why these bounds are essential. Rule 8: Keep Policy Versions Under Control A reasonable conceptual model might be: Current policy Previous policy Policy being prepared rather than: Every policy ever published Keep full history elsewhere. Rule 9: Reduce Runtime Objects to What the Query Needs Instead of: Full geographic record consider whether the query needs only: region_id Instead of: Full organization object perhaps it needs: asn_id Small representations add up when repeated many times. Rule 10: Test Dataset Growth Do not test only today’s data. Try: Current dataset 2x current dataset Expected future dataset Maximum supported dataset Observe: Memory Startup time Reload time CPU Query latency Peak memory Rule 11: Test Repeated Updates One successful policy reload proves little. Test: Reload Reload Reload Reload Watch whether memory returns to a stable level. If each update leaves additional memory behind, investigate. Rule 12: Protect DNS From Control-Plane Problems A problem in: Policy history Import process Classification update Analytics Administrative UI should not unnecessarily take down authoritative DNS. The serving path should depend on a controlled runtime representation. Practical Memory Test Suppose a DNS process has PID 12345. Check current memory: ps -o pid,rss,vsz,%mem,%cpu,cmd -p 12345 Then inspect the kernel’s process memory counters: grep -E 'VmRSS|VmSize|VmPeak' /proc/12345/status Take readings: Before policy load After policy load During traffic During reload After reload After several reloads A simple test table can be useful: Test RSS Peak Startup Time Reload Time Empty/minimal policy Current production data 2x policy data Cache full During reload After 10 reloads This converts a design assumption into measurable behavior. Watch the Shape of Memory Over Time A healthy bounded runtime often looks conceptually like: Memory ^ | 8 | _________ 7 | ____/ 6 | ____/ 5 | ____/ 4 |____/ | +----------------------------> Time Eventually reaches a working plateau An unbounded design can look like: Memory ^ | / | / | / | / | / | / | / |____/ +----------------------------> Time Continues growing with new inputs The second pattern deserves investigation. Do Not Confuse Caching With Hoarding Caching has a purpose. It avoids repeating expensive work. A good cache has: Purpose Maximum size Expiration Eviction Metrics Hoarding looks like: Saw this once | v Keep forever For DNS steering: Useful repeated data | v Bounded cache Historical or rarely used data | v Persistent storage or reloadable source The distinction keeps runtime state manageable. DNS Itself Gives Us the Right Mental Model DNS is fundamentally distributed. RFC 1034 says that the size and update frequency of DNS data motivated a distributed design with caching, and warns that collecting a consistent copy of the entire database becomes increasingly expensive. That principle maps well to steering systems. Instead of: Every authoritative server | v Complete Internet-sized dataset think: Source datasets | v Control / preparation layer | v Relevant serving state | v Authoritative DNS The authoritative process should be a fast decision engine. It does not need to become the archive, analytics platform, configuration database, historical store, and Internet intelligence repository at the same time. What DNS Can Influence A DNS steering system can influence: Which address is returned. Which eligible destination is selected. How prefix policies affect answers. How ASN policies affect answers. How geographic classifications affect answers. Whether unhealthy destinations remain eligible. How future DNS resolutions are distributed. Information in memory helps the server make these decisions quickly. What DNS Cannot Fully Control Loading more Internet information into memory does not give DNS control over everything that happens afterward. DNS cannot fully control: BGP route selection. Client physical location. Whether a recursive resolver provides ECS. Resolver caching behavior. Existing TCP connections. HTTP connection reuse. Application session placement. Packet loss. Congestion. Exact traffic distribution. RFC 8767 also defines conditions where recursive resolvers can serve stale cached data when fresh resolution fails, another reminder that an authoritative update does not instantly replace every cached answer. HTTP behavior occurs above DNS at the application layer. RFC 9110 defines HTTP semantics independently of DNS routing decisions. TCP maintains connection state separately. RFC 9293 defines TCP operation, so changing a DNS answer does not move an already established TCP connection to another server. More memory does not change these boundaries. Common Mistakes Mistake 1: “RAM Is Fast, So Put Everything There” RAM is fast. That does not mean every available object belongs in every DNS worker. Memory capacity, startup, updates, indexes, and recovery still have costs. Mistake 2: “The Dataset Fits Today” Today’s dataset is only one point in time. Ask: Will it fit next year? What about during reload? What about four worker processes? What about maximum cache occupancy? Mistake 3: “The File Is Only 500 MB” The in-memory representation may be much larger than the source file. Measure the process. Mistake 4: “Historical Objects Are Cheap” One historical object may be cheap. Hundreds of thousands may not be. History belongs in a system designed for history. Mistake 5: “Every Prefix Might Be Useful Someday” That is not enough reason to keep every prefix in the active serving state. Load or prepare what current policy requires. Mistake 6: “More Detailed Geo Data Means Better Steering” If the routing decision uses only country or region, city-level metadata may provide no additional routing value. Store the detail where it is useful, not automatically in the DNS process. Mistake 7: “One Copy Fits, So Four Workers Will Fit” Check whether workers share or duplicate the large structures. Do not assume. Mistake 8: “A Reload Uses the Same Memory as Normal Operation” Many designs temporarily hold both the old and new state. Peak memory can therefore be much larger. Measure it. Mistake 9: “The Fix Is More RAM” More RAM may be the correct capacity decision. But it should support a controlled architecture. It should not be the only defense against unbounded state. Mistake 10: “Fetch Everything From a Database Instead” That creates the opposite problem if every DNS query becomes dependent on remote storage. The goal is a compact, prepared, local serving state. Key Takeaways The problem is not using memory. The problem is treating memory as the permanent home for every object the organization knows about. Think about runtime information in three groups: ALL AVAILABLE DATA | +-----------+-----------+ | | v v Needed to answer Not needed to current queries answer queries | | v v Serving state Control/history storage A good DNS runtime should focus on the first group. Remember these rules: Do not load data simply because it exists. Separate rich control data from compact serving data. Keep historical policy outside the authoritative hot path. Measure actual memory, not source-file size. Measure peak memory during updates. Know whether worker processes duplicate data. Keep traffic-created caches bounded. Use compact runtime representations where practical. Test cold starts and repeated reloads. Do not replace an oversized in-memory design with slow remote calls on every query. Prepare the information DNS needs before the query arrives. The goal can be summarized like this: BAD Every available object | v DNS process memory | v DNS queries BETTER Rich source datasets | v Prepare and validate | v Compact serving state | v DNS query engine | v DNS response Fast DNS does not require loading the whole Internet into memory. It requires keeping the right information close to the query path. A steering engine should remain fast when datasets grow. It should restart predictably. It should reload policies without consuming unexpected amounts of memory. It should recover without rebuilding the entire history of the Internet. And operators should be able to explain why every major runtime object exists. That is the difference between simply making DNS steering work and engineering it for predictable operation. Sources RFC 1034: Domain Names, Concepts and Facilities Defines the foundational DNS architecture. Of particular relevance to this article, RFC 1034 explains why DNS distributes its database and warns about the increasing cost and difficulty of collecting a consistent copy of the complete database. RFC 1034, RFC Editor RFC 1035: Domain Names, Implementation and Specification Defines DNS implementation details, message formats, queries, responses, and resource records. RFC 1035, RFC Editor RFC 6891: Extension Mechanisms for DNS, EDNS(0) Defines EDNS, the extension framework used by mechanisms such as EDNS Client Subnet. RFC 6891, RFC Editor RFC 7871: Client Subnet in DNS Queries Defines EDNS Client Subnet. It also discusses increased cache size, memory pressure, and the need to limit network-specific cache entries. RFC 7871, RFC Editor RFC 8767: Serving Stale Data to Improve DNS Resiliency Defines resolver behavior for returning stale cached data under specified failure conditions. RFC 8767, RFC Editor RFC 2308: Negative Caching of DNS Queries Defines DNS negative caching for responses such as NXDOMAIN and NODATA. RFC 2308, RFC Editor RFC 9110: HTTP Semantics Defines HTTP semantics and helps distinguish authoritative DNS decisions from later application-layer behavior. RFC 9110, IETF Datatracker RFC 9293: Transmission Control Protocol, TCP Defines TCP behavior and connection state, reinforcing why an authoritative DNS change cannot directly relocate an established TCP connection. RFC 9293, RFC Editor