Cassandra - Distributed Data Store

42
Cassandra NoSQL Distributed Key-Value Store

Transcript of Cassandra - Distributed Data Store

Page 1: Cassandra - Distributed Data Store

CassandraNoSQL Distributed Key-Value Store

Page 3: Cassandra - Distributed Data Store

ME

TPSE 2013

TPSE 2015

Agile Thailand 2015

Big Data Conference 2015 @ Taipei

Untitled 2016

Fulltime Software Engineer

Page 4: Cassandra - Distributed Data Store
Page 5: Cassandra - Distributed Data Store
Page 6: Cassandra - Distributed Data Store

Why Big Data need new storage technology?

Page 7: Cassandra - Distributed Data Store

• 1 Brand• 4 Hotels• 10 Rooms

Page 8: Cassandra - Distributed Data Store

• 1 Brand• 775,000 Hotels

Page 9: Cassandra - Distributed Data Store
Page 10: Cassandra - Distributed Data Store
Page 11: Cassandra - Distributed Data Store
Page 12: Cassandra - Distributed Data Store
Page 13: Cassandra - Distributed Data Store
Page 14: Cassandra - Distributed Data Store
Page 15: Cassandra - Distributed Data Store

Cassandra

Linearly scalable

Fully Durable

Fully Distributed, no SPOF

Tuneable Consistency

Multi-master, Multi-DC

Page 16: Cassandra - Distributed Data Store

Linearly scalable

Page 17: Cassandra - Distributed Data Store

Fully durable

Page 18: Cassandra - Distributed Data Store

Fully Distributed, no SPOF

P1

I need P1

P1 P2P6

P1

P1

Page 19: Cassandra - Distributed Data Store

Tuneable Consistency

Replication Factor

Read Consistency Level (One, Two, Quorum, All)

Write Consistency Level (One, Two, Quorum, All)

Page 20: Cassandra - Distributed Data Store

Replication FactorINSERT P1

Page 21: Cassandra - Distributed Data Store

Replication FactorINSERT P1

= 3

Page 22: Cassandra - Distributed Data Store

Replication FactorINSERT P1

= 3

P1

P1 P1

Page 23: Cassandra - Distributed Data Store

Consistency LevelINSERT P1

P1

P1

= ALL

P1

100 ms

110 ms

200 ms

200 ms

DONE

Page 24: Cassandra - Distributed Data Store

Consistency LevelINSERT P1

P1

P1

= 1

P1

100 ms

110 ms

200 ms

??? ms

DONE

Page 25: Cassandra - Distributed Data Store

Consistency LevelSELECT P1

P1

P1

= ALL

P1

50 ms

70 ms

60 ms

??? ms

P1

Page 26: Cassandra - Distributed Data Store

QUORUM=

N / 2 + 1

N = Replication Factor

Page 27: Cassandra - Distributed Data Store

N = 2, QUORUM = 2N = 3, QUORUM = 2N = 4, QUORUM = 3N = 5, QUORUM = 3

N = Replication Factor

Page 28: Cassandra - Distributed Data Store

Read Fast or Write Fast

WRITE - ALL ——> Read - 1

WRITE - ONE ——> Read - ALL

WRITE - QUARUM ——> Read - QUARUM

TuningTuning

Tuning

Tuning

Tuning

Page 29: Cassandra - Distributed Data Store

Multi DC

http://www.slideshare.net/cjohannsen/apache-cassandra-at-the-geek2geek-berlin

Page 30: Cassandra - Distributed Data Store

Replication Strategies

SimpleStrategy : Single Datacenter

NetworkTopologyStrategy : Multi Datacenter

Page 31: Cassandra - Distributed Data Store

KeyspaceName

Replication Stategy

Replication Factor

Durable Write

Tables

Index

Page 32: Cassandra - Distributed Data Store

TablesName

Column

Primary Key

Comment

Page 33: Cassandra - Distributed Data Store

Data Model

Partitioning Key

Clustering Column

Primary Key

Page 34: Cassandra - Distributed Data Store

CQL

Page 35: Cassandra - Distributed Data Store

INDEX BY DESIGN

Page 36: Cassandra - Distributed Data Store

NoSQL = No! SQL

Page 37: Cassandra - Distributed Data Store

Cassandra have table ,columns and CQL does not mean

it’s SQL

Page 38: Cassandra - Distributed Data Store

Message TTL

Page 39: Cassandra - Distributed Data Store

Insert = Upsert

Page 40: Cassandra - Distributed Data Store

Key-Value

Page 41: Cassandra - Distributed Data Store

https://academy.datastax.com/

Page 42: Cassandra - Distributed Data Store

Referenceshttp://www.slideshare.net/jbellis

http://cassandra.apache.org/

http://www.datastax.com/dev/blog/deploying-cassandra-across-multiple-data-centers

http://www.slideshare.net/cjohannsen/apache-cassandra-at-the-geek2geek-berlin