SlideShare a Scribd company logo
CASSANDRA COMMUNITY WEBINARS AUGUST 2013
CASSANDRA
INTERNALS
Aaron Morton
@aaronmorton
Co-Founder & Principal Consultant
www.thelastpickle.com
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,
Hector Maintainer, 6+ years combined
Cassandra experience.
Based in New Zealand & Austin,TX.
Architecture
Code
www.thelastpickle.com
Cassandra Architecture
API's
Cluster Aware
Cluster Unaware
Clients
Disk
www.thelastpickle.com
Cassandra Cluster Architecture
API's
Cluster Aware
Cluster Unaware
Clients
Disk
API's
Cluster Aware
Cluster Unaware
Disk
Node 1 Node 2
www.thelastpickle.com
Dynamo Cluster Architecture
API's
Dynamo
Database
Clients
Disk
API's
Dynamo
Database
Disk
Node 1 Node 2
www.thelastpickle.com
Architecture
API
Dynamo
Database
www.thelastpickle.com
APITransports
Thrift
Native Binary
www.thelastpickle.com
ThriftTransport
//Custom TServer implementations
o.a.c.thrift.CustomTThreadPoolServer
o.a.c.thrift.CustomTNonBlockingServer
o.a.c.thrift.CustomTHsHaServer
www.thelastpickle.com
APITransports
Thrift
Native Binary
www.thelastpickle.com
Native BinaryTransport
Beta in Cassandra 1.2
Uses Netty
Enabled with
start_native_transport
(Disabled by default)
www.thelastpickle.com
o.a.c.transport.Server.run()
//Setup the Netty server
new ExecutionHandler()
new NioServerSocketChannelFactory()
ServerBootstrap.setPipelineFactory()
www.thelastpickle.com
o.a.c.transport.Message.Dispatcher.messageReceived()
//Process message from client
ServerConnection.validateNewMessage()
Request.execute()
ServerConnection.applyStateTransition()
Channel.write()
www.thelastpickle.com
Messages
Defined in the Native Binary
Protocol
$SRC/doc/native_protocol.spec
www.thelastpickle.com
API Services
JMX
Thrift
CQL 3
www.thelastpickle.com
JMX Management Beans
Spread around the code base.
Interfaces named *MBean
www.thelastpickle.com
JMX Management Beans
Registered with names such as
org.apache.cassandra.db:
type=StorageProxy
www.thelastpickle.com
API Services
JMX
Thrift
CQL 3
www.thelastpickle.com
o.a.c.thrift.CassandraServer
// Implements Thrift Interface
// Access control
// Input validation
// Mapping to/from Thrift and internal types
www.thelastpickle.com
Thrift Interface
Thrift IDL
$SRC/interface/cassandra.thrift
www.thelastpickle.com
o.a.c.thrift.CassandraServer.get_slice()
// get columns for one row
Tracing.begin()
ClientState cState = state()
cState.hasColumnFamilyAccess()
multigetSliceInternal()
www.thelastpickle.com
CassandraServer.multigetSliceInternal()
// get columns for may rows
ThriftValidation.validate*()
// Create ReadCommands
getSlice()
www.thelastpickle.com
CassandraServer.getSlice()
// Process ReadCommands
// return Thrift types
readColumnFamily()
thriftifyColumnFamily()
www.thelastpickle.com
CassandraServer.readColumnFamily()
// Process ReadCommands
// Return ColumnFamilies
StorageProxy.read()
www.thelastpickle.com
API Services
JMX
Thrift
CQL 3
www.thelastpickle.com
o.a.c.cql3.QueryProcessor
// Prepares and executes CQL3 statements
// Used by Thrift & Native transports
// Access control
// Input validation
// Returns transport.ResultMessage
www.thelastpickle.com
CQL3 Grammar
ANTLR Grammar
$SRC/o.a.c.cql3/Cql.g
www.thelastpickle.com
o.a.c.cql3.statements.ParsedStatement
// Subclasses generated by ANTLR
// Tracks bound term count
// Prepare CQLStatement
prepare()
www.thelastpickle.com
o.a.c.cql3.statements.CQLStatement
checkAccess(ClientState state)
validate(ClientState state)
execute(ConsistencyLevel cl,
QueryState state,
List<ByteBuffer> variables)
www.thelastpickle.com
statements.SelectStatement.RawStatement
// Implements ParsedStatement
// Input validation
prepare()
www.thelastpickle.com
statements.SelectStatement.execute()
// Create ReadCommands
StorageProxy.read()
www.thelastpickle.com
Architecture
API
Dynamo
Database
www.thelastpickle.com
Dynamo Layer
o.a.c.service
o.a.c.net
o.a.c.dht
o.a.c.gms
o.a.c.locator
o.a.c.stream
www.thelastpickle.com
o.a.c.service.StorageProxy
// Cluster wide storage operations
// Select endpoints & check CL available
// Send messages to Stages
// Wait for response
// Store Hints
www.thelastpickle.com
o.a.c.service.StorageService
// Ring operations
// Track ring state
// Start & stop ring membership
// Node & token queries
www.thelastpickle.com
o.a.c.service.IResponseResolver
preprocess(MessageIn<T> message)
resolve() throws
DigestMismatchException
RowDigestResolver
RowDataResolver
RangeSliceResponseResolver
www.thelastpickle.com
Response Handlers / Callback
implements IAsyncCallback<T>
response(MessageIn<T> msg)
www.thelastpickle.com
o.a.c.service.ReadCallback.get()
//Wait for blockfor & data
condition.await(timeout,
TimeUnit.MILLISECONDS)
throw ReadTimeoutException()
resolver.resolve()
www.thelastpickle.com
o.a.c.service.StorageProxy.fetchRows()
getLiveSortedEndpoints()
new RowDigestResolver()
new ReadCallback()
MessagingService.sendRR()
---------------------------------------
ReadCallback.get() # blocking
catch (DigestMismatchException ex)
catch (ReadTimeoutException ex)
www.thelastpickle.com
Dynamo Layer
o.a.c.service
o.a.c.net
o.a.c.dht
o.a.c.gms
o.a.c.locator
o.a.c.stream
www.thelastpickle.com
o.a.c.net.MessagingService.verb<<enum>>
MUTATION
READ
REQUEST_RESPONSE
TREE_REQUEST
TREE_RESPONSE
(And more...)
www.thelastpickle.com
o.a.c.net.MessagingService.verbHandlers
new EnumMap<Verb,
IVerbHandler>(Verb.class)
www.thelastpickle.com
o.a.c.net.IVerbHandler<T>
doVerb(MessageIn<T> message,
String id);
www.thelastpickle.com
o.a.c.net.MessagingService.verbStages
new EnumMap<MessagingService.Verb,
Stage>(MessagingService.Verb.class)
www.thelastpickle.com
o.a.c.net.MessagingService.receive()
runnable = new MessageDeliveryTask(
message, id, timestamp);
StageManager.getStage(
message.getMessageType());
stage.execute(runnable);
www.thelastpickle.com
o.a.c.net.MessageDeliveryTask.run()
// If dropable and rpc_timeout
MessagingService.incrementDroppedMessag
es(verb);
MessagingService.getVerbHandler(verb)
verbHandler.doVerb(message, id)
www.thelastpickle.com
Architecture
API Layer
Dynamo Layer
Database Layer
www.thelastpickle.com
Database Layer
o.a.c.concurrent
o.a.c.db
o.a.c.cache
o.a.c.io
o.a.c.trace
www.thelastpickle.com
o.a.c.concurrent.StageManager
stages = new EnumMap<Stage,
ThreadPoolExecutor>(Stage.class);
getStage(Stage stage)
www.thelastpickle.com
o.a.c.concurrent.Stage
READ
MUTATION
GOSSIP
REQUEST_RESPONSE
ANTI_ENTROPY
(And more...)
www.thelastpickle.com
Database Layer
o.a.c.concurrent
o.a.c.db
o.a.c.cache
o.a.c.io
o.a.c.trace
www.thelastpickle.com
o.a.c.db.Table
// Keyspace
open(String table)
getColumnFamilyStore(String cfName)
getRow(QueryFilter filter)
apply(RowMutation mutation,
boolean writeCommitLog)
www.thelastpickle.com
o.a.c.db.ColumnFamilyStore
// Column Family
getColumnFamily(QueryFilter filter)
getTopLevelColumns(...)
apply(DecoratedKey key,
ColumnFamily columnFamily,
SecondaryIndexManager.Updater
indexer)
www.thelastpickle.com
o.a.c.db.IColumnContainer
addColumn(IColumn column)
remove(ByteBuffer columnName)
ColumnFamily
SuperColumn
www.thelastpickle.com
o.a.c.db.ISortedColumns
addColumn(IColumn column,
Allocator allocator)
removeColumn(ByteBuffer name)
ArrayBackedSortedColumns
AtomicSortedColumns
TreeMapBackedSortedColumns
www.thelastpickle.com
o.a.c.db.Memtable
put(DecoratedKey key,
ColumnFamily columnFamily,
SecondaryIndexManager.Updater
indexer)
flushAndSignal(CountDownLatch latch,
Future<ReplayPosition>
context)
www.thelastpickle.com
o.a.c.db.ReadCommand
getRow(Table table)
SliceByNamesReadCommand
SliceFromReadCommand
www.thelastpickle.com
o.a.c.db.IDiskAtomFilter
getMemtableColumnIterator(...)
getSSTableColumnIterator(...)
IdentityQueryFilter
NamesQueryFilter
SliceQueryFilter
www.thelastpickle.com
Summary
CustomTThreadPoolServer Message.Dispatcher
CassandraServer QueryProcessor
ReadCommand
StorageProxy
IResponseResolver
IAsyncCallback
MessagingService
IVerbHandler
Table ColumnFamilyStore IDiskAtomFilter
API
Dynamo
Database
www.thelastpickle.com
Thanks.
www.thelastpickle.com
Aaron Morton
@aaronmorton
Co-Founder & Principal Consultant
www.thelastpickle.com
Licensed under a Creative Commons Attribution-NonCommercial 3.0 New Zealand License

