Multi-tenancy: Designing for Scale by Ozgun Ergodan, Lukas Fittl and Sai Srirampur
If you’re building a SaaS application, you probably already have the notion of tenancy built in your data model. Typically, most information relates to tenants/customers/accounts and your database tables capture this natural relation. With smaller amounts of data (10s of GB), it’s easy to throw more hardware at the problem and scale up your database. As these tables grow however, you need to think about ways to scale your multi-tenant database across dozens or hundreds of machines.
We'll cover the three major options you have to setting up a multi-tenant app and the trade-offs of each:
We'll then describe each design pattern's tradeoffs, and focus on one design pattern that optimizes for scale.
Afterwards we continue the tutorial with two hands-on sessions. First, we're going to look at a sample multi-tenant app and its database schema. We'll model the data for migrating it to a distributed environment, create tables, and then load the data. We'll then run example distributed queries, go over the concept of colocated tables, and show dynamically scaling out the cluster. We'll conclude by reviewing common questions that come up when designing multi-tenant databases and Q&A.