Database Multitenancy in Ruby
-
Upload
joao-soares -
Category
Technology
-
view
115 -
download
0
Transcript of Database Multitenancy in Ruby
DATABASE MULTITENANCY
RUBY IDIOM CASE
TYPICAL MULTITENANCY OPTIONS
SQL WORLD
SHAREDSame Database
Different SchemaISOLATED
TYPICAL MULTITENANCY OPTIONS
SQL WORLD
SHAREDSame Database
Different Schema
Different Database
Same SchemaISOLATED
TYPICAL MULTITENANCY OPTIONS
SQL WORLD
SHAREDSame Database
Different Schema
Different Database
Same Schema
Different Database
Different SchemaISOLATED
TYPICAL MULTITENANCY OPTIONS
SQL WORLD
SCHEMA-LESS WORLD - MONGODB
SHAREDSame Database
Different Schema
Different Database
Same Schema
Different Database
Different SchemaISOLATED
SHAREDSame Database
Different CollectionISOLATED
TYPICAL MULTITENANCY OPTIONS
SQL WORLD
SCHEMA-LESS WORLD - MONGODB
SHAREDSame Database
Different Schema
Different Database
Same Schema
Different Database
Different SchemaISOLATED
SHAREDSame Database
Different Collection
Different Database
Different CollectionISOLATED
Reference: Considerations on MongoDB multitenancy blog post
MONGODB
SETUP TENANT DATABASE
▸ Create Database
▸ Create collections
▸ Shard collections
▸ Define shard keys
▸ Set tagged ranges
▸ Create indices
▸ Seed with initial data
Building on top of Mongoid
Building on top of Mongoid
Building on top of Mongoid
PROS AND CONSPROS
Rack compliant
PROS AND CONSPROS
Rack compliant
No one needs to care
PROS AND CONSPROS
Rack compliant
No one needs to care
Isolates multitenancy implementation to a single method
PROS AND CONSPROS
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
PROS AND CONSPROS
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
PROS AND CONSPROS
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
PROS AND CONSPROS
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
REAL WORLD
ADVANTAGES
▸ Performance not affected by other customers data growth
▸
REAL WORLD
ADVANTAGES
▸ Performance not affected by other customers data growth
▸ Easier to perform data migrations for single customers
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
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)
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
YOU CAN JOIN US
WE ARE HIRING
▸ Backend
▸ Frontend
▸ Mobile iOS/Android
TALK TO ME
https://github.com/lqd-io
ME
JOÃO SOARES
@_jasoares
github.com/jasoares
linkedin.com/in/jaisoares
CTO & Cofounder @ Liquid
Previously:
Mobitto
Way2Inov
ASK ME ANYTHING