More Related Content

PDF
Optimizing Your Cluster with Coordinator Nodes (Eric Lubow, SimpleReach) | Ca...
PPTX
Cassandra Summit 2015: Intro to DSE Search
PDF
Cassandra and Spark
PDF
Introduction to cassandra 2014
PPTX
Hecuba2: Cassandra Operations Made Easy (Radovan Zvoncek, Spotify) | C* Summi...
PPTX
Real time data pipeline with spark streaming and cassandra with mesos
PDF
Lessons from Cassandra & Spark (Matthias Niehoff & Stephan Kepser, codecentri...
PDF
Laying down the smack on your data pipelines
Optimizing Your Cluster with Coordinator Nodes (Eric Lubow, SimpleReach) | Ca...
Cassandra Summit 2015: Intro to DSE Search
Cassandra and Spark
Introduction to cassandra 2014
Hecuba2: Cassandra Operations Made Easy (Radovan Zvoncek, Spotify) | C* Summi...
Real time data pipeline with spark streaming and cassandra with mesos
Lessons from Cassandra & Spark (Matthias Niehoff & Stephan Kepser, codecentri...
Laying down the smack on your data pipelines

What's hot (20)

PPTX
Using Spark to Load Oracle Data into Cassandra
PPTX
C*ollege Credit: CEP Distribtued Processing on Cassandra with Storm
PDF
A Cassandra + Solr + Spark Love Triangle Using DataStax Enterprise
PDF
Building large-scale analytics platform with Storm, Kafka and Cassandra - NYC...
PDF
Maximum Overdrive: Tuning the Spark Cassandra Connector (Russell Spitzer, Dat...
PDF
The Best and Worst of Cassandra-stress Tool (Christopher Batey, The Last Pick...
PDF
Spark Streaming with Cassandra
PDF
Owning time series with team apache Strata San Jose 2015
PPTX
DataStax: An Introduction to DataStax Enterprise Search
PDF
Spark Cassandra Connector: Past, Present, and Future
PDF
Bulk Loading Data into Cassandra
PDF
Feeding Cassandra with Spark-Streaming and Kafka
PPTX
What We Learned About Cassandra While Building go90 (Christopher Webster & Th...
PDF
Time series with apache cassandra strata
PDF
Spark with Cassandra by Christopher Batey
PDF
Cassandra Day SV 2014: Netflix’s Astyanax Java Client Driver for Apache Cassa...
PPTX
Cassandra Metrics
PDF
Cassandra and Spark: Optimizing for Data Locality
PDF
How We Used Cassandra/Solr to Build Real-Time Analytics Platform
PDF
Time series with Apache Cassandra - Long version
Using Spark to Load Oracle Data into Cassandra
C*ollege Credit: CEP Distribtued Processing on Cassandra with Storm
A Cassandra + Solr + Spark Love Triangle Using DataStax Enterprise
Building large-scale analytics platform with Storm, Kafka and Cassandra - NYC...
Maximum Overdrive: Tuning the Spark Cassandra Connector (Russell Spitzer, Dat...
The Best and Worst of Cassandra-stress Tool (Christopher Batey, The Last Pick...
Spark Streaming with Cassandra
Owning time series with team apache Strata San Jose 2015
DataStax: An Introduction to DataStax Enterprise Search
Spark Cassandra Connector: Past, Present, and Future
Bulk Loading Data into Cassandra
Feeding Cassandra with Spark-Streaming and Kafka
What We Learned About Cassandra While Building go90 (Christopher Webster & Th...
Time series with apache cassandra strata
Spark with Cassandra by Christopher Batey
Cassandra Day SV 2014: Netflix’s Astyanax Java Client Driver for Apache Cassa...
Cassandra Metrics
Cassandra and Spark: Optimizing for Data Locality
How We Used Cassandra/Solr to Build Real-Time Analytics Platform
Time series with Apache Cassandra - Long version
Ad

Viewers also liked (20)

PPTX
Understanding How CQL3 Maps to Cassandra's Internal Data Structure
PDF
Cassandra Community Webinar | Become a Super Modeler
PPTX
Don't Let Your Shoppers Drop; 5 Rules for Today’s eCommerce
PPTX
Webinar: Dyn + DataStax - helping companies deliver exceptional end-user expe...
PPTX
Webinar: Eventual Consistency != Hopeful Consistency
PPTX
Cassandra Community Webinar: Back to Basics with CQL3
PPTX
Webinar: Don't Leave Your Data in the Dark
PPTX
How much money do you lose every time your ecommerce site goes down?
PPTX
Webinar | Introducing DataStax Enterprise 4.6
PDF
Webinar | How Clear Capital Delivers Always-on Appraisals on 122 Million Prop...
PPTX
Webinar: ROI on Big Data - RDBMS, NoSQL or Both? A Simple Guide for Knowing H...
PDF
Cassandra Community Webinar | In Case of Emergency Break Glass
PPT
Webinar: 2 Billion Data Points Each Day
PPT
Webinar: Getting Started with Apache Cassandra
PPTX
Webinar | From Zero to 1 Million with Google Cloud Platform and DataStax
PDF
Cassandra TK 2014 - Large Nodes
PDF
Cassandra Community Webinar | Practice Makes Perfect: Extreme Cassandra Optim...
PPTX
Cassandra Community Webinar | Make Life Easier - An Introduction to Cassandra...
PPTX
Don’t Get Caught in a PCI Pickle: Meet Compliance and Protect Payment Card Da...
PPTX
Webinar: Building Blocks for the Future of Television
Understanding How CQL3 Maps to Cassandra's Internal Data Structure
Cassandra Community Webinar | Become a Super Modeler
Don't Let Your Shoppers Drop; 5 Rules for Today’s eCommerce
Webinar: Dyn + DataStax - helping companies deliver exceptional end-user expe...
Webinar: Eventual Consistency != Hopeful Consistency
Cassandra Community Webinar: Back to Basics with CQL3
Webinar: Don't Leave Your Data in the Dark
How much money do you lose every time your ecommerce site goes down?
Webinar | Introducing DataStax Enterprise 4.6
Webinar | How Clear Capital Delivers Always-on Appraisals on 122 Million Prop...
Webinar: ROI on Big Data - RDBMS, NoSQL or Both? A Simple Guide for Knowing H...
Cassandra Community Webinar | In Case of Emergency Break Glass
Webinar: 2 Billion Data Points Each Day
Webinar: Getting Started with Apache Cassandra
Webinar | From Zero to 1 Million with Google Cloud Platform and DataStax
Cassandra TK 2014 - Large Nodes
Cassandra Community Webinar | Practice Makes Perfect: Extreme Cassandra Optim...
Cassandra Community Webinar | Make Life Easier - An Introduction to Cassandra...
Don’t Get Caught in a PCI Pickle: Meet Compliance and Protect Payment Card Da...
Webinar: Building Blocks for the Future of Television
Ad

Similar to Cassandra Community Webinar: Apache Cassandra Internals (8)

PDF
C* Summit EU 2013: Cassandra Internals
PDF
Cassandra SF 2013 - Cassandra Internals
PDF
Apache Con NA 2013 - Cassandra Internals
PDF
Apache Cassandra in Bangalore - Cassandra Internals and Performance
PDF
Cassandra 2.1 boot camp, Overview
PDF
Cassandra Community Webinar August 29th 2013 - In Case Of Emergency, Break Glass
PDF
NYC Cassandra Day - Java Intro
PDF
Cassandra: Not Just NoSQL, It's MoSQL
C* Summit EU 2013: Cassandra Internals
Cassandra SF 2013 - Cassandra Internals
Apache Con NA 2013 - Cassandra Internals
Apache Cassandra in Bangalore - Cassandra Internals and Performance
Cassandra 2.1 boot camp, Overview
Cassandra Community Webinar August 29th 2013 - In Case Of Emergency, Break Glass
NYC Cassandra Day - Java Intro
Cassandra: Not Just NoSQL, It's MoSQL

More from DataStax (20)

PPTX
Is Your Enterprise Ready to Shine This Holiday Season?
PPTX
Designing Fault-Tolerant Applications with DataStax Enterprise and Apache Cas...
PPTX
Running DataStax Enterprise in VMware Cloud and Hybrid Environments
PPTX
Best Practices for Getting to Production with DataStax Enterprise Graph
PPTX
Webinar | Data Management for Hybrid and Multi-Cloud: A Four-Step Journey
PPTX
Webinar | How to Understand Apache Cassandra™ Performance Through Read/Writ...
PDF
Webinar | Better Together: Apache Cassandra and Apache Kafka
PDF
Top 10 Best Practices for Apache Cassandra and DataStax Enterprise
PDF
Introduction to Apache Cassandra™ + What’s New in 4.0
PPTX
Webinar: How Active Everywhere Database Architecture Accelerates Hybrid Cloud...
PPTX
Webinar | Aligning GDPR Requirements with Today's Hybrid Cloud Realities
PDF
Designing a Distributed Cloud Database for Dummies
PDF
How to Power Innovation with Geo-Distributed Data Management in Hybrid Cloud
PDF
How to Evaluate Cloud Databases for eCommerce
PPTX
Webinar: DataStax Enterprise 6: 10 Ways to Multiply the Power of Apache Cassa...
PPTX
Webinar: DataStax and Microsoft Azure: Empowering the Right-Now Enterprise wi...
PPTX
Webinar - Real-Time Customer Experience for the Right-Now Enterprise featurin...
PPTX
Datastax - The Architect's guide to customer experience (CX)
PPTX
An Operational Data Layer is Critical for Transformative Banking Applications
PPTX
Becoming a Customer-Centric Enterprise Via Real-Time Data and Design Thinking
Is Your Enterprise Ready to Shine This Holiday Season?
Designing Fault-Tolerant Applications with DataStax Enterprise and Apache Cas...
Running DataStax Enterprise in VMware Cloud and Hybrid Environments
Best Practices for Getting to Production with DataStax Enterprise Graph
Webinar | Data Management for Hybrid and Multi-Cloud: A Four-Step Journey
Webinar | How to Understand Apache Cassandra™ Performance Through Read/Writ...
Webinar | Better Together: Apache Cassandra and Apache Kafka
Top 10 Best Practices for Apache Cassandra and DataStax Enterprise
Introduction to Apache Cassandra™ + What’s New in 4.0
Webinar: How Active Everywhere Database Architecture Accelerates Hybrid Cloud...
Webinar | Aligning GDPR Requirements with Today's Hybrid Cloud Realities
Designing a Distributed Cloud Database for Dummies
How to Power Innovation with Geo-Distributed Data Management in Hybrid Cloud
How to Evaluate Cloud Databases for eCommerce
Webinar: DataStax Enterprise 6: 10 Ways to Multiply the Power of Apache Cassa...
Webinar: DataStax and Microsoft Azure: Empowering the Right-Now Enterprise wi...
Webinar - Real-Time Customer Experience for the Right-Now Enterprise featurin...
Datastax - The Architect's guide to customer experience (CX)
An Operational Data Layer is Critical for Transformative Banking Applications
Becoming a Customer-Centric Enterprise Via Real-Time Data and Design Thinking

Recently uploaded (20)

PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Big Data Technologies - Introduction.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Encapsulation theory and applications.pdf
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Cloud computing and distributed systems.
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Network Security Unit 5.pdf for BCA BBA.
Big Data Technologies - Introduction.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
The AUB Centre for AI in Media Proposal.docx
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Encapsulation theory and applications.pdf
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Diabetes mellitus diagnosis method based random forest with bat algorithm
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Programs and apps: productivity, graphics, security and other tools
Dropbox Q2 2025 Financial Results & Investor Presentation
Mobile App Security Testing_ A Comprehensive Guide.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Cloud computing and distributed systems.
Advanced methodologies resolving dimensionality complications for autism neur...
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...

Cassandra Community Webinar: Apache Cassandra Internals