cassandra - how to fail?

38
Cassandra - how to fail? Michał Matłoka @mmatloka

Upload: softwaremill

Post on 21-Jan-2018

416 views

Category:

Software


2 download

TRANSCRIPT

Page 1: Cassandra - how to fail?

Cassandra - how to fail?Michał Matłoka @mmatloka

Page 2: Cassandra - how to fail?

IDEAS LEADING TO FAILURE

Page 3: Cassandra - how to fail?

Apache Cassandra• Initial release 2008

• NoSQL - Columnar Database

• Replication!

• No SPOF

• Largest cluster - 115k nodes, > 10 PB data

Page 4: Cassandra - how to fail?

NEW CLIENT

Page 5: Cassandra - how to fail?

Idea 1

We will have a lot of data, so let's use Cassandra

Page 6: Cassandra - how to fail?

UNKNOWNS

Page 7: Cassandra - how to fail?

–ThoughtWorks Technology Radar

“It’s a great tool and we like it, but too often we see teams run into trouble using it. We recommend using Cassandra carefully. Teams often misunderstand the use case for Cassandra, attempting to use it as a general-purpose data store when in fact it is optimized for fast reads on large data sets based on predefined keys or indexes. (…)”

Page 8: Cassandra - how to fail?

Idea 2

Let’s start from implementing domain model (in Cassandra)

Page 9: Cassandra - how to fail?

Modeling Methodology

Page 10: Cassandra - how to fail?

Chebotko Diagram

Page 11: Cassandra - how to fail?

Idea 3

We have that data, so we can query by it, right?

Page 12: Cassandra - how to fail?

• Keyspace

• Table

• Partition (set of rows)

• Row (columns & cells)

-2^632^63-1

Page 13: Cassandra - how to fail?

• Secondary index

• Materialized view (>= 3.0)

• SASI Index (>= 3.4)

Page 14: Cassandra - how to fail?

ALLOW FILTERING

Page 15: Cassandra - how to fail?

Idea 4

Let’s split this column to two separate ones

Page 16: Cassandra - how to fail?

SCHEMA CHANGES

Page 17: Cassandra - how to fail?

Idea 5

Hardware - more disks, more memory!!!!

Page 18: Cassandra - how to fail?

Write path

Page 19: Cassandra - how to fail?

Compaction (SizeTiered)

Page 20: Cassandra - how to fail?

MORE != BETTER

Page 21: Cassandra - how to fail?

• Disk type

• Disk size

• Heap size

• VMs

Page 22: Cassandra - how to fail?

Idea 6

Let’s run and forget

Page 23: Cassandra - how to fail?

RISE OF THE ZOMBIES

Page 24: Cassandra - how to fail?

Write

Page 25: Cassandra - how to fail?

Read

Page 26: Cassandra - how to fail?

Write

Page 27: Cassandra - how to fail?

Read

Page 28: Cassandra - how to fail?

Delete

Page 29: Cassandra - how to fail?

Delete

• max_hint_window_in_ms

• read_repair_chance

• gc_grace_seconds

Page 30: Cassandra - how to fail?
Page 31: Cassandra - how to fail?

Idea 7

It’s so fast, let’s use it as a queue

Page 32: Cassandra - how to fail?

TOMBSTONE HELL

Page 33: Cassandra - how to fail?

Tombstones vs Compaction

Page 34: Cassandra - how to fail?

Other Ideas •Let’s use Load Balancer •Let’s use Cassandra as a search engine/filestore

Page 35: Cassandra - how to fail?

–Henry Ford

“Failure is the opportunity to begin again more intelligently.”

–Homer Simpson

“Trying is the first step towards failure.”

Page 36: Cassandra - how to fail?

Take aways Carefully check if its for sure for you

Start from the queries

Chose hardware carefully

Avoid deletes

Monitor and maintain (repairs)

Page 37: Cassandra - how to fail?

Learning materials• https://softwaremill.com/blog/ • https://www.thoughtworks.com/radar/platforms/cassandra-carefully

• https://academy.datastax.com/courses/ • http://thelastpickle.com/blog/2016/07/27/about-deletes-and-tombstones.html

• https://docs.datastax.com/en/landing_page/doc/landing_page/planning/planningHardware.html

Page 38: Cassandra - how to fail?

Thank you, Q&A?@mmatloka mmatloka softwaremill.com/blog