+ All Categories
Home > Software > Replication and Consistency in Cassandra... What Does it All Mean? (Christopher Bradford, DataStax)...

Replication and Consistency in Cassandra... What Does it All Mean? (Christopher Bradford, DataStax)...

Date post: 16-Apr-2017
Category:
Upload: datastax
View: 214 times
Download: 1 times
Share this document with a friend
30
Christopher Bradford Replication and consistency in Cassandra... What does it all mean?
Transcript
Page 1: Replication and Consistency in Cassandra... What Does it All Mean? (Christopher Bradford, DataStax) | C* Summit 2016

Christopher Bradford

Replication and consistency in Cassandra... What does it all mean?

Page 2: Replication and Consistency in Cassandra... What Does it All Mean? (Christopher Bradford, DataStax) | C* Summit 2016

Who is this guy?

Page 3: Replication and Consistency in Cassandra... What Does it All Mean? (Christopher Bradford, DataStax) | C* Summit 2016

Christopher BradfordSolutions Architect with DataStax

Built the world’s smallest C* cluster

Twitter: @bradfordcp

GitHub: bradfordcp

© DataStax, All Rights Reserved. 3

Page 4: Replication and Consistency in Cassandra... What Does it All Mean? (Christopher Bradford, DataStax) | C* Summit 2016

Introduction

Page 5: Replication and Consistency in Cassandra... What Does it All Mean? (Christopher Bradford, DataStax) | C* Summit 2016

© DataStax, All Rights Reserved. 5

CAP Theorem

Pick 2 of the 3

Consistency

Availability Partition Tolerance

Page 6: Replication and Consistency in Cassandra... What Does it All Mean? (Christopher Bradford, DataStax) | C* Summit 2016

© DataStax, All Rights Reserved. 6

CAP Theorem

Consistency

Every read receives the most recent write or an error

Consistency

Availability Partition Tolerance

Page 7: Replication and Consistency in Cassandra... What Does it All Mean? (Christopher Bradford, DataStax) | C* Summit 2016

© DataStax, All Rights Reserved. 7

CAP Theorem

Every request receives a response

Consistency

Availability Partition Tolerance

Availability

Page 8: Replication and Consistency in Cassandra... What Does it All Mean? (Christopher Bradford, DataStax) | C* Summit 2016

© DataStax, All Rights Reserved. 8

CAP Theorem

Partition Tolerance

The system continues to operate despite arbitrary partitioning

Consistency

Availability Partition Tolerance

Page 9: Replication and Consistency in Cassandra... What Does it All Mean? (Christopher Bradford, DataStax) | C* Summit 2016

© DataStax, All Rights Reserved. 9

CAP Theorem Evolved

The modern CAP goal should be to maximize combinations of consistency and availability that make sense for the specific application. Such an approach incorporates plans for operation during a partition and for recovery afterward, thus helping designers think about CAP beyond its historically perceived limitations.

- Eric Brewer

C

A P

Page 10: Replication and Consistency in Cassandra... What Does it All Mean? (Christopher Bradford, DataStax) | C* Summit 2016

© DataStax, All Rights Reserved. 10

CAP Theorem

Cassandra’s View

AP – Availability & Partition tolerance above all else.

Consistency

Availability Partition Tolerance

Page 11: Replication and Consistency in Cassandra... What Does it All Mean? (Christopher Bradford, DataStax) | C* Summit 2016

ReplicationAvailability & Partition Tolerance

Page 12: Replication and Consistency in Cassandra... What Does it All Mean? (Christopher Bradford, DataStax) | C* Summit 2016

© DataStax, All Rights Reserved. 12

Replication

ClientCoordinator

Replica

Replica

Replica

Write

Page 13: Replication and Consistency in Cassandra... What Does it All Mean? (Christopher Bradford, DataStax) | C* Summit 2016

© DataStax, All Rights Reserved. 13

Replication

ClientCoordinator

Replica

Replica

Replica

Write

+1 Hint

Page 14: Replication and Consistency in Cassandra... What Does it All Mean? (Christopher Bradford, DataStax) | C* Summit 2016

© DataStax, All Rights Reserved. 14

Replication

ClientCoordinator

Replica

Replica

Replica

Read

Page 15: Replication and Consistency in Cassandra... What Does it All Mean? (Christopher Bradford, DataStax) | C* Summit 2016

