简体   繁体   English

MySQL 的分片启发式是什么 - 每个表的记录数和每个实例的表数?

[英]What are the sharding heuristics for MySQL - number of records per table & number of tables per instance?

Designing an object store for ~10B objects and using mySQL for storing metadata.为约 10B 个对象设计 object 存储,并使用 mySQL 存储元数据。 We know we need to shard and are looking for general heuristics to scale.我们知道我们需要分片并且正在寻找一般的启发式方法来扩展。 Would appreciate pointers and hear about the back-of-the-envelope calculations you all used非常感谢您的指点,并了解你们都使用的粗略计算

You don't know you need to shard.你不知道你需要分片。 Find out first.先搞清楚。

In preference order:按优先顺序:

  • Use a single server more efficiently.更有效地使用单个服务器。
  • Do functional partitioning (keep different parts of your app on separate servers)进行功能分区(将应用程序的不同部分保存在不同的服务器上)
  • Do vertical partitioning (keep different columns separately)做垂直分区(分别保留不同的列)
  • Do horizontal partitioning (ie "sharding")做水平分区(即“分片”)

This is because of the complexity impact on your application.这是因为复杂性会影响您的应用程序。 It is possible to have a table with 10B rows in one server quite easily and expect good performance;可以很容易地在一台服务器中拥有一个包含 10B 行的表并期望获得良好的性能; it very much depends on your use case - how big the rows are and how many queries / updates you're doing.这在很大程度上取决于您的用例 - 行有多大以及您正在执行多少查询/更新。

Good design is always the key;好的设计永远是关键; good application design is at least as important as good database design.好的应用程序设计至少和好的数据库设计一样重要。

Don't assume.不要假设。 Test.测试。

Buy lots of hardware for your performance lab.为您的性能实验室购买大量硬件。 Don't buy any for production (yet).不要购买任何用于生产(还)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM