Scrivio Interview library
DebuggingIntermediate6 min read · updated 13 November 2026

A recommendation service keeps one Bloom filter per user to avoid showing items the user has already seen, created implicitly with default settings. After six months users complain they see few new items, and BF.INFO shows 8 sub-filters for heavy users.

Explain the behaviour and redesign the approach.

BF.ADD on a missing key created each user's filter with the module defaults, a capacity of 100 and a 1 percent error rate, so heavy users' filters kept expanding into many sub-filters, and every lookup now checks every layer. Each layer adds its own chance of a false positive, so items the user never saw are reported as seen and dropped, on top of six months of genuine history that marks most candidates as seen. We redesign with monthly filters per user, sized with BF.RESERVE, checked across the last few months and expired with TTLs, and we measure the real false-positive rate.

Why this question is asked

'Users see fewer new items' is a vague complaint, and the Bloom filter is easy to overlook because it still answers quickly and never errors. Interviewers use this case to see whether we know how a scalable Bloom filter grows, what that does to its error rate, and whether we question the product requirement behind the design. In this answer, we will read what BF.INFO is telling us, explain why layering hides new items, redesign with time-bucketed filters, measure the real error rate, migrate existing users and reconsider how much history we need.

1What BF.INFO Is Telling Us

Nobody called BF.RESERVE, so the first BF.ADD for each user created a filter with the defaults: capacity 100 and error rate 0.01, unless the module was configured otherwise (check your version's defaults and module options). A heavy user who sees thousands of items a month blows through 100 quickly. When a filter reaches capacity, RedisBloom does not fail; it adds a new sub-filter, by default twice as large (the EXPANSION factor of 2), and keeps the old ones.

Properties
BF.INFO seen:user:88123
# Capacity: 25500 100 + 200 + 400 + ... + 12800
# Size: (bytes)
# Number of filters: 8
# Number of items inserted: 24870
# Expansion rate: 2
How a default filter grew
Sub-filterCapacityCreated when
1100first BF.ADD
2200after 100 items
3400after 300 items
......doubling each time
812,800after 12,700 items

Eight sub-filters of 100, 200, 400 and so on up to 12,800 add up to a total capacity of 25,500, and this user has inserted almost 25,000 items in six months. The filter has grown seven times.

2Why Layers Hide New Items

A lookup in a scalable filter asks every sub-filter, and the item counts as seen if any of them says so. So each layer adds its own chance of a false positive. RedisBloom gives each new layer a tighter error rate to limit the total, but the combined rate still ends up above the 1 percent we started with, and 1 percent was already a loose target for this job. Every lookup also has to check eight filters instead of one, which costs more CPU.

What does that mean for recommendations? The recommender generates, say, 500 candidates and drops every one the filter calls seen. For a heavy user, most candidates are genuinely seen after six months of browsing, so only a small group of genuinely new items survives, and false positives remove some of exactly that group. The two effects compound: a long history makes almost everything seen, and the false positives eat into what is left.

3Measuring the Real False-Positive Rate

Before redesigning, we measure. We take items we know the user has never been shown, such as items published after the user's last session, and check them with BF.MEXISTS. The fraction reported as seen is the real false-positive rate for that user. We track it by user activity band, since light users with one sub-filter will look fine and heavy users will not.

We also add an alert on filters where the number of items inserted exceeds the planned capacity, or the number of sub-filters exceeds one, which would have flagged this months ago.

4Redesign: Time-Bucketed Filters Sized Up Front

Instead of one ever-growing filter per user, we keep one filter per user per month, created explicitly with BF.RESERVE and sized for that user's expected monthly volume, with NONSCALING so it never grows layers silently. A lookup checks the filters of the last few months, for example three, and each monthly key has a TTL slightly longer than the window, so old history falls away automatically.

Text
# at the first impression of the month, create the filter if missing
BF.RESERVE seen:user:88123:2026-11 0.001 8000 NONSCALING # OK (error if it already exists)
EXPIRE seen:user:88123:2026-11 8640000 # 100 days
# record impressions
BF.MADD seen:user:88123:2026-11 item:551 item:552 item:553
# filter candidates against the last three months, in one pipeline
BF.MEXISTS seen:user:88123:2026-11 item:900 item:901 ...
BF.MEXISTS seen:user:88123:2026-10 item:900 item:901 ...
BF.MEXISTS seen:user:88123:2026-09 item:900 item:901 ...
Step throughFiltering candidates with monthly filters
  1. Generate 500 candidatesrecommender
  2. BF.MEXISTS on this month's filterpipelined
  3. BF.MEXISTS on the previous two monthssame pipeline
  4. Seen in any month?
    YesDrop the candidateNoKeep it as new
  5. Rank and show the kept itemsrecord impressions with BF.MADD

5 steps in order. Play them, or step through them one at a time.

Sizing per user comes from their activity: light users get small filters, heavy users get larger ones, chosen from the previous month's count with headroom. With NONSCALING, a filter that does fill up returns an error on BF.ADD instead of expanding, which our code treats as a signal to create an overflow filter for that month and log it. Three filters at 0.1 percent give a combined false-positive rate around 0.3 percent, far below what we have now.

5Questioning the Requirement

Do we really need to hide everything a user saw six months ago? Often not. An item seen once in passing in May may be worth showing again in November, and some recommendation teams find that a shorter window, such as 30 to 90 days, improves engagement. A shorter window also keeps filters small and lookups cheap. We agree the window with the product team and test it, rather than letting the data structure decide it by accident.

6Follow-up questions

How do you move existing users to the new filters?

We do not convert the old filters, since Bloom filters cannot be read back as items. Instead, we start writing impressions to the new monthly filters from a cut-over date, and for a transition period check both the new monthly filters and the old filter. If impression logs exist, we backfill the last month or two into the new filters for heavy users. Once the new window is fully covered, we stop reading the old filters and delete them with UNLINK.

Why not just create one huge filter per user with BF.RESERVE?

A filter sized for six months of the heaviest user wastes memory for everyone else, and it still never forgets, so the history problem remains. Monthly filters give each period its own size, expire on their own and naturally implement the history window.

Would a Cuckoo filter be better here?

It would allow deleting old items, but we would have to know which items to delete and when, which means storing the impression history anyway. Time-bucketed Bloom filters get the same result, forgetting old history, simply by expiring whole months.

7Conclusion

In this answer, we saw that implicit BF.ADD created filters with a capacity of 100 and a 1 percent error rate, so heavy users' filters grew into eight sub-filters, each lookup checks every layer, and the combined false-positive rate rose above the target, hiding new items on top of six months of genuine history. We redesigned with per-user monthly filters created by BF.RESERVE with realistic sizes, checked across the last few months and expired by TTL, measured the real false-positive rate with known-unseen items, and questioned how much history recommendations should hide.

What to say in the interviewAbout 90 seconds aloud

Open with

The filters were created implicitly by BF.ADD, so they got the module defaults, capacity 100 and a 1 percent error rate unless someone configured otherwise. Heavy users went far past 100 items, so each filter kept expanding, adding a sub-filter twice the size of the last one, and BF.INFO shows 8 of them.

Then, if they want more

A lookup has to check every layer, and the item counts as seen if any layer says so, so each layer adds its own false-positive chance. RedisBloom tightens the error rate of new layers, but the combined rate still ends up above the target, which was loose to begin with.

So the filter says seen for items the user never saw. On top of that, six months of genuine history means most candidates really are seen, and the false positives eat into the few new ones left.

I'd redesign with one filter per user per month, created with BF.RESERVE sized from the user's activity, checked across the last two or three months in one pipeline and expired with TTLs, so old history falls away.

I'd measure the real false-positive rate by checking items we know are unseen, alert when items inserted exceed capacity, and I'd ask the product team whether we need months of seen history at all; a shorter window often gives better recommendations and smaller filters.

About this answer

Last updated
13 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Official documentation
Redis documentation
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "Explain the behaviour and redesign the approach.": https://scrivio-interview-library.netlify.app/databases/redis-patterns/1744c44e21/