Upload
softwaremill
View
416
Download
2
Embed Size (px)
Citation preview
Cassandra - how to fail?Michał Matłoka @mmatloka
IDEAS LEADING TO FAILURE
Apache Cassandra• Initial release 2008
• NoSQL - Columnar Database
• Replication!
• No SPOF
• Largest cluster - 115k nodes, > 10 PB data
NEW CLIENT
Idea 1
We will have a lot of data, so let's use Cassandra
UNKNOWNS
–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. (…)”
Idea 2
Let’s start from implementing domain model (in Cassandra)
Modeling Methodology
Chebotko Diagram
Idea 3
We have that data, so we can query by it, right?
• Keyspace
• Table
• Partition (set of rows)
• Row (columns & cells)
-2^632^63-1
• Secondary index
• Materialized view (>= 3.0)
• SASI Index (>= 3.4)
ALLOW FILTERING
Idea 4
Let’s split this column to two separate ones
SCHEMA CHANGES
Idea 5
Hardware - more disks, more memory!!!!
Write path
Compaction (SizeTiered)
MORE != BETTER
• Disk type
• Disk size
• Heap size
• VMs
Idea 6
Let’s run and forget
RISE OF THE ZOMBIES
Write
Read
Write
Read
Delete
Delete
• max_hint_window_in_ms
• read_repair_chance
• gc_grace_seconds
Idea 7
It’s so fast, let’s use it as a queue
TOMBSTONE HELL
Tombstones vs Compaction
Other Ideas •Let’s use Load Balancer •Let’s use Cassandra as a search engine/filestore
–Henry Ford
“Failure is the opportunity to begin again more intelligently.”
–Homer Simpson
“Trying is the first step towards failure.”
Take aways Carefully check if its for sure for you
Start from the queries
Chose hardware carefully
Avoid deletes
Monitor and maintain (repairs)
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
Thank you, Q&A?@mmatloka mmatloka softwaremill.com/blog