Académique Documents
Professionnel Documents
Culture Documents
About Me
http://www.aosabook.org/en/nosql.html
Preliminaries
History, Compressed
Late 1990s
Today
History, Compressed
Buy RAM
Late 1990s
Today
History, Compressed
Today
History, Compressed
NoSQL
Today
History, Compressed
NoSQL
Today
History, Compressed
NoSQL Commercialize
Today
History, Compressed
NoSQL Commercialize
Today
Cassandra
BerkeleyDB
Neo4j
Voldemort
Redis
InfoGrid
HyperTable
MongoDB
AllegroGraph HyperGraphDB
DEX
VertexDB
Tokyo Cabinet
CouchDB
MemcacheDB
Sones
FlockDB
Oracle NoSQL
Neo4j
Riak
Law of
Voldemort
CouchDB
InfoGrid
Databases:
HyperTable
The
number of persistence
Redis
MongoDB
options doubles every 1.5 years
Sones
AllegroGraph HyperGraphDB
DEX
VertexDB
Tokyo Cabinet
MemcacheDB
FlockDB
Oracle NoSQL
history
the parents of nosql
tradeoffs + demos
scaling with snoop dogg
real-world usage
discussion
BigTable
Google, 2006
Strong consistency
Dynamo
Amazon, 2007
Key-value store
history
the parents of nosql
tradeoffs + demos
scaling with snoop dogg
real-world usage
discussion
understanding NoSQL
=
understanding a long
series of tradeoffs
Relational model
Transactional semantics
Predefined schemas
Relational model
Transactional semantics
Predefined schemas
Data model
Query model
Durability
Transactional consistency
Partitioning
Replica consistency
Data Model
Usually key-based...
Data Model
Usually key-based...
Graph stores
Query Model
Query Model
Transactions
demo!
history
the parents of nosql
tradeoffs + demos
scaling with snoop dogg
real-world usage
discussion
Single-server durability
Replicate
Partition
Replicate
Performance
K-safety
Partition
Replicate
Performance
K-safety
Partition
Vertical
Horizontal
Replicate
Performance
K-safety
Partition
Vertical
Horizontal
Consistency/Availability
Replicate
Performance
K-safety
Consistency/Availability
Partition
Vertical
Horizontal
Partitioning Scheme
N = # replicas
W = # write acknowledgements
R = # read acknowledgements
Sally:
100K
Sally:
100K
N=3
Sally:
100K
N = # replicas
W = # write acknowledgements
R = # read acknowledgements
Give Sally a raise!
120K
Sally:
100K
Sally:
100K
N=3
Sally:
100K
N = # replicas
W = # write acknowledgements
R = # read acknowledgements
Give Sally a raise!
120K
Sally:
100K
Sally:
100K
N=3
Sally:
100K
N = # replicas
W = # write acknowledgements
R = # read acknowledgements
Give Sally a raise!
120K
Sally:
100K
Sally:
100K
N = 3, W = 1, R = 1
Sally:
100K
N = # replicas
W = # write acknowledgements
R = # read acknowledgements
Sally:
120K
Sally:
120K
N = 3, W = 1, R = 1
Sally:
100K
N = # replicas
W = # write acknowledgements
R = # read acknowledgements
Sally:
120K
Sally:
120K
N = 3, W = 1, R = 1
Sally:
100K
N = # replicas
W = # write acknowledgements
R = # read acknowledgements
Sally's Salary?
?
Sally:
120K
Sally:
120K
N = 3, W = 1, R = 1
Sally:
100K
N = # replicas
W = # write acknowledgements
R = # read acknowledgements
Sally's Salary?
100K
Sally:
120K
Sally:
120K
N = 3, W = 1, R = 1
Sally:
100K
N = # replicas
W = # write acknowledgements
R = # read acknowledgements
Give Sally a raise!
120K
Sally:
100K
Sally:
100K
N=3
Sally:
100K
N = # replicas
W = # write acknowledgements
R = # read acknowledgements
Give Sally a raise!
120K
Sally:
100K
Sally:
100K
N = 3, W = 3, R = 1
Sally:
100K
N = # replicas
W = # write acknowledgements
R = # read acknowledgements
Waste of time,
Waste of time,
Waste of time
120K
Sally:
100K
Sally:
100K
N = 3, W = 3, R = 1
Sally:
100K
N = # replicas
W = # write acknowledgements
R = # read acknowledgements
120K
Sally:
100K
Sally:
100K
N = 3, W = 3, R = 1
Sally:
100K
N = # replicas
W = # write acknowledgements
R = # read acknowledgements
Sally:
120K
Sally:
120K
N = 3, W = 3, R = 1
Sally:
120K
N = # replicas
W = # write acknowledgements
R = # read acknowledgements
Sally's Salary?
?
Sally:
120K
Sally:
120K
N = 3, W = 3, R = 1
Sally:
120K
N = # replicas
W = # write acknowledgements
R = # read acknowledgements
Sally's Salary?
120K
Sally:
120K
Sally:
120K
N = 3, W = 3, R = 1
Sally:
120K
N = # replicas
W = # write acknowledgements
R = # read acknowledgements
Give Sally a raise!
120K
Sally:
100K
Sally:
100K
N=3
Sally:
100K
N = # replicas
W = # write acknowledgements
R = # read acknowledgements
Give Sally a raise!
120K
Sally:
100K
Sally:
100K
N = 3, W = 2, R = 2
Sally:
100K
N = # replicas
W = # write acknowledgements
R = # read acknowledgements
Sally:
120K
Sally:
120K
N = 3, W = 2, R = 2
Sally:
100K
N = # replicas
W = # write acknowledgements
R = # read acknowledgements
Sally:
120K
Sally:
120K
N = 3, W = 2, R = 2
Sally:
100K
N = # replicas
W = # write acknowledgements
R = # read acknowledgements
Sally's Salary?
?
Sally:
120K
Sally:
120K
N = 3, W = 2, R = 2
Sally:
100K
N = # replicas
W = # write acknowledgements
R = # read acknowledgements
QUORUM!
120K
Sally:
120K
120K
100K
Sally:
120K
N = 3, W = 2, R = 2
Sally:
100K
N = # replicas
W = # write acknowledgements
R = # read acknowledgements
120K
Sally:
120K
120K
100K
Sally:
120K
N = 3, W = 2, R = 2
Sally:
100K
Consistency
Consistency
(not aCid)
Consistency
(not aCid)
Consistency
Consistency
The magical
CAP theorem
line
Consistency math
Consistency math
Strong: N < R + W
Consistency math
Strong: N < R + W
Easy: W = N
Tricky: W < N
Consistency math
Strong: N < R + W
Easy: W = N
Tricky: W < N
Eventual/Weak: N >= R + W
Consistency Options
Consistency Options
How do we get
consistent (eventually)?
Sally:
120K
Sally:
120K
Sally:
100K
Sally:
120K
Sally:
120K
Sally:
120K
Anti-entropy
Gossip-based membership
Sally:
120K
Sally:
100K
120K
Sally:
100K
Sally:
100K
N = 3, W = 1, R = 1
Sally:
100K
Sally:
120K
Sally:
120K
N = 3, W = 1, R = 1
Sally:
100K
Sally:
120K
Sally:
120K
N = 3, W = 1, R = 1
Sally:
100K
130K
Sally:
120K
Sally:
120K
N = 3, W = 1, R = 1
Sally:
100K
Sally:
120K
Sally:
120K
N = 3, W = 1, R = 1
Sally:
130K
?
Sally:
120K
Sally:
120K
N = 3, W = 1, R = 1
Sally:
130K
Sally:
100K
Version: 20
Sally:
100K
Version: 20
Sally:
100K
Version: 20
Sally:
120K
Version: 21
Sally:
120K
Version: 21
Sally:
100K
Version: 20
Sally:
120K
Version: 21
Sally:
120K
Version: 21
Sally:
130K
Version: 21
Sally:
100K
Version:
<1,1,1>
Sally:
100K
Version:
<1,1,1>
Sally:
100K
Version:
<1,1,1>
Sally:
100K
Version:
<1,1,1>
Sally:
100K
Version:
<1,1,1>
Sally:
100K
Version:
<1,1,1>
Sally:
100K
Version:
<1,1,1>
Sally:
120K
Version:
<2,1,1>
Sally:
100K
Version:
<1,1,1>
Sally:
120K
Version:
<2,1,1>
Sally:
100K
Version:
<1,1,1>
Read repair
<2,1,1>
<2,1,1>
>
<1,1,1>
(in sync)
<2,1,1>
<2,1,1>
(conflict)
!!
<1,1,2>
Anti-entropy
Gossip-based membership
Anti-entropy
Gossip-based membership
Proactively
stay in sync
Anti-entropy
Gossip-based membership
Proactively
stay in sync
Track replicas
symmetrically
Replication
Consistency
Availability
Playing catchup
Partitioning
Both: Cassandra
history
the parents of nosql
tradeoffs + demos
scaling with snoop dogg
real-world usage
discussion
NoSQL Use-cases
Cassandra at Netflix
HBase at Facebook
MongoDB at Craigslist
Cassandra
column family
Cassandra at Netflix
Replicating Datacenter Oracle with Global Apache Cassandra on AWS by Adrian Cockcroft
http://www.slideshare.net/adrianco/migrating-netflix-from-oracle-to-global-cassandra
Cassandra at Netflix
Replicating Datacenter Oracle with Global Apache Cassandra on AWS by Adrian Cockcroft
http://www.slideshare.net/adrianco/migrating-netflix-from-oracle-to-global-cassandra
HBase
column family
Strong consistency
Applications
Logging events/crawls, storing analytics
Twitter: replicate data from MySQL, Hadoop analytics
Facebook Messages
HBase
column family
Strong consistency
Applications
Facebook Messages
MongoDB
Range-based partitioning
Archiving at Craigslist
Archiving at Craigslist
Checkins at Foursquare
Geospatial indexing
history
the parents of nosql
tradeoffs + demos
scaling with snoop dogg
real-world usage
discussion
Polyglot Persistence
Cache in memcached
Statistics in MongoDB
Data model
Query Model
Transactions
Partitioning schemes
Adam Marcus
marcua@csail.mit.edu
@marcua