SlideShare a Scribd company logo
Apache Cassandra
Best Practices
Ben Slater, Chief Product Officer, Instaclustr
March 2017
Agenda
• Cassandra - a very brief introduction + glossary
• Best practices
• Design approach
• Partitioning
• Tombstones
• Compaction Strategies
• Security
• Testing
• How Instaclustr can help
2
Quick introduction to Cassandra
3
Design Approach
• Phase 1: Understand the data
• Define the data domain: E-R logical model
• Define the required access patterns: how will you select an update data?
• Phase 2: Denormalize based on access patterns
• Identify primary access entities: driven by the access keys
• Allocate secondary entities: denormalize by pushing up or down to the primary entities
• Phase 3: Review & tune
• Review partition keys and clusters
• Do partition keys have sufficient cardinality?
• Is the number of records in each partition bounded?
• Does the design consider delete and update impact?
• Test & tune: check updates, review compaction strategy
4
Partitioning
5
Partitioning: Diagnosing & Correcting
• Diagnosing
• Many issues can be identified from data model review
• nodetool cfstats / tablestats and cfhistograms provide partition size info.
<10MB green, <100MB amber
• Log file warnings - compacting large partition
• Overlarge partitions will also show up through long GC pauses and
difficulty streaming data to new nodes
• Correcting
• Correcting generally requires data model change although depending on
the application, application level change may be possible
• ic-tools can help by providing info about partition keys of large partitions
6
Tombstones
• When a row is deleted in C* it is marked with a tombstone (virtual delete).
Tombstones remain in the sstables for at least 10 days by default.
• A high ratio of tombstones to live data can have significant negative
performance impacts
• Be wary of tombstones when: deleting data, updating with nulls or updating
collection data types.
• Diagnosing
– nodetool cfstats/cfhistograms and log file warnings
– slow read queries, sudden performance issues after a bulk delete
• Correcting
– tune compaction strategy - LCS or TWCS can help in the right
circumstances
– reduce GC grace period & force compaction for emergencies
– review data model design to reduce deletes within a partition
7
Compaction Intro
8
• Cassandra never updates files once
written to disk
• Instead all inserts and updates are
essentially written as transaction logs
that are reconstituted when read
• Compaction is the process of
consolidating transaction logs to
simplify reads
• It’s an ongoing background process in
Cassandra
• Compaction ≠ Compression
Compaction Strategies
• Compaction strategies determine which files Cassandra picks to compact
and when
• Three compaction strategies are supported: Size Tiered Compaction
Strategy, Levelled Compaction Strategy, Time Windowed Compaction
Strategy (technically Data Tiered also exists but deprecated)
• Diagnosing
• Slower than desired reads, old data being retained on disk
• nodetool cfstats sstables per read state (ideally 1 or 2 sstables on average)
• Correcting
• Rule of thumb: if using STCS with issues, look at LCS
• Compaction strategy can be changed online but can result in significant load due to
recompaction
• Can use jmx to update strategy on one node at a time before changing schema
• Can use write survey mode to test changes in write overhead
9
Security
• At a minimum
• Enable password auth
• Enable client->server encryption (particularly if using public IPs
to connect)
• Enable internode encryption
• Don’t use the default Cassandra user
• Best practice
• Encrypt sensitive data at the client
• Works well with typical C* access patterns where PK values are hashed
anyway
• Dates are the most common case of range selects and typically are not
sensitive if other identifying data is encrypted
10
• Long running tests with background load are vital
• Can run extremely high write loads for an hour or two but might take days to catch up on
compactions
• Don’t forget repairs
• Make sure your data volumes on disk are representative as well as
read/write ops - cache hit rates can make a big difference to performance
• Mirror production data demographics as closely as possible (eg partition
size)
• Don’t forget to include update/delete workload if applicable
• For core cassandra features, can test on reduce size and rely on scale-up
but beware:
• Secondary indexes
• MVs
11
Testing Cassandra applications
How Instaclustr can help
• Managed Service
• Gives you a proven, best practice configured
Cassandra cluster in < ½ hour
• AWS, Azure, GCP and SoftLayer
• Security configuration with tick of a check box
• Cluster health page for automated best practice
checks
• Customer monitoring UI & ongoing monitoring &
response by our Ops Team
• Consulting
• Cluster health reviews
• Data model & Cassandra application design
assistance
• Enterprise Support
• Support from our Managed Service tech-ops
team where you run your own cluster
12
Questions?
Ben Slater
Chief Product Officer
ben.slater@instaclustr.com
info@instaclustr.com www.instaclustr.com @instaclustr

