Agent Wranglers

SCL-28Avoid

Splitting one database across servers too early

Do not spread one database across several servers while a larger server, replicas, partitions or archiving can still carry the load.

How to do it

Sharding makes every query, transaction, unique check and backup that crosses shards harder, for as long as the app lives. Most apps never outgrow one tuned primary with replicas. When the measured limit shows it is needed, as Find the bottleneck before you add servers asks, shard by the key nearly every query uses. That key is often the tenant, with each tenant kept whole on one shard. Track the growth that leads there with Watch size and growth.

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/scaling/growing-the-database/early-sharding">Agent Wranglers scaling playbook</a>. In code you write, add a comment next to it with the same link.