SlideShare a Scribd company logo
CASSANDRA SF 2015
REPEATABLE, SCALABLE, RELIABLE,
OBSERVABLE CASSANDRA
Aaron Morton
@aaronmorton
Co-Founder & Principal Consultant
Licensed under a Creative Commons Attribution-NonCommercial 3.0 New Zealand License
AboutThe Last Pickle.
Work with clients to deliver and improve Apache Cassandra
based solutions.
Apache Cassandra Committer, DataStax MVP, Apache
Usergrid Committer.
Based in New Zealand,Australia, & USA.
Design
Development
Deployment
Scaleable Data Model
Use no look writes to avoid
unnecessary reads.
No Look Writes
CREATE TABLE user_visits (
user text,
day int, // YYYYMMDD
PRIMARY KEY (user, day)
);
No Look Writes
// Bad
SELECT *
FROM user_visits
WHERE user = ‘aaron’ AND day = 20150924;
INSERT INTO user_visits (user, day)
VALUES ('aaron', 20150924);
No Look Writes
// Better
INSERT INTO user_visits (user, day)
VALUES ('aaron', 20150924);
INSERT INTO user_visits (user, day)
VALUES ('aaron', 20150924);
Scaleable Data Model
Limit Partition size by
bounding it in time or space.
Limit Partition Size
// Bad
CREATE TABLE user_visits (
user text,
visit_time timestamp,
data blob, // up to 100K
PRIMARY KEY (user, visit)
);
Limit Partition Size
// Better
CREATE TABLE user_visits (
user text,
day_bucket int, // YYYYMMDD
visit_time timestamp,
data blob, // up to 100K
PRIMARY KEY ( (user, day_bucket), visit)
);
Scaleable Data Model
Avoid mixed workloads on a
single Table to reduce impact
of fragmentation.
Mixed Workloads
// Bad
CREATE TABLE user (
user text,
password text, // when password changed
last_visit timestamp, // each page request
PRIMARY KEY (user)
);
Mixed Workloads
// Better
CREATE TABLE user_password (
user text,
password text,
PRIMARY KEY (user)
);
CREATE TABLE user_last_visit (
user text,
last_visit timestamp,
PRIMARY KEY (user)
);
Scaleable Data Model
Use
LeveledCompactionStrategy
when overwrites or
Tombstones.
Use LCS for Overwrites
CREATE TABLE user_visits (
user text,
day int, // YYYYMMDD
PRIMARY KEY (user, day)
)
WITH
COMPACTION =
{
'class' : 'LeveledCompactionStrategy'
};
Scaleable Data Model
Create parallel data models so
throughput increases with
node count.
Parallel Data Models
// Bad
CREATE TABLE hotel_price (
checkin_day int, // YYYYMMDD
hotel_name text,
price_data blob,
PRIMARY KEY (checkin_day, hotel_name)
);
Parallel Data Models
// Better
CREATE TABLE hotel_price (
checkin_day int, // YYYYMMDD
city text,
hotel_name text,
price_data blob,
PRIMARY KEY ( (checkin_day, city), hotel_name)
);
Scaleable Data Model
Use concurrent asynchronous
requests to complete tasks.
Concurrent Asynchronous Requests
CREATE TABLE hotel_price (
checkin_day int, // YYYYMMDD
city text,
hotel_name text,
price_data blob,
PRIMARY KEY ( (checkin_day, city), hotel_name)
);
Concurrent Asynchronous Requests
// request for cities concurrently
SELECT *
FROM hotel_price
WHERE checkin_day = 20150924 AND city = 'Santa Clara';
SELECT *
FROM hotel_price
WHERE checkin_day = 20150924 AND city = 'San Jose';
Scaleable Data Model
Document when Eventual
Consistency, Strong
Consistency or Linerizable
Consistency is required.
Scaleable Data Model
Smoke Test the data model.
Data Model SmokeTest
/*
* Get Pricing Data
*/
// Load Data
INSERT INTO city_distances (city, distance, nearby_city)
VALUES ('Santa Clara', 0, 'Santa Clara');
INSERT INTO city_distances (city, distance, nearby_city)
VALUES ('Santa Clara', 1, 'San Jose');
INSERT INTO hotel_price (checkin_day, city, hotel_name, price_data)
VALUES (20150924, 'Santa Clara', 'Hilton Santa Clara', 0xFF);
INSERT INTO hotel_price (checkin_day, city, hotel_name, price_data)
VALUES (20150924, 'San Jose', 'Hyatt San Jose', 0xFF);
Data Model SmokeTest
// Step 1
// Get the near by cities for the one selected by the user
SELECT nearby_city
FROM city_distances
WHERE city = 'Santa Clara' and distance < 2;
// Step 2
// Parallel requests for each city returned.
SELECT city, hotel_name, price_data
FROM hotel_price
WHERE checkin_day = 20150924 AND city = 'Santa Clara';
SELECT city, hotel_name, price_data
FROM hotel_price
WHERE checkin_day = 20150924 AND city = 'San Jose';
Design
Development
Deployment
Application Development
Ensure read requests are
bound and know what the size
is.
(hint: use auto-paging in 2.0)
Auto Paging
PreparedStatement prepStmt = session.prepare(CQL);
BoundStatement boundStmt = new
BoundStatement(prepStmt);
boundStatement.setFetchSize(100)
Application Development
Use appropriate Consistency
Level.
(see Data Model Smoke Test)
Application Development
Use Token Aware
Asynchronous requests with
CL ONE where possible.
Token Aware Policy
cluster = Cluster.builder()
.addContactPoints("10.10.10.10")
.withLoadBalancingPolicy(new TokenAwarePolicy(
new DCAwareRoundRobinPolicy(“DC1”)))
.build()
Asynchronous Requests
ResultSetFuture f = ses.executeAsync(stmt.bind("fo"));
Row row = f.getUninterruptibly().one();
Application Development
Avoid DDOS’ing the cluster.
Monitoring and Alerting
Use what you like and what
works for you.
Monitoring and Alerting
Some suggestions: OpsCentre,
Riemann, Grafana, Log Stash,
Sensu.
HowTo Monitor
Cluster wide aggregate.
All nodes (if possible).
Top 3 & Bottom 3 Nodes.
Individual Nodes.
HowTo Monitor Rates
1 Minute Rate
Derivative of Counts
HowTo Monitor Latency
75th Percentile
95th Percentile
99th Percentile
Monitoring ClusterThroughput
.o.a.c.m.ClientRequest.
Write.Latency.1MinuteRate
Read.Latency.1MinuteRate
Monitoring LocalTableThroughput
.o.a.c.m.ColumnFamily.
KEYSPACE.TABLE.WriteLatency.1MinuteRate
KEYSPACE.TABLE.ReadLatency.1MinuteRate
Monitoring Request Latency
.o.a.c.m.ClientRequest.
Write.Latency.75percentile
Write.Latency.95percentile
Write.Latency.99percentile
Read.Latency.75percentile…
Monitoring Request Latency PerTable
.o.a.c.m.ColumnFamily.
KEYSPACE.TABLE.CoordinatorWriteLatency.
95percentile
KEYSPACE.TABLE.CoordinatorReadLatency.
95percentile
Monitoring LocalTable Latency
.o.a.c.m.ColumnFamily.
KEYSPACE.TABLE.WriteLatency.95percentile
KEYSPACE.TABLE.ReadLatency.95percentile
Monitoring Read Path
.o.a.c.m.ColumnFamily.KEYSPACE.TABLE.
LiveScannedHistogram.95percentile
TombstoneScannedHistogram.95percentile
SSTablesPerReadHistogram.95percentile
Monitoring Inconsistency
.o.a.c.m.
Storage.TotalHints.count
HintedHandOffManager.
Hints_created-IP_ADDRESS.count
.o.a.c.m.Connection.TotalTimeouts.
1MinuteRate
Monitoring Eventual Consistency
.o.a.c.m.
ReadRepair.RepairedBackground.
1MinuteRate
ReadRepair.RepairedBlocking.1MinuteRate
Monitoring Client Errors
.o.a.c.m.ClientRequest.
Write.Unavailables.1MinuteRate
Read.Unavailables.1MinuteRate
Write.Timeouts.1MinuteRate
Read.Timeouts.1MinuteRate
Monitoring Errors
.o.a.c.m.
Storage.Exceptions.count
Monitoring Disk Usage
.o.a.c.m.
Storage.Load.count
ColumnFamily.KEYSPACE.TABLE.
TotalDiskSpaceUsed.count
Monitoring Pending Compactions
.o.a.c.m.
Compaction.PendingTasks.value
ColumnFamily.KEYSPACE.TABLE.PendingCompactions
.value
Compaction.TotalCompactionsCompleted.
1MinuteRate
Monitoring Node Performance
.o.a.c.m.ThreadPools.request.
MutationStage.PendingTasks.value
ReadStage.PendingTasks.value
ReplicateOnWriteStage.PendingTasks.value
RequestResponseStage.PendingTasks.value
Monitoring Node Performance
.o.a.c.m.DroppedMessage.
MUTATION.Dropped.1MinuteRate
READ.Dropped.1MinuteRate
Design
Development
Provisioning
SmokeTests
“preliminary testing to reveal
simple failures severe enough
to reject a prospective
software release.”
Disk SmokeTests
“Disk Latency and Other
Random Numbers”
Al Toby
http://tobert.github.io/post/2014-11-13-slides-disk-
latency-and-other-random-numbers.html
Cassandra SmokeTest
cassandra-stress write cl=quorum -schema replication(factor=3)
-mode native prepared cql3
cassandra-stress read cl=quorum -mode native prepared cql3
cassandra-stress mixed cl=quorum ratio(read=1,write=4)
-mode native prepared cql3
Run Books
Plan now.
Run Books
Why are we doing this?
What are we doing?
How will we do it?
Fire Drills
Practice now.
Fire Drill: ShortTerm Single Node Failure
Down for less than Hint Window.
Available for QUORUM.
No action necessary on return.
Fire Drill: ShortTerm Multi Node Failure (Break the cluster)
Down for less than Hint Window.
Available for ONE (maybe).
Repair on return.
Fire Drill:Availability Zone / Rack Partition
Down for less than Hint Window.
Available for QUORUM.
Maybe repair on return.
Fire Drill: MediumTerm Single Node Failure
Down between Hint Window and
gc_grace_seconds.
Available for QUORUM.
Repair on return.
Fire Drill: LongTerm Single Node Failure
Down longer than
gc_grace_seconds.
Available for QUORUM.
Replace node.
Fire Drill: Rolling Upgrade
Repeated short term failure.
Available for QUORUM.
Fire Drill: Scale Up
Repeated short term failure.
Available for QUORUM.
Fire Drill: Scale Out
Available for ALL.
Thanks.
Aaron Morton
@aaronmorton
Co-Founder & Principal Consultant
www.thelastpickle.com

