Finding frequent endpoints with a sketch
medium 4 minUse a frequency sketch alongside a candidate-key list when the task is to name busy endpoints.
Video lesson · Chapter 1 of 5
An operator knows checkout is busy
The sketch crossed 1,000. Should we throttle?
1:12Reel
Theory
Read or listen first. About 1 min.
What it is
A frequency sketch answers questions about keys you supply. To find busy endpoints, keep candidate names alongside it and check their estimates against the alert threshold.
Is the endpoint over the alert threshold?
Why it exists
An estimate near a cutoff can change an operational decision. Verifying the same key and time window against exact data avoids rate-limiting the wrong endpoint.
Words to know
- Candidate key
- An identity retained so that a frequency estimator can be queried for that specific item.
How it works
Step through the idea, or press Play.
Track a candidate. Keep its endpoint name alongside the sketch.
Understand it
Worked example
Finding frequent endpoints with a sketch in practice
An endpoint threshold is 1,000 requests. A sketch estimate of 1,020 is enough to flag an endpoint for verification. Before enforcing a costly action, check an exact counter or a bounded event sample.
Related case
Three questions for a tiny memory budget
A telemetry service needs to skip pointless disk reads, estimate traffic for a known endpoint, and count unique devices across regions. Each question allows a different error.
Estimate the union of observed identities.