Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

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

1,927 views

Published on

Many users set the replication strategy on their keyspaces to NetworkTopologyStrategy and move on with modeling their data or developing the next big application. But what does that replication strategy really mean? Let's explore replication and consistency in Cassandra.

How are replicas chosen?
Where does node topology (location in a cluster) come into play?
What can I expect when nodes are down I'm querying with a Consistency Level of local quorum?
If a rack goes down can I still respond to quorum queries?

These questions may be simple to test, but have nuances that should be understood. This talk will dive into these topics in a visual and technical manner. Seasoned Cassandra veterans and new users alike stand to gain knowledge about these critical Cassandra components.

About the Speaker
Christopher Bradford Solutions Architect, DataStax

High performance drives Christopher Bradford. He has worked across various industries including the federal government, higher education, social news syndication, low latency HD video delivery and usability research. Chris combines application engineering principles and systems administration experience to design and implement performant systems. He has architected applications and systems to create highly available, fault tolerant, distributed services in a myriad environments.

Published in: Software
  • Be the first to comment

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

  1. 1. Christopher Bradford Replication and consistency in Cassandra... What does it all mean?
  2. 2. Who is this guy?
  3. 3. Christopher Bradford Solutions Architect with DataStax Built the world’s smallest C* cluster Twitter: @bradfordcp GitHub: bradfordcp © DataStax, All Rights Reserved. 3
  4. 4. Introduction
  5. 5. CAP Theorem © DataStax, All Rights Reserved. 5 Pick 2 of the 3 Consistency Availability Partition Tolerance
  6. 6. CAP Theorem © DataStax, All Rights Reserved. 6 Consistency Every read receives the most recent write or an error Consistency Availability Partition Tolerance
  7. 7. CAP Theorem © DataStax, All Rights Reserved. 7 Every request receives a response Consistency Availability Partition Tolerance Availability
  8. 8. CAP Theorem © DataStax, All Rights Reserved. 8 Partition Tolerance The system continues to operate despite arbitrary partitioning Consistency Availability Partition Tolerance
  9. 9. CAP Theorem Evolved © DataStax, All Rights Reserved. 9 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
  10. 10. CAP Theorem © DataStax, All Rights Reserved. 10 Cassandra’s View AP – Availability & Partition tolerance above all else. Consistency Availability Partition Tolerance
  11. 11. Replication Availability & Partition Tolerance
  12. 12. Replication © DataStax, All Rights Reserved. 12 Client Coordinator Replica Replica Replica Write
  13. 13. Replication © DataStax, All Rights Reserved. 13 Client Coordinator Replica Replica Replica Write +1 Hint
  14. 14. Replication © DataStax, All Rights Reserved. 14 Client Coordinator Replica Replica Replica Read
  15. 15. Configuring Replication Replication is defined at the keyspace level. © DataStax, All Rights Reserved. 15 Strategy Parameters CREATE KEYSPACE cassandra_summit WITH REPLICATION = { ‘class’: ‘SimpleStrategy’, ‘replication_factor’: 3 };
  16. 16. 1 Simple Strategy 2 Network Topology Strategy Replication Strategies © DataStax, All Rights Reserved. 16
  17. 17. Simple Strategy © DataStax, All Rights Reserved. 17 Client Coordinator Replica Replica Replica Request Class: SimpleStrategy Parameters: • replication_factor
  18. 18. Simple Strategy © DataStax, All Rights Reserved. 18 Client Coordinator Replica Replica Replica Request
  19. 19. Network Topology Strategy © DataStax, All Rights Reserved. 19 Client Coordinator Replica Replica Replica Request Class: NetworkTopologyStrategy Parameters: • dc_name: replication_factor
  20. 20. Network Topology Strategy © DataStax, All Rights Reserved. 20 Client Coordinator ReplicaRequest Rack 1 Rack 2 Replica Replica
  21. 21. Network Topology Strategy © DataStax, All Rights Reserved. 21 Client Coordinator ReplicaRequest Rack 1 Rack 3 Replica Replica Rack 2 Tools: nodetool status ks nodetool getendpoints ks table val
  22. 22. Consistency Balancing performance and correctness
  23. 23. Tunable Consistency
  24. 24. Consistency Levels © DataStax, All Rights Reserved. 24
  25. 25. Consistent Reads • ALL • QUORUM • LOCAL_QUORUM • ONE • LOCAL_ONE • SERIAL © DataStax, All Rights Reserved. 25 Replica Replica Replica
  26. 26. Consistent Writes • ALL • QUORUM • LOCAL_QUORUM • ONE • LOCAL_ONE • ANY © DataStax, All Rights Reserved. 26 Replica Replica Replica
  27. 27. Consistency Failures © DataStax, All Rights Reserved. 27 What happens when the desired consistency level cannot be achieved? Replica Replica Replica
  28. 28. Failure Recovery © DataStax, All Rights Reserved. 28 Staying Consistent In the event of a failure how do replicas get the latest data? Replica Replica Replica
  29. 29. Conclusion © DataStax, All Rights Reserved.29
  30. 30. Questions?

×