SLIDE 1
/ Robert Treat
Database Scalability {Patterns}
SLIDE 2 robert treat
postgres
mssql - sqlite - nosql
SLIDE 3
What are “Database Scalability Patterns?”
SLIDE 4
Part Design Patterns Part Application Life-Cycle
SLIDE 5
Part Design Patterns Part Application Life-Cycle
SLIDE 6
Part Design Patterns Part Application Life-Cycle
SLIDE 7
Part Design Patterns Part Application Life-Cycle
SLIDE 8
MyFirstDatabase
SLIDE 9
Vertical Partitioning
SLIDE 10
Vertical Scaling
SLIDE 11
Vertical Scaling
SLIDE 12
Vertical Scaling
SLIDE 13
Horizontal Scaling Federated Data Storage “sharding” Horizontal Partitioning Multi-Master Read Slaves
SLIDE 14
Read Slaves / Master - Slave Scale Read Load
SLIDE 15
Read Slaves / Master - Slave Scale Read Load writes go here!
SLIDE 16
Read Slaves / Master - Slave Scale Read Load writes go here! reads go here (or here) (or here)
SLIDE 17
database writes data to slaves Read Slaves / Master - Slave Scale Read Load writes go here! reads go here (or here) (or here) slave db slave db slave db
SLIDE 18
Read Slaves / Master - Slave Scale Read Load writes go here! reads go here (or here) (or here) app writes data everywhere memcached memcached memcached
SLIDE 19 Read Slaves / Master - Slave Scale Read Load
- Typically
- Full Copy of Data
On Each Node
SLIDE 20 Read Slaves / Master - Slave Scale Read Load
- Typically
- Full Copy of Data
On Each Node
- Asynchronous
- Consider
- Partial Copy
- Synchronous
- Don’t use a RDBMS?
SLIDE 21 Read Slaves / Master - Slave Scale Read Load
- Typically
- Full Copy of Data
On Each Node
- Asynchronous
- Consider
- Partial Copy
- Synchronous
- Don’t use a RDBMS?
“easy” Requires Application Changes
SLIDE 22
Scaling Writes “not easy”
SLIDE 23
Multi-Master many different ways to implement this, few that actually work in production
SLIDE 24
many different ways to implement this, few that actually work in production write to any node, database syncs data Multi-Master
SLIDE 25
many different ways to implement this, few that actually work in production write to any node, database syncs data can reduce cpu, doesn’t reduce i/o Multi-Master
SLIDE 26
many different ways to implement this, few that actually work in production write to any node, database syncs data can reduce cpu, doesn’t reduce i/o failover solution not a scalability solution Multi-Master
SLIDE 27
Horizontal Partitioning “sharding” “SOA”
SLIDE 28
Horizontal Partitioning “sharding” “SOA”
SLIDE 29
- Divide schema by job operations
- Move each piece to own server
- Duplicate some data as needed
Horizontal Partitioning
SLIDE 30 users items forums
- Divide schema by job operations
- Move each piece to own server
- Duplicate some data as needed
Horizontal Partitioning
SLIDE 31 users items forums
- Divide schema by job operations
- Move each piece to own server
- Duplicate some data as needed
- You must separate dependencies
in the app code first! Horizontal Partitioning
SLIDE 32 users items forums
- Divide schema by job operations
- Move each piece to own server
- Duplicate some data as needed
- You must separate dependencies
in the app code first! Each node is a new instance of vertical scaling Horizontal Partitioning
SLIDE 33
- data split across servers based on algorithm
- data dropped into buckets (multiple?)
Horizontal Scaling
magic hash algorithm
app
SLIDE 34
- data split across servers based on algorithm
- data dropped into buckets (multiple?)
Horizontal Scaling
magic hash algorithm
app
SLIDE 35
- data split across servers based on algorithm
- data dropped into buckets (multiple?)
- someone must keep track of data, and provide
lookup services Horizontal Scaling
magic hash algorithm
app
SLIDE 36
Universal Truths of Scaling Databases Vertical Scalability is Helpful for Every Pattern Even in a horizontally scaled, fully distributed database, the number of nodes needed is affected by vertical scalability
SLIDE 37 Universal Truths of Scaling Databases New Nodes Are Never Free
- Add points of failure
- Add management costs
- Add complexity to architecture
- Add complexity to your app code
SLIDE 38
MyFirstDB V Vertical Partitioning V Vertical Scaling V Read Slaves V Horizontal Partitioning
SLIDE 39
plan for layered data sources read / write connections in code use schemas to separate services tips
SLIDE 40 THANKS! more: xzilla.net @robtreat2
(scalability conference)