Re:Multi-Tenant Architectures
by laluser on Sunday August 30, 2020 @07:14PM
(#24326831)
Everything is simple when you're starting out. Over time, you'd see that users can have wildly different load patterns, which will affect how you scale and shard your database over time. It's a huge pain to manage and grow.
[ Parent
| on HN ]
It's way easier to scale a shared app/db, anyone who tells you different hasn't had to do devops.
Rule No. 1, never shard by account_id, Pareto is just waiting you kick you in the ass. Always shard by whatever gives the best distribution of workload.
There are more rules of course.
I've always considered data isolation as the #1 priority when it comes to tenancy. Does that mean that the sharding should defacto be done on the tenant ID?
You shard for load distribution. If data isolation is #1 priority, use separate tables, schemas, database instances.