Roblox has a marketplace with millions of items. A user can flag/unflag any item as a favorite (similar to Like/Bookmark).
Goal: Design a system that can show the number of favorites each item has.
User Stories / QPS targets
- As a user, I want to know if this item is favorited by me — 1M QPS
- As a user, I want to favorite/unfavorite this item — 100K QPS
- As a user, I want to see the total favorite count for this item — 1M QPS
Extra:
– As a user, I want to list all items I have favorited — 50K QPS
(Insert diagram here: request flow with API → cache → counters store → database; write path & read path.)
Design for read-heavy workload:
- Data model:
UserFavorites(userId → itemIds set),ItemCounters(itemId → favCount); optionalUser→Item bitset/bloom. - Reads: Item count &“did I favorite?”served from Redis/Memory cache with short TTL + hot-key protection; cache keys sharded by
itemId. - Writes: Idempotent toggle API → write to UserFavorites (NoSQL/Cassandra/DynamoDB) + atomic counter (Redis INCR / DynamoDB counter) with outbox/stream to reconcile source of truth.
- Consistency: Eventual for counts; strong for per-user state (read-your-writes via write-through cache).
- List my favorites: paginate from
UserFavorites(store as sorted set for recency). - Ops: rate limiting, dedup, retries, TTL backfill job, cold-key preload, metrics.
The VOprep team has long accompanied candidates through various major company OAs and VOs, including Roblox, Google, Amazon, Citadel, SIG, providing real-time voice assistance, remote practice, and interview pacing reminders to help you stay smooth during critical moments. If you are preparing for these companies, you can check out our customized support plans—from coding interviews to system design, we offer full guidance to help you succeed.