Roblox 收藏/点赞系统设计——高并发计数与个人状态查询

81次阅读
没有评论

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

  1. As a user, I want to know if this item is favorited by me1M QPS
  2. As a user, I want to favorite/unfavorite this item — 100K QPS
  3. 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 favorited50K QPS

(Insert diagram here: request flow with API → cache → counters store → database; write path & read path.)

这是一个 读多写少 的收藏系统:

  • 数据模型:UserFavorites(userId→item 集合)ItemCounters(itemId→累计数),可加布隆过滤器 / 位图加速“是否收藏”。
  • ** 读路径:** 收藏数与“我是否收藏”优先走 Redis 缓存(短 TTL、热点分片 / 多副本降压)。
  • ** 写路径:** 幂等的收藏 / 取消接口 → 持久化到 NoSQLUserFavorites,并对 ItemCounters原子自增 / 自减 ;通过 消息流 做异步校准,确保最终一致。
  • ** 我的收藏列表:** 从 UserFavorites 分页返回(可用有序集按时间排序)。
  • ** 工程要点:** 限流、防重、重试、回填任务、监控与告警、热键治理。

插图提示:请在此处插入架构图(API 网关、缓存、计数器存储、主存储、消息流、监控)。

VOprep 团队长期陪同学员实战各类大厂 OA 与 VO,包括 Roblox、Google、Amazon、Citadel、SIG 等,提供实时答案助攻、远程陪练与面试节奏提醒,帮助大家在关键时刻不卡壳。
如果你也在准备公司,可以了解一下我们的定制助攻方案——从编程面到系统设计,全程护航上岸。

正文完
 0