retrystorm · Learn · Interview practice · Glossary · Components

Home › Reference › Components › Edge functions

Edge functions

Code that runs at an edge POP close to users on every request, with a cache of its own at each edge. Reads it has cached are answered at the edge; misses and writes travel to the origin. Unlike a CDN, it sees every request: connect a stream and it sends a click event for every read it answers, without the user waiting for it.

Settings

Edge tier
Sizes each regional edge cache. A bigger tier holds more distinct items per region before the least recently used ones are evicted, so the hit rate rises for large catalogues.
TTL (ms)
How long the function keeps a cached copy before it fetches it from the origin again. Longer means more hits and a faster, cheaper origin, but users may see stale data for longer.
On write
What happens to the cached copy when a write passes through. Purge drops it at once (other regions after the purge delay). TTL only keeps serving it until it expires, which is faster but staler.
Capacity (entries)
Maximum number of items each regional edge holds; the least recently used one is evicted when full. Overrides the tier's size. Lower means more evictions and misses on large datasets.
Edge latency
Time to answer a request from the edge cache on a hit, before the function's own run time. Pick a shape: constant, lognormal, exponential or uniform.
Run time
How long the function runs on each request, hit or miss. Pick a shape: constant, lognormal, exponential or uniform. Raising it slows every request a little.
Origin backbone factor
How much of the extra distance to the origin is paid on a miss, from 0 to 1. Lower models a fast private backbone (misses cost less); 1 means the full public internet round trip.
Origin overhead
Extra time the edge adds to every cache miss before the origin sees it. Pick a shape: constant, lognormal, exponential or uniform. Raising it makes misses slower; hits are unaffected.
Purge delay to other regions
How long a write's purge takes to reach the other regions' edges. Until then they keep serving the old copy, so longer means more stale reads elsewhere. Shapes: constant, lognormal, exponential, uniform.
Crashes
Scheduled outages of the edge functions. While they are down, requests through them fail, and their caches are emptied so they restart cold with every request a miss.
AI system design mock interview · About · Contact · Privacy · Terms of use