Bloom Filters: The Cheap Gate Before the Expensive Question
A Bloom filter is a small bit array plus a few hash functions that answers "has this been seen?" with no false negatives and a false-positive rate you choose up front.
MediumRaphael MontaudProblem & solution
Medium’s Daily Digest filtering had become costly and difficult to maintain after a single Bloom Filter instance accumulated billions of items for read, muted, and presentation rules. The system could face up to 15,000 filter questions per feed and more than 15 million per second across thousands of feeds, while Bloom Filters could not delete or enumerate entries and introduced derived-data drift. The team replaced the muted-writer filter with a user-based database query that fetched all muted writers for the current user and cross-referenced them with the story shortlist, then split read filtering between early user-based queries and later pairwise lookups. The resulting implementation removed Bloom Filters entirely, was reported as ten times cheaper in their situation, made costs independent of shortlist size, supported reading-history clearing, and was easier to control and debug.
Medium’s recommendation filtering used a single, ever-growing Bloom Filter instance for read, muted, and presentation rules. The filter accumulated billions of items, could not delete or enumerate entries, made changes such as unmuting difficult, and required derived data to be synchronized with the source database. Filtering also involved up to 15,000 questions for one feed and more than 15 million questions per second across thousands of feeds.
The team replaced Bloom Filter-based filtering with user-based database queries. For muted writers, it fetched all muted writers for the current user and cross-referenced them with the story shortlist. It split read filtering into early user-based queries and later pairwise user-post lookups, using each at a different stage of recommendation generation.
Bloom Filters supported fast membership checks but could not list or delete entries, so an unmuted writer could remain effectively muted and stored data could drift from the source database.
For most users, querying all muted writers from DynamoDB retrieved fewer than one item per feed on average; users who muted thousands of writers could still be handled in real time, with higher latency.
The new implementation removed Bloom Filters entirely and was reported as ten times cheaper in this situation, while making filtering costs independent of the initial shortlist size and enabling reading-history clearing.
Summaries are generated from the original by a language model. Check the original before relying on it.
See the idea
A Bloom filter is a small bit array plus a few hash functions that answers "has this been seen?" with no false negatives and a false-positive rate you choose up front.
Keep reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
One useful email. Unsubscribe anytime.