More Related Content

PDF
Reltio: Powering Enterprise Data-driven Applications with Cassandra
PDF
Battery Ventures: Simulating and Visualizing Large Scale Cassandra Deployments
PDF
Lambda at Weather Scale - Cassandra Summit 2015
PDF
Proofpoint: Fraud Detection and Security on Social Media
PPTX
Data Modeling Basics for the Cloud with DataStax
PDF
British Gas Connected Homes: Data Engineering
PDF
Webinar | How Clear Capital Delivers Always-on Appraisals on 122 Million Prop...
PDF
Data Pipelines with Spark & DataStax Enterprise
Reltio: Powering Enterprise Data-driven Applications with Cassandra
Battery Ventures: Simulating and Visualizing Large Scale Cassandra Deployments
Lambda at Weather Scale - Cassandra Summit 2015
Proofpoint: Fraud Detection and Security on Social Media
Data Modeling Basics for the Cloud with DataStax
British Gas Connected Homes: Data Engineering
Webinar | How Clear Capital Delivers Always-on Appraisals on 122 Million Prop...
Data Pipelines with Spark & DataStax Enterprise

What's hot (20)

PDF
codecentric AG: CQRS and Event Sourcing Applications with Cassandra
PDF
Capital One: Using Cassandra In Building A Reporting Platform
PDF
Azure + DataStax Enterprise Powers Office 365 Per User Store
PDF
Managing Cassandra Databases with OpenStack Trove
PDF
GumGum: Multi-Region Cassandra in AWS
PPTX
Cassandra Community Webinar: MySQL to Cassandra - What I Wish I'd Known
PPTX
Making Every Drop Count: How i20 Addresses the Water Crisis with the IoT and ...
PPTX
Webinar | Building Apps with the Cassandra Python Driver
PPT
Reporting from the Trenches: Intuit & Cassandra
PDF
Macy's: Changing Engines in Mid-Flight
PDF
Going native with Apache Cassandra
PPTX
DataStax C*ollege Credit: What and Why NoSQL?
PDF
Real-time personal trainer on the SMACK stack
PDF
Cassandra 2.0 to 2.1
PPTX
Webinar: Dyn + DataStax - helping companies deliver exceptional end-user expe...
PPTX
Webinar: Get On-Demand Education Anytime, Anywhere with Coursera and DataStax
PPTX
Webinar: ROI on Big Data - RDBMS, NoSQL or Both? A Simple Guide for Knowing H...
PPTX
Productizing a Cassandra-Based Solution (Brij Bhushan Ravat, Ericsson) | C* S...
PDF
Cassandra Summit 2014: Apache Cassandra Best Practices at Ebay
PDF
Workshop - How to benchmark your database
codecentric AG: CQRS and Event Sourcing Applications with Cassandra
Capital One: Using Cassandra In Building A Reporting Platform
Azure + DataStax Enterprise Powers Office 365 Per User Store
Managing Cassandra Databases with OpenStack Trove
GumGum: Multi-Region Cassandra in AWS
Cassandra Community Webinar: MySQL to Cassandra - What I Wish I'd Known
Making Every Drop Count: How i20 Addresses the Water Crisis with the IoT and ...
Webinar | Building Apps with the Cassandra Python Driver
Reporting from the Trenches: Intuit & Cassandra
Macy's: Changing Engines in Mid-Flight
Going native with Apache Cassandra
DataStax C*ollege Credit: What and Why NoSQL?
Real-time personal trainer on the SMACK stack
Cassandra 2.0 to 2.1
Webinar: Dyn + DataStax - helping companies deliver exceptional end-user expe...
Webinar: Get On-Demand Education Anytime, Anywhere with Coursera and DataStax
Webinar: ROI on Big Data - RDBMS, NoSQL or Both? A Simple Guide for Knowing H...
Productizing a Cassandra-Based Solution (Brij Bhushan Ravat, Ericsson) | C* S...
Cassandra Summit 2014: Apache Cassandra Best Practices at Ebay
Workshop - How to benchmark your database
Ad

