知识卡片
分片查询可能慢于单机
按用户或商品ID把数据分片后,无状态服务可路由到对应存储。但跨分片购买或查询仍要协调多个分片,可能使多节点方案比单节点更慢。分片键应尽量让常见查询无需跨区联接,运维和数据恢复也需要经验;不能只因数据库是瓶颈就立刻认为分片必然改善。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 高可用与扩展 · 查看原书依据
Also due to stateless services, scaling often comes down to sharding (partitioning the database) across multiple nodes or using a NoSQL-style database. Both require us to find a dimension (column) in the data that we can use to separate data into partitions, such that we do not have to issue a join via SQL for the data in different partitions to answer the queries. Several databases support sharding, but setting up and running a sharded database is complex and requires skilled professionals. Even with such skills, with some queries that need data from multiple shards, a sharded multiple-node database is slower than a single-node database.