Skip to content
ENExplore Calculators

DNS Cache Size Calculator

Calculate DNS resolver cache size needed to serve a given query rate and TTL distribution.

About DNS Cache Size Calculator

A DNS resolver cache (systemd-resolved, nscd, dnsmasq, or an application-level cache) reaches a steady-state entry count determined by how many unique queries arrive per second multiplied by how long each answer stays valid — a query rate of 40/sec with a 300-second average TTL settles around 12,000 cached entries, since older entries expire at roughly the same rate new unique queries arrive. Each cached record consumes a modest but nonzero amount of memory for the name, record type, TTL countdown, and answer data, which this calculator totals for basic capacity planning.

Formula

Steady-state cache entries

entries = queries_per_sec × avg_TTL

q
unique queries per second
TTL_{avg}
average record TTL in seconds

Worked example

With the default values below, DNS Cache Size Calculator returns Estimated Steady-State Cache Entries of 12,000. Change any input above and every figure here is recalculated in your browser.

Inputs used

Unique DNS Queries per Secondminimum 0
40
Average Record TTL (seconds)minimum 1
300
Memory per Cache Entry (bytes)minimum 1
200

Results

Estimated Steady-State Cache Entries
12,000
Estimated Cache Memory (KB)
2,343.75
Estimated Cache Memory (MB)
2.2888

Step by step

  1. 1Values used
  2. 2Steady-state cache entries
  3. 3Estimated Steady-State Cache Entries= 12,000
  4. 4Estimated Cache Memory (KB)= 2,343.75
  5. 5Estimated Cache Memory (MB)= 2.2888

Assumptions and limits

  • The result is derived only from the 3 inputs listed above. Anything not among them is not part of the calculation.
  • In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
  • Figures are rounded for display to 4 decimal places, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.

How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.

Frequently Asked Questions

How do I check systemd-resolved's current DNS cache statistics?

`resolvectl statistics` shows cache hits, misses, and current cache size for systemd-resolved; `sudo systemd-resolve --statistics` is the equivalent on older systemd versions.

Why does average TTL matter more than raw query volume for cache sizing?

A high query rate with very short TTLs (e.g. some cloud load balancer DNS records use 5-60 second TTLs) can still result in a small steady-state cache, since entries expire almost as fast as they're added — it's the product of rate and duration, not rate alone, that determines how many entries coexist at once.

Does a larger DNS cache always reduce query latency?

Only up to the point where the cache actually holds the records being requested — for workloads querying a huge number of distinct, rarely-repeated names (low cache hit rate), increasing cache size has diminishing returns, and the bottleneck is upstream resolution latency rather than cache capacity.

DNS Cache Size Calculator | Calcrivo