Sizing and rotating Bloom filters
medium 4 minChoose bit capacity and number of hashes based on expected insertions and the cost of false positives.
Video lesson · Chapter 1 of 5
An empty filter is deceptively accurate
What does a 1% false-positive rate cost?
1:14Reel
Theory
Read or listen first. About 1 min.
What it is
A false-positive rate becomes an operational cost once you know how many absent keys the system probes. Multiply that volume by the rate to estimate avoidable lookups.
How many unnecessary reads reach disk?
Why it exists
A small percentage can dominate disk traffic at high volume. Size the filter against the expected item count and the price of each unnecessary read.
Words to know
- Negative probe
- A lookup for a key that is absent from the underlying set.
How it works
Step through the idea, or press Play.
Choose a budget. One million absent probes reach the filter.
Understand it
Worked example
Sizing and rotating Bloom filters in practice
For one million negative probes, a 1% false-positive rate sends about 10,000 unnecessary reads to the backing store. Compare that cost with the memory needed for a tighter target.
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.