v.recipes
DNS/Illustrations/Cache Efficiency

Cache Efficiency

How v.recipes uses a three-layer caching strategy — local data center, global across data centers, and upstream — to answer DNS queries with minimal latency.

Multi-Layer Cache Architecture
Client DNS Query
Request
L1
Data Center Cache
MISS
L2
Global Cache
MISS
L3
Upstream
Store + Reply
FILL
Store + Reply
RESPONSE
Resolve
Response
Response Delivered

Cache Lookup Scenarios

L1 Cache Hit

Fastest

The data center handling the request has a fresh cache entry for this domain. The response is returned immediately.

1Client sends DNS query to v.recipes, routed to the nearest data center.
2L1 (data center) cache has a fresh entry for this domain.
3Response returned directly from the local data center — fastest possible path.
4No L2 lookup, no upstream query.

L2 Cache Hit

Fast

The local data center did not have the answer, but another Cloudflare data center globally did. The response is fetched from there.

1Client sends DNS query to v.recipes.
2L1 cache miss — no entry in the receiving data center.
3L2 (global) cache is checked across other Cloudflare data centers worldwide.
4A data center elsewhere has the entry cached; response is retrieved.
5Result is written back to L1 so subsequent queries in this data center hit immediately.
6Response returned to client.

Full Cache Miss

Upstream

Neither L1 nor L2 has the answer. The query is forwarded to the upstream resolver, and the result is seeded into both cache layers.

1Client sends DNS query to v.recipes.
2L1 cache miss — no entry in the receiving data center.
3L2 cache miss — no entry in any data center globally.
4Query forwarded to the upstream resolver (e.g., Cloudflare 1.1.1.1).
5Upstream responds. Result is stored in L2 (global) for other data centers and L1 (local) for this data center.
6Response returned to client. Subsequent queries hit cache.

Typical Cache Performance

>90%
Overall Hit Rate
<1ms
L1 Hit Latency
<5ms
L2 Hit Latency

Because most DNS queries are for popular domains (search engines, CDNs, social media), the vast majority of requests are served from the L1 or L2 cache without touching the upstream resolver. Even when a user's request lands in a data center with a cold L1, it is often served by another data center via L2. This keeps latency low across the globe and reduces unnecessary load on upstream providers.

Key Concepts

L1 Cache (Data Center)

Cache local to each data center, scoped to the Cloudflare data center that received the request. When a query arrives, its response is cached locally so subsequent requests from the same PoP are served immediately from the local cache — the fastest path.

L2 Cache (Global)

If the receiving data center does not have a cached entry, the query checks whether any other Cloudflare data center worldwide has it cached. This vastly reduces the number of queries that need to reach the upstream resolver.

L3 Cache (Upstream)

When both L1 and L2 miss, the query is forwarded to the configured upstream provider (e.g., Cloudflare 1.1.1.1 or Google DNS), which may itself have the result cached. This is the slowest path but ensures every query eventually receives an answer. On return, the response is seeded into L2 and L1.

Cache Cascade

When L2 serves a hit, the result is written back to L1 so the receiving data center has it locally for the next request. When L3 responds, the result populates both L2 and L1. This cascading fill keeps the hottest data at the closest layer over time.