Bloom Filters

Bloom Filters

May 18, 2026

Every time you visit a webpage, Chrome quietly runs a check — is this URL malicious?
It doesn't call a server. It doesn't scan a massive database. It uses a Bloom filter. And it gets an answer in microseconds. That's the magic of this data structure. Small. Fast. Brilliant. So what exactly is a Bloom filter?

It's a probabilistic data structure — a fancy way of saying it trades a small chance of being wrong for massive gains in speed and memory. Here's how it works: you have a bit array (just a row of 0s and 1s) and a few hash functions. When you add an item, the hash functions each point to a position in the array and flip those bits to 1. When you query for an item, you check those same positions. All 1s? Probably in the set. Even one 0? Definitely not in the set.

That "definitely not" is the superpower. Why does that matter? Imagine you're Cassandra or HBase, and someone queries for a key that doesn't exist. Without a Bloom filter, you'd do a full disk read — expensive, slow. With one, you check in memory first. If it says "definitely not here," you skip the disk entirely. Gone. Saved.

Medium uses Bloom filters to avoid recommending articles you've already read. Akamai uses them to decide whether a URL is worth caching. Redis has them built in. One data structure, sitting quietly behind some of the biggest systems in the world.
The honest trade-off: Bloom filters can give false positives — they might say "probably yes" when the answer is actually no. But they never give false negatives. If it says no, trust it completely. And the memory savings? For 1 million items, a HashSet needs ~100MB. A Bloom filter? Around 1MB. Same job. 100x less memory. When should you actually use one?

When you need to check membership at scale, can tolerate rare false positives, and can't afford the cost of always hitting disk or a remote database. Spell checkers, fraud detection, network routers, CDN caches — the use cases are everywhere once you start looking.

It's not a replacement for a database. It's the bouncer at the door that turns away the obvious misses before they waste anyone's time. One bit array. A few hash functions. Millions of expensive lookups saved every second. Not bad for a 1970 invention.

#SystemDesign #BloomFilter #DataStructures #SoftwareEngineering #BackendDevelopment #DistributedSystems #DatabaseOptimization #WebPerformance #Programming #TechLeadership #ComputerScience #SoftwareArchitecture

Share this article:

© 2026 Mehraj Hosen. All rights reserved.