4. TYPICAL MULTITENANCY OPTIONS
SQL WORLD
SHARED
Same Database
Different Schema
Different Database
Same Schema
Different Database
Different Schema
ISOLATED
5. TYPICAL MULTITENANCY OPTIONS
SQL WORLD
SCHEMA-LESS WORLD - MONGODB
SHARED
Same Database
Different Schema
Different Database
Same Schema
Different Database
Different Schema
ISOLATED
SHARED
Same Database
Different Collection
ISOLATED
6. TYPICAL MULTITENANCY OPTIONS
SQL WORLD
SCHEMA-LESS WORLD - MONGODB
SHARED
Same Database
Different Schema
Different Database
Same Schema
Different Database
Different Schema
ISOLATED
SHARED
Same Database
Different Collection
Different Database
Different Collection
ISOLATED
Reference: Considerations on MongoDB multitenancy blog post
7.
8.
9.
10.
11. MONGODB
SETUP TENANT DATABASE
▸ Create Database
▸ Create collections
▸ Shard collections
▸ Define shard keys
▸ Set tagged ranges
▸ Create indices
▸ Seed with initial data
18. PROS AND CONS
PROS
Rack compliant
No one needs to care
Isolates multitenancy implementation to a single method
19. PROS AND CONS
PROS
Rack compliant
No one needs to care
Isolates multitenancy implementation to a single method
If something goes wrong it ensures it goes back to the default
20. PROS AND CONS
PROS
Rack compliant
No one needs to care
Isolates multitenancy implementation to a single method
If something goes wrong it ensures it goes back to the default
CONS
Always need to define the database for maintenance tasks
21. PROS AND CONS
PROS
Rack compliant
No one needs to care
Isolates multitenancy implementation to a single method
If something goes wrong it ensures it goes back to the default
CONS
Always need to define the database for maintenance tasks
Need to store the tenant database name somewhere else
22. PROS AND CONS
PROS
Rack compliant
No one needs to care
Isolates multitenancy implementation to a single method
If something goes wrong it ensures it goes back to the default
CONS
Always need to define the database for maintenance tasks
Need to store the tenant database name somewhere else
You need to be ready to not have the database setup right away
25. REAL WORLD
ADVANTAGES
▸ Performance not affected by other customers data growth
▸ Easier to perform data migrations for single customers
▸ Delete old customers data is a simple DROP DATABASE
26. REAL WORLD
ADVANTAGES
▸ Performance not affected by other customers data growth
▸ Easier to perform data migrations for single customers
▸ Delete old customers data is a simple DROP DATABASE
GOTCHAS
▸ You are on your own, no support, no one will care about if creating a
database is slow or listing them takes ages (MongoDB Cloud Manager)
27. REAL WORLD
ADVANTAGES
▸ Performance not affected by other customers data growth
▸ Easier to perform data migrations for single customers
▸ Delete old customers data is a simple DROP DATABASE
GOTCHAS
▸ You are on your own, no support, no one will care about if creating a
database is slow or listing them takes ages (MongoDB Cloud Manager)
▸ Monitoring tools like New Relic discard database information when
showing query performance metrics
28. YOU CAN JOIN US
WE ARE HIRING
▸ Backend
▸ Frontend
▸ Mobile iOS/Android
TALK TO ME
https://github.com/lqd-io