Advantages of Cassandra's masterless architecture

19
Advantages of Cassandra’s masterless architecture Duy Lam @ RD KMS TechCon 2015

Transcript of Advantages of Cassandra's masterless architecture

Page 1: Advantages of Cassandra's masterless architecture

Advantages of Cassandra’s masterless architecture

Duy Lam @ RDKMS TechCon 2015

Page 2: Advantages of Cassandra's masterless architecture

Masterless Architecture

Cautions

Page 3: Advantages of Cassandra's masterless architecture

Introduction

An Apache Software

Foundation project

Built on Java

DataStax

Page 4: Advantages of Cassandra's masterless architecture

Masterless Architecture

Cautions

Page 5: Advantages of Cassandra's masterless architecture

Masterless Architecture

Peer-to-peer Database

Automatic Data

Distribution

Built-in Replication

Page 6: Advantages of Cassandra's masterless architecture

Masterless Architecture

Cassandra clusterBackground service

Webservice

Application

Peer-to-peer Database

Automatic Data Distribution Built-in Replication

No SPOF

A node

Page 7: Advantages of Cassandra's masterless architecture

Masterless ArchitecturePeer-to-peer

DatabaseAutomatic Data

Distribution Built-in Replication

partition id name

usa_1994 ae12f… The Shawshank Redemption

usa_1994 bb2ac… Forrest Gump

skorea_2002 31dcc… The Way Home

vn_2015 890af… Jackpot

2usa_1994 ae… The Sha..

usa_1994 bb… Forrest..

1 skorea_2002 31… The Way …

3 vn_2015 89… Jackpot

Cassandra cluster

CREATE TABLE movie ( partition text , id uuid, name text)

Page 8: Advantages of Cassandra's masterless architecture

Masterless ArchitecturePeer-to-peer

DatabaseAutomatic Data

Distribution Built-in Replication

partition id name

(A)usa_1994 ae12f… The Shawshank Redemption

usa_1994 bb2ac… Forrest Gump

(B) skorea_2002 31dcc… The Way Home

(C) vn_2015 890af… Jackpot

2

1

3

Cassandra cluster

CREATE TABLE movie ( partition text , id uuid, name text)

(B) (A’) (C’)

(A) (B’) (C’)

(C) (A’) (B’)

Page 9: Advantages of Cassandra's masterless architecture

The Advantages

Peer-to-peer Database

Automatic Data Distribution

Built-in Replication ?

Page 10: Advantages of Cassandra's masterless architecture

The Advantages

Peer-to-peer Database

Automatic Data Distribution

Built-in Replication

HighAvailability

FaultToleranceScalability

Page 11: Advantages of Cassandra's masterless architecture

Demo now

Fault Tolerance ScalabilityHigh

Availability

Page 12: Advantages of Cassandra's masterless architecture

Masterless Architecture

Cautions

Page 13: Advantages of Cassandra's masterless architecture

Cautions

Cassandra is from NoSQL familySo

?

Page 14: Advantages of Cassandra's masterless architecture

Cautions

Cassandra is from NoSQL familySo Different data modeling (try to google “nosql

data modeling”) No Atomicity for multiple tables (or

“documents”) no transaction Not good at complex query (group by, having,

like, >=, etc.)

Page 15: Advantages of Cassandra's masterless architecture

CautionsCREATE TABLE movie ( partition text, id uuid, name text, released_year int, country text, PRIMARY KEY (partition, id))

Limited query capability in Cassandra

SELECT * FROM movie WHERE release_year < 2000name LIKE “Star Trek”name IN ( “Tangled”, “Frozen” )name = “Inside Out” and year = 2015length = nulllength = 120 OR release_year = 2015

UPDATE movie SET length=95 WHERE partition = “vn” AND id = 10INSERT INTO movie(partition, id, length) VALUES(“usa”, 15, 120)

(1)

(2)

(3)

(4)

(5)

(6)

Page 16: Advantages of Cassandra's masterless architecture

CautionsCREATE TABLE movie ( partition text, id uuid, name text, released_year int, country text, PRIMARY KEY (partition, id))

Limited query capability in Cassandra

SELECT * FROM movie WHERE release_year < 2000name LIKE “Star Trek”name IN ( “Tangled”, “Frozen” )name = “Inside Out” and year = 2015length = nulllength = 120 OR release_year = 2015

UPDATE movie SET length=95 WHERE partition = “vn” AND id = 10INSERT INTO movie(partition, id, length) VALUES(“usa”, 15, 120)

(1)

(2)

(3)

(4)

(5)

(6)

Page 17: Advantages of Cassandra's masterless architecture

References

DataStax Cassandra Tutorialshttps://www.youtube.com/playlist?list=PL3E5AC388940EEC0A

(thanks to Provision feature) Launch Cassandra clustering system athttp://bit.ly/kms-techcon2015-cassandra-demo

Page 18: Advantages of Cassandra's masterless architecture

Take Away

Masterless Architecture– Peer-to-peer Database– Automatic Data Distribution– Built-in Replication

Cautions– Cassandra is from NoSQL family– Limited query capability

Page 19: Advantages of Cassandra's masterless architecture

THANKS YOU