Deduplication code that survives a load test at 50,000 events a day can start returning false negatives once traffic reaches 10 million. The algorithm has not changed. What changed is the cost of a key lookup, now a throughput problem rather than a constant-time detail. Ten million events a day works out to about 700 per minute at sustained load, with bursts during pipeline execution windows running three to five times that average. The question moves from whether the logic deduplicates correctly to how quickly a key can be checked, and what the system does when that check lags the inbound rate.
Below, what shifts architecturally at high volume, what stays fixed, and where the usual failures sit when deduplication scales without a second look at implementation.
The Job the Key Store Performs
Three operations define a deduplication key store: write a key as a new event arrives, check that key when a later event carries the same payload, and expire keys once the deduplication window closes. At low volume each is trivial. At high volume the store's write throughput and read latency decide whether deduplication stays correct or becomes its own source of billing errors.
A Redis sorted set with TTL expiry holds up at moderate volumes. Each key is a string entry, scored by arrival timestamp. ZADD writes it, ZSCORE tests whether it exists, and ZREMRANGEBYSCORE clears expired entries on a schedule. Cost is O(log N), N being the keys inside the window.
At 10 million events per day and a 72-hour window, peak storage reaches 30 million keys. A ZSCORE against a 30-million-entry sorted set remains fast in absolute terms, yet under concurrent ingest from many workers it turns into a coordination point. The single Redis instance that carried the first million events per day cannot carry 10 million.
Sharding by Customer
Split deduplication keys by customer_id and the pressure eases. Each customer's events land in a dedicated shard holding only that customer's recent history. With 200 active customers across 10 million daily events, most shards hold tens of thousands of keys instead of millions, and ZSCORE on a small sorted set is effectively O(1) in practice.
There is an operational bonus. When one customer's deduplication starts behaving oddly—elevated duplicate detection, false negatives—their shard can be inspected alone. A single sorted set with 80,000 entries can be reasoned about. A shared set with 30 million cannot.
The price is operational complexity. Multiple Redis instances or a Redis Cluster now need managing, key expiry and memory budgeting have to follow the per-shard distribution, and customers producing outsized event volumes need their shards sized differently from everyone else's. That work is tractable; it also has to be planned before it is needed, not after duplicate billing incidents surface.
A Bloom Filter in Front
A probabilistic pre-filter can take most of the read load off the authoritative store. Before touching Redis, check a per-customer Bloom filter. A result of "definitely not seen" skips the Redis check and the event is recorded. "Possibly seen" falls through to Redis for a definitive answer.
Bloom filters trade a configurable false positive rate for space. At 0.1 percent, a filter covering 500,000 recent keys occupies roughly 900 KB. In billing deduplication, a false positive means a genuinely new event gets sent on for Redis verification; it never means a novel event is thrown away. False negatives do not occur, so correctness holds. For the roughly 99.9 percent of events that are new, the filter removes a Redis read—about 9.99 million fewer reads per day at 10 million events, given a typical duplicate rate.
Above a certain volume the optimization pays. Below a few million events per day Redis absorbs the full load and the extra layer buys nothing. Putting a Bloom filter in early, at moderate volume, is over-engineering. Leaving it out past a certain throughput threshold is a performance mistake.
Keeping the Window Bounded
A 72-hour window at 10 million events per day holds about 30 million key entries at any moment: 10 million written daily, 10 million expiring daily. Expiry has to run on a schedule that keeps the window the right size without triggering a deletion stampede.
Running ZREMRANGEBYSCORE across the whole sorted set from a scheduled job is the obvious approach and the worse one. At 30 million entries it blocks reads and writes on the same instance for the duration. Continuous micro-expiry works better: every ingest worker that checks the key store also removes a small batch of expired keys as a side effect. No batch job is required, and deletions spread evenly across the ingest pattern.
Sharded stores run micro-expiry per shard, independently. Aggregate deletion throughput matches insertion throughput, so total key count stays bounded. The implementation cost is a few lines in each worker's key-store interaction; the payoff is dropping a scheduled maintenance step that causes latency spikes once the store is large.
Where Approximate Counting Fits
Some billing systems tolerate an error below one in ten thousand. For those, probabilistic structures can stand in for the exact key store. HyperLogLog estimates cardinality with typical error under 0.8 percent, frequently inside the rounding tolerance of rate-based pricing.
Fit depends on what the billing unit is and how the variance aligns with the rate tiers. Billing $0.0001 per event puts 0.8 percent error on 1 million events at $0.80 of monthly variance—acceptable or not, given your minimum charge and rounding. Where the event stands for a specific financial transaction rather than a unit of consumption, or where customers reconcile against their own event logs, approximation is the wrong tool.
At Paygentic, approximate counting runs beside exact deduplication as a monitoring layer, not a replacement. HyperLogLog cardinality gives a fast early signal that duplicate injection has gone anomalous; the exact key store still confirms it. Billing reads from the exact path. The monitoring path exists for detection speed.
What Scale Does Not Change
Each idempotency key still has to be checked against one authoritative record for the length of its window. Layers can be stacked—Bloom filter, sharding, approximate monitoring—but the exact lookup inside the window cannot be dropped. A system that skips the authoritative check under load to gain throughput has stopped deduplicating in any meaningful sense. It accepts duplicates while busy, and busy is when duplicates cluster.
Key generation stays the client's obligation. Stable keys must survive retries. A fresh key minted on every attempt defeats server-side deduplication no matter how well it is engineered, and at high volume the damage from that bug scales with traffic: one or two duplicate events a day at small scale becomes thousands a day at 10 million, if the instability rate holds.
Building the deduplication architecture before it is needed costs less than retrofitting it under load. The failure is quieter than a database crash. Billing discrepancies accumulate, customers notice eventually, and by the time they do the window data has expired and nothing can be reconciled retroactively.