More Related Content

What's hot (19)

PDF
Advanced Operations
DataStax Academy
 
PDF
Tuning Speculative Retries to Fight Latency (Michael Figuiere, Minh Do, Netfl...
DataStax
 
PPTX
Maintaining Consistency Across Data Centers (Randy Fradin, BlackRock) | Cassa...
DataStax
 
PPT
Webinar: Getting Started with Apache Cassandra
DataStax
 
PDF
Cassandra Summit 2014: Monitor Everything!
DataStax Academy
 
PPTX
How to size up an Apache Cassandra cluster (Training)
DataStax Academy
 
PDF
Cassandra Day Atlanta 2015: Diagnosing Problems in Production
DataStax Academy
 
PPTX
Building a Multi-Region Cluster at Target (Aaron Ploetz, Target) | Cassandra ...
DataStax
 
PDF
Seattle Cassandra Meetup - HasOffers
btoddb
 
PDF
A glimpse of cassandra 4.0 features netflix
Vinay Kumar Chella
 
PDF
Cassandra CLuster Management by Japan Cassandra Community
Hiromitsu Komatsu
 
PPTX
Load testing Cassandra applications
Ben Slater
 
PDF
Micro-batching: High-performance Writes (Adam Zegelin, Instaclustr) | Cassand...
DataStax
 
PPTX
Tales From the Field: The Wrong Way of Using Cassandra (Carlos Rolo, Pythian)...
DataStax
 
PPTX
Processing 50,000 events per second with Cassandra and Spark
Ben Slater
 
PPTX
Apache Cassandra at the Geek2Geek Berlin
Christian Johannsen
 
PDF
Scylla Summit 2016: Outbrain Case Study - Lowering Latency While Doing 20X IO...
ScyllaDB
 
PDF
Apache Cassandra in the Real World
Jeremy Hanna
 
PPTX
Everyday I’m scaling... Cassandra
Instaclustr
 
Advanced Operations
DataStax Academy
 
Tuning Speculative Retries to Fight Latency (Michael Figuiere, Minh Do, Netfl...
DataStax
 
Maintaining Consistency Across Data Centers (Randy Fradin, BlackRock) | Cassa...
DataStax
 
Webinar: Getting Started with Apache Cassandra
DataStax
 
Cassandra Summit 2014: Monitor Everything!
DataStax Academy
 
How to size up an Apache Cassandra cluster (Training)
DataStax Academy
 
Cassandra Day Atlanta 2015: Diagnosing Problems in Production
DataStax Academy
 
Building a Multi-Region Cluster at Target (Aaron Ploetz, Target) | Cassandra ...
DataStax
 
Seattle Cassandra Meetup - HasOffers
btoddb
 
A glimpse of cassandra 4.0 features netflix
Vinay Kumar Chella
 
Cassandra CLuster Management by Japan Cassandra Community
Hiromitsu Komatsu
 
Load testing Cassandra applications
Ben Slater
 
Micro-batching: High-performance Writes (Adam Zegelin, Instaclustr) | Cassand...
DataStax
 
Tales From the Field: The Wrong Way of Using Cassandra (Carlos Rolo, Pythian)...
DataStax
 
Processing 50,000 events per second with Cassandra and Spark
Ben Slater
 
Apache Cassandra at the Geek2Geek Berlin
Christian Johannsen
 
Scylla Summit 2016: Outbrain Case Study - Lowering Latency While Doing 20X IO...
ScyllaDB
 
Apache Cassandra in the Real World
Jeremy Hanna
 
Everyday I’m scaling... Cassandra
Instaclustr
 

Viewers also liked (19)

PDF
Intro to Open Source Hardware (OSHW)
Drew Fustini
 
PDF
Indexing in Cassandra
Ed Anuff
 
KEY
Introduction to Cassandra: Replication and Consistency
Benjamin Black
 
PPTX
The school of life public talk
Ivan Figueroa-Otero
 
PDF
7 Steps to Digital Marketing
Digital Giants
 
PPTX
Computador
camatias
 
PDF
Le marché des ITS en Russie 2017
Business France (Export)
 
PPT
Hoe we kunnen zorgen dat iedereen profiteert van robotisering | ConferentieSo...
Matthijs Pontier
 
PPTX
Ortografia a l’aula i arreu
Joanprofe
 
PDF
Cli in the browser
Mani Sarkar
 
PDF
FJWilson Talent Services and the Institution of Civil Engineers
FJWilson Talent Services
 
PPTX
[DE] Keynote: Die Zukunft der elektronischen Archivierung | Dr. Ulrich Kampff...
PROJECT CONSULT Unternehmensberatung Dr. Ulrich Kampffmeyer GmbH
 
PPTX
Quelles changements de vision dans la cyber sécurité en 2017 ? - ADN OUEST, s...
Quentin Adam
 
PDF
ゆるふわJava8入門
dcubeio
 
PDF
The Federalist Newsletter with Arsenal history story - March 2017
U.S. Army Watervliet Arsenal
 
PPTX
6 things people want from their business leader
WorkInConfidence
 
PPTX
The Rise of Bots – Talk at GeoBeer #15, March 2017
Ralph Straumann
 
PDF
Staying Afloat with Buoy: A High-Performance HTTP Client
lpgauth
 
PPTX
Latest Status of Identity Federation
Atsushi Kambara
 
Intro to Open Source Hardware (OSHW)
Drew Fustini
 
Indexing in Cassandra
Ed Anuff
 
Introduction to Cassandra: Replication and Consistency
Benjamin Black
 
The school of life public talk
Ivan Figueroa-Otero
 
7 Steps to Digital Marketing
Digital Giants
 
Computador
camatias
 
Le marché des ITS en Russie 2017
Business France (Export)
 
Hoe we kunnen zorgen dat iedereen profiteert van robotisering | ConferentieSo...
Matthijs Pontier
 
Ortografia a l’aula i arreu
Joanprofe
 
Cli in the browser
Mani Sarkar
 
FJWilson Talent Services and the Institution of Civil Engineers
FJWilson Talent Services
 
[DE] Keynote: Die Zukunft der elektronischen Archivierung | Dr. Ulrich Kampff...
PROJECT CONSULT Unternehmensberatung Dr. Ulrich Kampffmeyer GmbH
 
Quelles changements de vision dans la cyber sécurité en 2017 ? - ADN OUEST, s...
Quentin Adam
 
ゆるふわJava8入門
dcubeio
 
The Federalist Newsletter with Arsenal history story - March 2017
U.S. Army Watervliet Arsenal
 
6 things people want from their business leader
WorkInConfidence
 
The Rise of Bots – Talk at GeoBeer #15, March 2017
Ralph Straumann
 
Staying Afloat with Buoy: A High-Performance HTTP Client
lpgauth
 
Latest Status of Identity Federation
Atsushi Kambara
 
Ad

Similar to Instaclustr Apache Cassandra Best Practices & Toubleshooting (20)

PPTX
Lessons Learned From Running 1800 Clusters (Brooke Jensen, Instaclustr) | Cas...
DataStax
 
PPTX
Migrating from a Relational Database to Cassandra: Why, Where, When and How
Anant Corporation
 
PDF
Moving from a Relational Database to Cassandra: Why, Where, When, and How
Anant Corporation
 
PPTX
Performance tuning - A key to successful cassandra migration
Ramkumar Nottath
 
PDF
Infosys Ltd: Performance Tuning - A Key to Successful Cassandra Migration
DataStax Academy
 
PPTX
Cassandra in Operation
niallmilton
 
PDF
Netflix at-disney-09-26-2014
Monal Daxini
 
PPT
Real world capacity
Edward Capriolo
 
PPTX
Datastax / Cassandra Modeling Strategies
Anant Corporation
 
PPTX
DataStax & Cassandra Data Modeling Strategies
Anant Corporation
 
PDF
Diagnosing Problems in Production - Cassandra
Jon Haddad
 
PDF
Cassandra Day Chicago 2015: Diagnosing Problems in Production
DataStax Academy
 
PDF
Cassandra Day London 2015: Diagnosing Problems in Production
DataStax Academy
 
PDF
An Introduction to Apache Cassandra
Saeid Zebardast
 
PDF
Cassandra Day Chicago 2015: Top 5 Tips/Tricks with Apache Cassandra and DSE
DataStax Academy
 
PDF
Five Lessons in Distributed Databases
jbellis
 
PPTX
Cassandra & Python - Springfield MO User Group
Adam Hutson
 
PDF
A Deep Dive into Apache Cassandra for .NET Developers
Luke Tillman
 
PDF
Diagnosing Problems in Production (Nov 2015)
Jon Haddad
 
Lessons Learned From Running 1800 Clusters (Brooke Jensen, Instaclustr) | Cas...
DataStax
 
Migrating from a Relational Database to Cassandra: Why, Where, When and How
Anant Corporation
 
Moving from a Relational Database to Cassandra: Why, Where, When, and How
Anant Corporation
 
Performance tuning - A key to successful cassandra migration
Ramkumar Nottath
 
Infosys Ltd: Performance Tuning - A Key to Successful Cassandra Migration
DataStax Academy
 
Cassandra in Operation
niallmilton
 
Netflix at-disney-09-26-2014
Monal Daxini
 
Real world capacity
Edward Capriolo
 
Datastax / Cassandra Modeling Strategies
Anant Corporation
 
DataStax & Cassandra Data Modeling Strategies
Anant Corporation
 
Diagnosing Problems in Production - Cassandra
Jon Haddad
 
Cassandra Day Chicago 2015: Diagnosing Problems in Production
DataStax Academy
 
Cassandra Day London 2015: Diagnosing Problems in Production
DataStax Academy
 
An Introduction to Apache Cassandra
Saeid Zebardast
 
Cassandra Day Chicago 2015: Top 5 Tips/Tricks with Apache Cassandra and DSE
DataStax Academy
 
Five Lessons in Distributed Databases
jbellis
 
Cassandra & Python - Springfield MO User Group
Adam Hutson
 
A Deep Dive into Apache Cassandra for .NET Developers
Luke Tillman
 
Diagnosing Problems in Production (Nov 2015)
Jon Haddad
 
Ad

More from Instaclustr (17)

PDF
Apache Cassandra Community Health
Instaclustr
 
PDF
Instaclustr webinar 50,000 transactions per second with Apache Spark on Apach...
Instaclustr
 
PDF
Micro-batching: High-performance writes
Instaclustr
 
PPTX
Processing 50,000 events per second with Cassandra and Spark
Instaclustr
 
PPTX
Load Testing Cassandra Applications
Instaclustr
 
PDF
Cassandra-as-a-Service
Instaclustr
 
PDF
Cassandra Front Lines
Instaclustr
 
PDF
Multi-Region Cassandra Clusters
Instaclustr
 
PDF
Cassandra Bootstap from Backups
Instaclustr
 
PDF
Migrating to Cassandra
Instaclustr
 
PDF
Cassandra on Docker
Instaclustr
 
PDF
Securing Cassandra
Instaclustr
 
PDF
Apache Cassandra Management
Instaclustr
 
PDF
Apache Cassandra in the Cloud
Instaclustr
 
PDF
Introduction to Apache Cassandra
Instaclustr
 
PDF
Cassandra Bootstrap from Backups
Instaclustr
 
PDF
Development Nirvana with Cassandra
Instaclustr
 
Apache Cassandra Community Health
Instaclustr
 
Instaclustr webinar 50,000 transactions per second with Apache Spark on Apach...
Instaclustr
 
Micro-batching: High-performance writes
Instaclustr
 
Processing 50,000 events per second with Cassandra and Spark
Instaclustr
 
Load Testing Cassandra Applications
Instaclustr
 
Cassandra-as-a-Service
Instaclustr
 
Cassandra Front Lines
Instaclustr
 
Multi-Region Cassandra Clusters
Instaclustr
 
Cassandra Bootstap from Backups
Instaclustr
 
Migrating to Cassandra
Instaclustr
 
Cassandra on Docker
Instaclustr
 
Securing Cassandra
Instaclustr
 
Apache Cassandra Management
Instaclustr
 
Apache Cassandra in the Cloud
Instaclustr
 
Introduction to Apache Cassandra
Instaclustr
 
Cassandra Bootstrap from Backups
Instaclustr
 
Development Nirvana with Cassandra
Instaclustr
 

Recently uploaded (20)

DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PDF
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PDF
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 

Instaclustr Apache Cassandra Best Practices & Toubleshooting

  • 1. Apache Cassandra Best Practices Ben Slater, Chief Product Officer, Instaclustr March 2017
  • 2. Agenda • Cassandra - a very brief introduction + glossary • Best practices • Design approach • Partitioning • Tombstones • Compaction Strategies • Security • Testing • How Instaclustr can help 2
  • 3. Quick introduction to Cassandra 3
  • 4. Design Approach • Phase 1: Understand the data • Define the data domain: E-R logical model • Define the required access patterns: how will you select an update data? • Phase 2: Denormalize based on access patterns • Identify primary access entities: driven by the access keys • Allocate secondary entities: denormalize by pushing up or down to the primary entities • Phase 3: Review & tune • Review partition keys and clusters • Do partition keys have sufficient cardinality? • Is the number of records in each partition bounded? • Does the design consider delete and update impact? • Test & tune: check updates, review compaction strategy 4
  • 6. Partitioning: Diagnosing & Correcting • Diagnosing • Many issues can be identified from data model review • nodetool cfstats / tablestats and cfhistograms provide partition size info. <10MB green, <100MB amber • Log file warnings - compacting large partition • Overlarge partitions will also show up through long GC pauses and difficulty streaming data to new nodes • Correcting • Correcting generally requires data model change although depending on the application, application level change may be possible • ic-tools can help by providing info about partition keys of large partitions 6
  • 7. Tombstones • When a row is deleted in C* it is marked with a tombstone (virtual delete). Tombstones remain in the sstables for at least 10 days by default. • A high ratio of tombstones to live data can have significant negative performance impacts • Be wary of tombstones when: deleting data, updating with nulls or updating collection data types. • Diagnosing – nodetool cfstats/cfhistograms and log file warnings – slow read queries, sudden performance issues after a bulk delete • Correcting – tune compaction strategy - LCS or TWCS can help in the right circumstances – reduce GC grace period & force compaction for emergencies – review data model design to reduce deletes within a partition 7
  • 8. Compaction Intro 8 • Cassandra never updates files once written to disk • Instead all inserts and updates are essentially written as transaction logs that are reconstituted when read • Compaction is the process of consolidating transaction logs to simplify reads • It’s an ongoing background process in Cassandra • Compaction ≠ Compression
  • 9. Compaction Strategies • Compaction strategies determine which files Cassandra picks to compact and when • Three compaction strategies are supported: Size Tiered Compaction Strategy, Levelled Compaction Strategy, Time Windowed Compaction Strategy (technically Data Tiered also exists but deprecated) • Diagnosing • Slower than desired reads, old data being retained on disk • nodetool cfstats sstables per read state (ideally 1 or 2 sstables on average) • Correcting • Rule of thumb: if using STCS with issues, look at LCS • Compaction strategy can be changed online but can result in significant load due to recompaction • Can use jmx to update strategy on one node at a time before changing schema • Can use write survey mode to test changes in write overhead 9
  • 10. Security • At a minimum • Enable password auth • Enable client->server encryption (particularly if using public IPs to connect) • Enable internode encryption • Don’t use the default Cassandra user • Best practice • Encrypt sensitive data at the client • Works well with typical C* access patterns where PK values are hashed anyway • Dates are the most common case of range selects and typically are not sensitive if other identifying data is encrypted 10
  • 11. • Long running tests with background load are vital • Can run extremely high write loads for an hour or two but might take days to catch up on compactions • Don’t forget repairs • Make sure your data volumes on disk are representative as well as read/write ops - cache hit rates can make a big difference to performance • Mirror production data demographics as closely as possible (eg partition size) • Don’t forget to include update/delete workload if applicable • For core cassandra features, can test on reduce size and rely on scale-up but beware: • Secondary indexes • MVs 11 Testing Cassandra applications
  • 12. How Instaclustr can help • Managed Service • Gives you a proven, best practice configured Cassandra cluster in < ½ hour • AWS, Azure, GCP and SoftLayer • Security configuration with tick of a check box • Cluster health page for automated best practice checks • Customer monitoring UI & ongoing monitoring & response by our Ops Team • Consulting • Cluster health reviews • Data model & Cassandra application design assistance • Enterprise Support • Support from our Managed Service tech-ops team where you run your own cluster 12