© DataStax, All Rights Reserved. 15

Configuring Replication

Replication is defined at the keyspace level.

Strategy

Parameters

CREATE KEYSPACE cassandra_summit WITH REPLICATION = { ‘class’: ‘SimpleStrategy’, ‘replication_factor’: 3 };

Page 16: Replication and Consistency in Cassandra... What Does it All Mean? (Christopher Bradford, DataStax) | C* Summit 2016

1 Simple Strategy

2 Network Topology Strategy

Replication Strategies

© DataStax, All Rights Reserved. 16

Page 17: Replication and Consistency in Cassandra... What Does it All Mean? (Christopher Bradford, DataStax) | C* Summit 2016

© DataStax, All Rights Reserved. 17

Simple Strategy

ClientCoordinator

Replica

Replica

Replica

Request

Class: SimpleStrategyParameters:• replication_factor

Page 18: Replication and Consistency in Cassandra... What Does it All Mean? (Christopher Bradford, DataStax) | C* Summit 2016

© DataStax, All Rights Reserved. 18

Simple Strategy

ClientCoordinator

Replica

Replica

Replica

Request

Page 19: Replication and Consistency in Cassandra... What Does it All Mean? (Christopher Bradford, DataStax) | C* Summit 2016

© DataStax, All Rights Reserved. 19

Network Topology Strategy

ClientCoordinator

Replica

Replica

Replica

Request

Class: NetworkTopologyStrategyParameters:• dc_name: replication_factor

Page 20: Replication and Consistency in Cassandra... What Does it All Mean? (Christopher Bradford, DataStax) | C* Summit 2016

© DataStax, All Rights Reserved. 20

Network Topology Strategy

Client Coordinator

ReplicaRequestRack 1

Rack 2

Replica

Replica

Page 21: Replication and Consistency in Cassandra... What Does it All Mean? (Christopher Bradford, DataStax) | C* Summit 2016

© DataStax, All Rights Reserved. 21

Network Topology Strategy

ClientCoordinator

ReplicaRequestRack 1

Rack 3

Replica

Replica Rack 2

Tools:nodetool status ksnodetool getendpoints ks table val

Page 22: Replication and Consistency in Cassandra... What Does it All Mean? (Christopher Bradford, DataStax) | C* Summit 2016

ConsistencyBalancing performance and correctness

Page 23: Replication and Consistency in Cassandra... What Does it All Mean? (Christopher Bradford, DataStax) | C* Summit 2016

Tunable Consistency

Page 24: Replication and Consistency in Cassandra... What Does it All Mean? (Christopher Bradford, DataStax) | C* Summit 2016

© DataStax, All Rights Reserved. 24

Consistency Levels

Page 25: Replication and Consistency in Cassandra... What Does it All Mean? (Christopher Bradford, DataStax) | C* Summit 2016

© DataStax, All Rights Reserved. 25

Consistent Reads

• ALL• QUORUM• LOCAL_QUORUM• ONE• LOCAL_ONE• SERIAL

Replica

Replica

Replica

Page 26: Replication and Consistency in Cassandra... What Does it All Mean? (Christopher Bradford, DataStax) | C* Summit 2016

© DataStax, All Rights Reserved. 26

Consistent Writes

• ALL• QUORUM• LOCAL_QUORUM• ONE• LOCAL_ONE• ANY

Replica

Replica

Replica

Page 27: Replication and Consistency in Cassandra... What Does it All Mean? (Christopher Bradford, DataStax) | C* Summit 2016

© DataStax, All Rights Reserved. 27

Consistency Failures

What happens when the desired consistency level cannot be achieved?

Replica

Replica

Replica

Page 28: Replication and Consistency in Cassandra... What Does it All Mean? (Christopher Bradford, DataStax) | C* Summit 2016

© DataStax, All Rights Reserved. 28

Failure Recovery

Staying Consistent

In the event of a failure how do replicas get the latest data?

Replica

Replica

Replica

Page 29: Replication and Consistency in Cassandra... What Does it All Mean? (Christopher Bradford, DataStax) | C* Summit 2016

Conclusion

© DataStax, All Rights Reserved.29

Page 30: Replication and Consistency in Cassandra... What Does it All Mean? (Christopher Bradford, DataStax) | C* Summit 2016

Questions?


Recommended