Skip to content
ENExplore Calculators

DNS Cache Calculator

Size a resolver cache and predict its hit ratio from query rate, unique names and record TTL.

About DNS Cache Calculator

Each distinct name has to be fetched from upstream once per TTL, so the miss rate is the working-set size divided by the TTL — independent of how often clients ask. Everything else is served from cache, and memory follows from the number of entries held. Cache sizing decides both resolver memory and upstream load: shortening TTLs from 300 to 30 seconds multiplies authoritative query volume tenfold without changing client behaviour at all.

Formulas

DNS Cache

cached entries = min(unique names, query rate × TTL); misses per second = unique names ÷ TTL.

unique names
Distinct records queried in the working set
TTL
Average record lifetime in seconds
misses per second
Each name must be re-resolved once per TTL

Cache hit ratio

hit ratio = 1 − misses per second ÷ query rate

query rate
Total client queries per second

Worked example

With the default values below, DNS Cache Calculator returns Cache Memory Required of 4 MiB. Change any input above and every figure here is recalculated in your browser.

Inputs used

Query rateminimum 0.1 queries/s
5,000 queries/s
Distinct names in the working setminimum 1 names
20,000 names
Average record TTLminimum 1 s
300 s
Memory per cache entryminimum 32 bytes
220 bytes

Results

Cache Memory Required
4 MiB
Cached Entries
20,000
Cache Hit Ratio
98.67%
Upstream Query Rate
66.7 queries/s
Cache Memory Required
4.20 MB

Step by step

  1. 1Values used
  2. 2DNS Cache
  3. 3Cache hit ratio
  4. 4Cache Memory Required= 4,400,000
  5. 5Cached Entries= 20,000
  6. 6Cache Hit Ratio= 98.67
  7. 7Upstream Query Rate= 66.7 queries/s
  8. 8Cache Memory Required= 4.20 MB

Assumptions and limits

  • The result is derived only from the 4 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 2 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 is DNS Cache calculated?

cached entries = min(unique names, query rate × TTL); misses per second = unique names ÷ TTL. Each distinct name has to be fetched from upstream once per TTL, so the miss rate is the working-set size divided by the TTL — independent of how often clients ask. Everything else is served from cache, and memory follows from the number of entries held.

Why does DNS Cache matter?

Cache sizing decides both resolver memory and upstream load: shortening TTLs from 300 to 30 seconds multiplies authoritative query volume tenfold without changing client behaviour at all.

What values do I need to enter?

This calculator takes 4 inputs: Query rate, Distinct names in the working set, Average record TTL, Memory per cache entry. The pre-filled defaults are a realistic starting point — replace them with figures from your own environment for a result you can act on.

DNS Cache Calculator – Calculate Cache Memory Required