logo

当某个榜单特别热门导致单个 Redis 节点扛不住时,如何做缓存分片?以 score 分片 vs 以 player_id 分片各有什么取舍?

How do you shard the leaderboard cache when a single Redis node can’t handle the load? What are the trade-offs of sharding by score vs by player_id?

题目类型: 技术面试题

这是一道技术面试题,常见于澳洲IT公司面试中。

难度: medium

分类: System Design

标签: cache-sharding, score-shard, playerid-shard, scatter-gather

参考答案摘要

答案 热门榜单会把 QPS 与内存压力集中到单节点,需要分片(partitioning)。两种思路: 按 score 分片 优点:取 Top10、取附近排名时更自然(按分数范围切片)。 缺点:查询某个 player 的 rank/score 变复杂,因为 player 的位置不固定且需跨分片定位。 按 player_id 分片 优点:查单个玩家分数很简单(直接命中对应分片)。 缺点:取 Top10...

本题提供 STAR 原则详细解答和技术解析,登录匠人学院学习中心即可查看完整答案。

← 返回面试题库

当某个榜单特别热门导致单个 Redis 节点扛不住时,如何做缓存分片?以 score 分片 vs 以 player_id 分片各有什么取舍?

Mediumsystem-designleaderboardrediscacheserverlessscalabilityreliabilitysecuritywebsocket

想查看完整答案?

登录匠人学院学习中心,获取 STAR 格式回答和详细技术解析

前往学习中心查看答案