Viewers also liked (17)

PDF
DataStax: Testing Cassandra Guarantees Under Diverse Failure Modes With Jepsen
PDF
AdStage: Monacella: An Relational Object Database using Cassandra as the Data...
PDF
MyDrive Solutions: Case Study: Troubleshooting Production Issues as a Developer.
PDF
DataStax: The Cassandra Validation Harness: Achieving More Stable Releases
PDF
Silicon Valley Data Science: From Oracle to Cassandra with Spark
PDF
Monitoring Cassandra: Don't Miss a Thing (Alain Rodriguez, The Last Pickle) |...
PDF
AddThis: Scaling Cassandra up and down into containers with ZFS
PDF
The Best and Worst of Cassandra-stress Tool (Christopher Batey, The Last Pick...
PDF
Stratio: Geospatial and bitemporal search in Cassandra with pluggable Lucene ...
PDF
DataStax: A deep look at the CQL WHERE clause
PDF
SKB Kontur: Digging Cassandra cluster
PDF
Cisco: Cassandra adoption on Cisco UCS & OpenStack
PDF
Cassandra 3.0 Data Modeling
PPTX
An Overview of Apache Cassandra
PDF
PagerDuty: Span the WAN? Yes you can!
PDF
Tesora: Managing Cassandra Databases with OpenStack Trove
PDF
Restlet: Building a multi-tenant API PaaS with DataStax Enterprise Search
DataStax: Testing Cassandra Guarantees Under Diverse Failure Modes With Jepsen
AdStage: Monacella: An Relational Object Database using Cassandra as the Data...
MyDrive Solutions: Case Study: Troubleshooting Production Issues as a Developer.
DataStax: The Cassandra Validation Harness: Achieving More Stable Releases
Silicon Valley Data Science: From Oracle to Cassandra with Spark
Monitoring Cassandra: Don't Miss a Thing (Alain Rodriguez, The Last Pickle) |...
AddThis: Scaling Cassandra up and down into containers with ZFS
The Best and Worst of Cassandra-stress Tool (Christopher Batey, The Last Pick...
Stratio: Geospatial and bitemporal search in Cassandra with pluggable Lucene ...
DataStax: A deep look at the CQL WHERE clause
SKB Kontur: Digging Cassandra cluster
Cisco: Cassandra adoption on Cisco UCS & OpenStack
Cassandra 3.0 Data Modeling
An Overview of Apache Cassandra
PagerDuty: Span the WAN? Yes you can!
Tesora: Managing Cassandra Databases with OpenStack Trove
Restlet: Building a multi-tenant API PaaS with DataStax Enterprise Search
Ad

Similar to The Last Pickle: Repeatable, Scalable, Reliable, Observable: Cassandra (20)

PDF
DN 2017 | Reducing pain in data engineering | Martin Loetzsch | Project A
PDF
[WSO2Con Asia 2018] Patterns for Building Streaming Apps
PDF
Data Exploration with Apache Drill: Day 2
PPTX
Introduction to WSO2 Data Analytics Platform
PDF
fundamentalsofeventdrivenmicroservices11728489736099.pdf
PDF
Project A Data Modelling Best Practices Part II: How to Build a Data Warehouse?
PDF
[WSO2Con EU 2017] Streaming Analytics Patterns for Your Digital Enterprise
PDF
Scalable And Incremental Data Profiling With Spark
PPTX
Presentation
PDF
Data Mining with SQL Server 2005
PDF
Application Metrics - IPC2023
PPTX
Spark + Cassandra = Real Time Analytics on Operational Data
PDF
Azure Streaming Analytics: A comprehensive Guide.
PDF
Data infrastructure for the other 90% of companies
PDF
Application metrics with Prometheus - DPC18
PPTX
Presentation_BigData_NenaMarin
PDF
Application metrics - Confoo 2019
PPTX
Mastering MapReduce: MapReduce for Big Data Management and Analysis
PDF
Building Analytics Applications with Streaming Expressions in Apache Solr - A...
PDF
Streaming Solr - Activate 2018 talk
DN 2017 | Reducing pain in data engineering | Martin Loetzsch | Project A
[WSO2Con Asia 2018] Patterns for Building Streaming Apps
Data Exploration with Apache Drill: Day 2
Introduction to WSO2 Data Analytics Platform
fundamentalsofeventdrivenmicroservices11728489736099.pdf
Project A Data Modelling Best Practices Part II: How to Build a Data Warehouse?
[WSO2Con EU 2017] Streaming Analytics Patterns for Your Digital Enterprise
Scalable And Incremental Data Profiling With Spark
Presentation
Data Mining with SQL Server 2005
Application Metrics - IPC2023
Spark + Cassandra = Real Time Analytics on Operational Data
Azure Streaming Analytics: A comprehensive Guide.
Data infrastructure for the other 90% of companies
Application metrics with Prometheus - DPC18
Presentation_BigData_NenaMarin
Application metrics - Confoo 2019
Mastering MapReduce: MapReduce for Big Data Management and Analysis
Building Analytics Applications with Streaming Expressions in Apache Solr - A...
Streaming Solr - Activate 2018 talk

More from DataStax Academy (20)

PDF
Forrester CXNYC 2017 - Delivering great real-time cx is a true craft
PPTX
Introduction to DataStax Enterprise Graph Database
PPTX
Introduction to DataStax Enterprise Advanced Replication with Apache Cassandra
PPTX
Cassandra on Docker @ Walmart Labs
PPTX
Cassandra Adoption on Cisco UCS & Open stack
PDF
Data Modeling for Apache Cassandra
PDF
Coursera Cassandra Driver
PDF
Production Ready Cassandra
PDF
Cassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & Python
PPTX
Cassandra @ Sony: The good, the bad, and the ugly part 1
PPTX
Cassandra @ Sony: The good, the bad, and the ugly part 2
PDF
Standing Up Your First Cluster
PDF
Real Time Analytics with Dse
PDF
Introduction to Data Modeling with Apache Cassandra
PDF
Cassandra Core Concepts
PPTX
Enabling Search in your Cassandra Application with DataStax Enterprise
PPTX
Bad Habits Die Hard
PDF
Advanced Data Modeling with Apache Cassandra
PDF
Advanced Cassandra
PDF
Apache Cassandra and Drivers
Forrester CXNYC 2017 - Delivering great real-time cx is a true craft
Introduction to DataStax Enterprise Graph Database
Introduction to DataStax Enterprise Advanced Replication with Apache Cassandra
Cassandra on Docker @ Walmart Labs
Cassandra Adoption on Cisco UCS & Open stack
Data Modeling for Apache Cassandra
Coursera Cassandra Driver
Production Ready Cassandra
Cassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & Python
Cassandra @ Sony: The good, the bad, and the ugly part 1
Cassandra @ Sony: The good, the bad, and the ugly part 2
Standing Up Your First Cluster
Real Time Analytics with Dse
Introduction to Data Modeling with Apache Cassandra
Cassandra Core Concepts
Enabling Search in your Cassandra Application with DataStax Enterprise
Bad Habits Die Hard
Advanced Data Modeling with Apache Cassandra
Advanced Cassandra
Apache Cassandra and Drivers

Recently uploaded (20)

PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
Big Data Technologies - Introduction.pptx
PDF
Encapsulation theory and applications.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
cuic standard and advanced reporting.pdf
PDF
Getting Started with Data Integration: FME Form 101
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
Assigned Numbers - 2025 - Bluetooth® Document
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Big Data Technologies - Introduction.pptx
Encapsulation theory and applications.pdf
20250228 LYD VKU AI Blended-Learning.pptx
cuic standard and advanced reporting.pdf
Getting Started with Data Integration: FME Form 101
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Encapsulation_ Review paper, used for researhc scholars
Per capita expenditure prediction using model stacking based on satellite ima...
Dropbox Q2 2025 Financial Results & Investor Presentation
Mobile App Security Testing_ A Comprehensive Guide.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Accuracy of neural networks in brain wave diagnosis of schizophrenia
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Building Integrated photovoltaic BIPV_UPV.pdf

The Last Pickle: Repeatable, Scalable, Reliable, Observable: Cassandra