SlideShare ist ein Scribd-Unternehmen logo
1 von 41
Downloaden Sie, um offline zu lesen
Distributed Counters
            in Cassandra




Friday, August 13, 2010
I: Goal
             II: Design
            III: Implementation




            Distributed Counters in Cassandra

Friday, August 13, 2010
I: Goal




            Distributed Counters in Cassandra

Friday, August 13, 2010
Goal




       Low Latency,
       Highly Available
       Counters




            Distributed Counters in Cassandra

Friday, August 13, 2010
II: Design




            Distributed Counters in Cassandra

Friday, August 13, 2010
I: Traditional Counter Design
             II: Abstract Strategy
            III: Distributed Counter Design




            Distributed Counters in Cassandra

Friday, August 13, 2010
Design



                 I: Traditional Counter Design




            Distributed Counters in Cassandra

Friday, August 13, 2010
Traditional Counter Design
       Atomic Counters


       1. single machine
       2. one order of execution
       3. strongly consistent



            Distributed Counters in Cassandra

Friday, August 13, 2010
Traditional Counter Design
       Problems


       1. SPOF / single master
       2. high latency
       3. manually sharded



            Distributed Counters in Cassandra

Friday, August 13, 2010
Traditional Counter Design
       Question




                          What constraints can we relax?




            Distributed Counters in Cassandra

Friday, August 13, 2010
Design



               II: Abstract Strategy




            Distributed Counters in Cassandra

Friday, August 13, 2010
Abstract Strategy
       Constraints to Relax



       1. one order of execution
       2. strong consistency




            Distributed Counters in Cassandra

Friday, August 13, 2010
Abstract Strategy
       Relax: One Order of Execution



       commutative operation:
         - operations must be re-orderable



            Distributed Counters in Cassandra

Friday, August 13, 2010
Abstract Strategy
       Relax: Strong Consistency

       partitioned work:
         - each op must occur once
         - unique partition identifier
       idempotent repair:
         - recognize ops from other partitions

            Distributed Counters in Cassandra

Friday, August 13, 2010
Design



            III: Distributed Counter Design




            Distributed Counters in Cassandra

Friday, August 13, 2010
Distributed Counter Design
       Requirements


       1. commutative operation
       2. partitioned work
       3. idempotent repair



            Distributed Counters in Cassandra

Friday, August 13, 2010
Distributed Counter Design
       Commutative Operation


       addition:
         - commutative operation
         - sum ops performed by all replicas
         -a + b = b + a

            Distributed Counters in Cassandra

Friday, August 13, 2010
Distributed Counter Design
       Partitioned Work



       each op assigned to a replica:
         - every replica sums all of its ops



            Distributed Counters in Cassandra

Friday, August 13, 2010
Distributed Counter Design
       Idempotent Repair


       save counts from remote replicas:
         - keep highest count seen
       prevent multiple execution:
         - do not transfer the target replica’s count


            Distributed Counters in Cassandra

Friday, August 13, 2010
III: Implementation




            Distributed Counters in Cassandra

Friday, August 13, 2010
I: Data Structure
             II: Single Node
            III: Eventual Consistency




            Distributed Counters in Cassandra

Friday, August 13, 2010
I: Data Structure




            Distributed Counters in Cassandra

Friday, August 13, 2010
Data Structure
       Requirements


       local counts:
         - incrementally update
       remote counts:
         - independently track partitions

            Distributed Counters in Cassandra

Friday, August 13, 2010
Data Structure
       Context Format



       list of (replica id, count) tuples:
                 [(replica A, count), (replica B, count), ...]




            Distributed Counters in Cassandra

Friday, August 13, 2010
Data Structure
       Context Mutations


       local write:
         sum local count and write delta
         note: memtable



            Distributed Counters in Cassandra

Friday, August 13, 2010
Data Structure
       Context Mutations


       remote repair:
         for each replica,
         keep highest count seen
         (local or from repair)


            Distributed Counters in Cassandra

Friday, August 13, 2010
II: Single Node




            Distributed Counters in Cassandra

Friday, August 13, 2010
Single Node
       Write Path

       client
          1. construct column
             - value: delta (big-endian long)
             - clock: empty
          2. thrift: insert / batch_mutate

            Distributed Counters in Cassandra

Friday, August 13, 2010
Single Node
       Write Path

       coordinator
         1. choose partition
                          - choose target replica
                          - requirement: ConsistencyLevel.ONE
                 2. construct clock
                          - context format: [(target replica id, count delta)]


            Distributed Counters in Cassandra

Friday, August 13, 2010
Single Node
       Write Path


       target replica
       insert:
                 1. memtable does not contain column
                 2. insert column into memtable



            Distributed Counters in Cassandra

Friday, August 13, 2010
Single Node
       Write Path
       target replica
       update:
                 1. memtable contains column
                 2. retrieve existing column
                 3. create new column
                    - context: sum local count w/ delta from write
                 4. replace column in ConcurrentSkipListMap
                 5. if failed to replace column, go to step 2.


            Distributed Counters in Cassandra

Friday, August 13, 2010
Single Node
       Write Path
       Interesting Note:
       MTs are serialized to SSTs, as-is
                 - each SST encapsulates the updates
                   when it was an MT
                 - local count total must be aggregated
                   across the MT and all SSTs

            Distributed Counters in Cassandra

Friday, August 13, 2010
Single Node
       Read Path
       target replica
       read:
                 1. construct collating iterator over:
                    - frozen snapshot of MT
                    - all relevant SSTs
                 2. resolve column
                    - local counts: sum
                    - remote counts: keep max
                 3. construct value
                    - sum local and remote counts (big-endian long)

            Distributed Counters in Cassandra

Friday, August 13, 2010
Single Node
       Compaction

       replica
       compaction:
                 1. construct collating iterator over all SSTs
                 2. resolve every column in the CF
                    - local counts: sum
                    - remote counts: keep max
                 3. write out resolved CF



            Distributed Counters in Cassandra

Friday, August 13, 2010
III: Eventual Consistency




            Distributed Counters in Cassandra

Friday, August 13, 2010
Eventual Consistency
       Read Repair


       coordinator / replica
       read repair:
                 1. calculate resolved (superset) CF
                    - resolve every column (local: sum, remote: max)
                 2. return resolved CF to client




            Distributed Counters in Cassandra

Friday, August 13, 2010
Eventual Consistency
       Read Repair

       coordinator / replica
       read repair:
                 1. calculate repair CF for each replica
                    - calculate diff CF between resolved and received
                    - modify columns to remove target replica’s counts
                 2. send repair CF to each replica



            Distributed Counters in Cassandra

Friday, August 13, 2010
Eventual Consistency
       Anti-Entropy Service


       sending replica
       AES:
                 1. follow normal AES code path
                    - calculate repair SST based on shared ranges
                    - send repair SST



            Distributed Counters in Cassandra

Friday, August 13, 2010
Eventual Consistency
       Anti-Entropy Service

       receiving replica
       AES:
                 1. post-process streamed SST
                    - re-build streamed SST
                    - note: strip out local replica’s counts
                 2. remove temporary descriptor
                 3. add to SSTableTracker



            Distributed Counters in Cassandra

Friday, August 13, 2010
Questions?




            Distributed Counters in Cassandra

Friday, August 13, 2010
More Information
       Issues:
       #580: Vector Clocks
       #1072: Distributed Counters

       Related Work:
       Helland and Campbell, Building on Quicksand, CIDR (2009),
       Sections 5 & 6.


       My email address:
       kakugawa@gmail.com


            Distributed Counters in Cassandra

Friday, August 13, 2010

Weitere ähnliche Inhalte

Was ist angesagt?

Cassandra and Riak at BestBuy.com
Cassandra and Riak at BestBuy.comCassandra and Riak at BestBuy.com
Cassandra and Riak at BestBuy.comjoelcrabb
 
Cassandra at eBay - Cassandra Summit 2012
Cassandra at eBay - Cassandra Summit 2012Cassandra at eBay - Cassandra Summit 2012
Cassandra at eBay - Cassandra Summit 2012Jay Patel
 
Kafka replication apachecon_2013
Kafka replication apachecon_2013Kafka replication apachecon_2013
Kafka replication apachecon_2013Jun Rao
 
Tradeoffs in Distributed Systems Design: Is Kafka The Best? (Ben Stopford and...
Tradeoffs in Distributed Systems Design: Is Kafka The Best? (Ben Stopford and...Tradeoffs in Distributed Systems Design: Is Kafka The Best? (Ben Stopford and...
Tradeoffs in Distributed Systems Design: Is Kafka The Best? (Ben Stopford and...HostedbyConfluent
 
From Mainframe to Microservice: An Introduction to Distributed Systems
From Mainframe to Microservice: An Introduction to Distributed SystemsFrom Mainframe to Microservice: An Introduction to Distributed Systems
From Mainframe to Microservice: An Introduction to Distributed SystemsTyler Treat
 
Introduction to Cassandra
Introduction to CassandraIntroduction to Cassandra
Introduction to CassandraGokhan Atil
 
Hazelcast Distributed Lock
Hazelcast Distributed LockHazelcast Distributed Lock
Hazelcast Distributed LockJadson Santos
 
How Zillow Unlocked Kafka to 50 Teams in 8 months | Shahar Cizer Kobrinsky, Z...
How Zillow Unlocked Kafka to 50 Teams in 8 months | Shahar Cizer Kobrinsky, Z...How Zillow Unlocked Kafka to 50 Teams in 8 months | Shahar Cizer Kobrinsky, Z...
How Zillow Unlocked Kafka to 50 Teams in 8 months | Shahar Cizer Kobrinsky, Z...HostedbyConfluent
 
Introduction to Apache Cassandra
Introduction to Apache CassandraIntroduction to Apache Cassandra
Introduction to Apache CassandraRobert Stupp
 
(SDD407) Amazon DynamoDB: Data Modeling and Scaling Best Practices | AWS re:I...
(SDD407) Amazon DynamoDB: Data Modeling and Scaling Best Practices | AWS re:I...(SDD407) Amazon DynamoDB: Data Modeling and Scaling Best Practices | AWS re:I...
(SDD407) Amazon DynamoDB: Data Modeling and Scaling Best Practices | AWS re:I...Amazon Web Services
 
An overview of Neo4j Internals
An overview of Neo4j InternalsAn overview of Neo4j Internals
An overview of Neo4j InternalsTobias Lindaaker
 
나에게 맞는 AWS 데이터베이스 서비스 선택하기 :: 양승도 :: AWS Summit Seoul 2016
나에게 맞는 AWS 데이터베이스 서비스 선택하기 :: 양승도 :: AWS Summit Seoul 2016나에게 맞는 AWS 데이터베이스 서비스 선택하기 :: 양승도 :: AWS Summit Seoul 2016
나에게 맞는 AWS 데이터베이스 서비스 선택하기 :: 양승도 :: AWS Summit Seoul 2016Amazon Web Services Korea
 
JavaOne 2013: Memory Efficient Java
JavaOne 2013: Memory Efficient JavaJavaOne 2013: Memory Efficient Java
JavaOne 2013: Memory Efficient JavaChris Bailey
 
Thousands of Threads and Blocking I/O
Thousands of Threads and Blocking I/OThousands of Threads and Blocking I/O
Thousands of Threads and Blocking I/OGeorge Cao
 
Kafka Streams for Java enthusiasts
Kafka Streams for Java enthusiastsKafka Streams for Java enthusiasts
Kafka Streams for Java enthusiastsSlim Baltagi
 
HBase and HDFS: Understanding FileSystem Usage in HBase
HBase and HDFS: Understanding FileSystem Usage in HBaseHBase and HDFS: Understanding FileSystem Usage in HBase
HBase and HDFS: Understanding FileSystem Usage in HBaseenissoz
 
KSQL: Open Source Streaming for Apache Kafka
KSQL: Open Source Streaming for Apache KafkaKSQL: Open Source Streaming for Apache Kafka
KSQL: Open Source Streaming for Apache Kafkaconfluent
 
Automate Your Kafka Cluster with Kubernetes Custom Resources
Automate Your Kafka Cluster with Kubernetes Custom Resources Automate Your Kafka Cluster with Kubernetes Custom Resources
Automate Your Kafka Cluster with Kubernetes Custom Resources confluent
 

Was ist angesagt? (20)

Cassandra and Riak at BestBuy.com
Cassandra and Riak at BestBuy.comCassandra and Riak at BestBuy.com
Cassandra and Riak at BestBuy.com
 
Intro to FIS GT.M
Intro to FIS GT.MIntro to FIS GT.M
Intro to FIS GT.M
 
Cassandra at eBay - Cassandra Summit 2012
Cassandra at eBay - Cassandra Summit 2012Cassandra at eBay - Cassandra Summit 2012
Cassandra at eBay - Cassandra Summit 2012
 
Kafka replication apachecon_2013
Kafka replication apachecon_2013Kafka replication apachecon_2013
Kafka replication apachecon_2013
 
Tradeoffs in Distributed Systems Design: Is Kafka The Best? (Ben Stopford and...
Tradeoffs in Distributed Systems Design: Is Kafka The Best? (Ben Stopford and...Tradeoffs in Distributed Systems Design: Is Kafka The Best? (Ben Stopford and...
Tradeoffs in Distributed Systems Design: Is Kafka The Best? (Ben Stopford and...
 
From Mainframe to Microservice: An Introduction to Distributed Systems
From Mainframe to Microservice: An Introduction to Distributed SystemsFrom Mainframe to Microservice: An Introduction to Distributed Systems
From Mainframe to Microservice: An Introduction to Distributed Systems
 
Introduction to Cassandra
Introduction to CassandraIntroduction to Cassandra
Introduction to Cassandra
 
Hazelcast Distributed Lock
Hazelcast Distributed LockHazelcast Distributed Lock
Hazelcast Distributed Lock
 
How Zillow Unlocked Kafka to 50 Teams in 8 months | Shahar Cizer Kobrinsky, Z...
How Zillow Unlocked Kafka to 50 Teams in 8 months | Shahar Cizer Kobrinsky, Z...How Zillow Unlocked Kafka to 50 Teams in 8 months | Shahar Cizer Kobrinsky, Z...
How Zillow Unlocked Kafka to 50 Teams in 8 months | Shahar Cizer Kobrinsky, Z...
 
Introduction to Apache Cassandra
Introduction to Apache CassandraIntroduction to Apache Cassandra
Introduction to Apache Cassandra
 
(SDD407) Amazon DynamoDB: Data Modeling and Scaling Best Practices | AWS re:I...
(SDD407) Amazon DynamoDB: Data Modeling and Scaling Best Practices | AWS re:I...(SDD407) Amazon DynamoDB: Data Modeling and Scaling Best Practices | AWS re:I...
(SDD407) Amazon DynamoDB: Data Modeling and Scaling Best Practices | AWS re:I...
 
An overview of Neo4j Internals
An overview of Neo4j InternalsAn overview of Neo4j Internals
An overview of Neo4j Internals
 
나에게 맞는 AWS 데이터베이스 서비스 선택하기 :: 양승도 :: AWS Summit Seoul 2016
나에게 맞는 AWS 데이터베이스 서비스 선택하기 :: 양승도 :: AWS Summit Seoul 2016나에게 맞는 AWS 데이터베이스 서비스 선택하기 :: 양승도 :: AWS Summit Seoul 2016
나에게 맞는 AWS 데이터베이스 서비스 선택하기 :: 양승도 :: AWS Summit Seoul 2016
 
JavaOne 2013: Memory Efficient Java
JavaOne 2013: Memory Efficient JavaJavaOne 2013: Memory Efficient Java
JavaOne 2013: Memory Efficient Java
 
Thousands of Threads and Blocking I/O
Thousands of Threads and Blocking I/OThousands of Threads and Blocking I/O
Thousands of Threads and Blocking I/O
 
Kafka Streams for Java enthusiasts
Kafka Streams for Java enthusiastsKafka Streams for Java enthusiasts
Kafka Streams for Java enthusiasts
 
HBase and HDFS: Understanding FileSystem Usage in HBase
HBase and HDFS: Understanding FileSystem Usage in HBaseHBase and HDFS: Understanding FileSystem Usage in HBase
HBase and HDFS: Understanding FileSystem Usage in HBase
 
CQRS
CQRSCQRS
CQRS
 
KSQL: Open Source Streaming for Apache Kafka
KSQL: Open Source Streaming for Apache KafkaKSQL: Open Source Streaming for Apache Kafka
KSQL: Open Source Streaming for Apache Kafka
 
Automate Your Kafka Cluster with Kubernetes Custom Resources
Automate Your Kafka Cluster with Kubernetes Custom Resources Automate Your Kafka Cluster with Kubernetes Custom Resources
Automate Your Kafka Cluster with Kubernetes Custom Resources
 

Ähnlich wie Distributed Counters in Cassandra (Cassandra Summit 2010)

Summary of "Cassandra" for 3rd nosql summer reading in Tokyo
Summary of "Cassandra" for 3rd nosql summer reading in TokyoSummary of "Cassandra" for 3rd nosql summer reading in Tokyo
Summary of "Cassandra" for 3rd nosql summer reading in TokyoCLOUDIAN KK
 
TechEvent Apache Cassandra
TechEvent Apache CassandraTechEvent Apache Cassandra
TechEvent Apache CassandraTrivadis
 
Big Data & NoSQL - EFS'11 (Pavlo Baron)
Big Data & NoSQL - EFS'11 (Pavlo Baron)Big Data & NoSQL - EFS'11 (Pavlo Baron)
Big Data & NoSQL - EFS'11 (Pavlo Baron)Pavlo Baron
 
Dynamo cassandra
Dynamo cassandraDynamo cassandra
Dynamo cassandraWu Liang
 
Understanding AntiEntropy in Cassandra
Understanding AntiEntropy in CassandraUnderstanding AntiEntropy in Cassandra
Understanding AntiEntropy in CassandraJason Brown
 
Making Cassandra Perform as a Time Series Database - Cassandra Summit 15
Making Cassandra Perform as a Time Series Database - Cassandra Summit 15Making Cassandra Perform as a Time Series Database - Cassandra Summit 15
Making Cassandra Perform as a Time Series Database - Cassandra Summit 15SignalFx
 
SignalFx: Making Cassandra Perform as a Time Series Database
SignalFx: Making Cassandra Perform as a Time Series DatabaseSignalFx: Making Cassandra Perform as a Time Series Database
SignalFx: Making Cassandra Perform as a Time Series DatabaseDataStax Academy
 
The Apache Cassandra ecosystem
The Apache Cassandra ecosystemThe Apache Cassandra ecosystem
The Apache Cassandra ecosystemAlex Thompson
 
ScyllaDB: NoSQL at Ludicrous Speed
ScyllaDB: NoSQL at Ludicrous SpeedScyllaDB: NoSQL at Ludicrous Speed
ScyllaDB: NoSQL at Ludicrous SpeedJ On The Beach
 
Automatic Storage Management (ASM) metrics are a goldmine: Let's use them!
Automatic Storage Management (ASM) metrics are a goldmine: Let's use them!Automatic Storage Management (ASM) metrics are a goldmine: Let's use them!
Automatic Storage Management (ASM) metrics are a goldmine: Let's use them!BertrandDrouvot
 

Ähnlich wie Distributed Counters in Cassandra (Cassandra Summit 2010) (16)

07 problem-solving
07 problem-solving07 problem-solving
07 problem-solving
 
Summary of "Cassandra" for 3rd nosql summer reading in Tokyo
Summary of "Cassandra" for 3rd nosql summer reading in TokyoSummary of "Cassandra" for 3rd nosql summer reading in Tokyo
Summary of "Cassandra" for 3rd nosql summer reading in Tokyo
 
L09.pdf
L09.pdfL09.pdf
L09.pdf
 
TechEvent Apache Cassandra
TechEvent Apache CassandraTechEvent Apache Cassandra
TechEvent Apache Cassandra
 
Big Data & NoSQL - EFS'11 (Pavlo Baron)
Big Data & NoSQL - EFS'11 (Pavlo Baron)Big Data & NoSQL - EFS'11 (Pavlo Baron)
Big Data & NoSQL - EFS'11 (Pavlo Baron)
 
Dynamo cassandra
Dynamo cassandraDynamo cassandra
Dynamo cassandra
 
L09-handout.pdf
L09-handout.pdfL09-handout.pdf
L09-handout.pdf
 
04 reports
04 reports04 reports
04 reports
 
Understanding AntiEntropy in Cassandra
Understanding AntiEntropy in CassandraUnderstanding AntiEntropy in Cassandra
Understanding AntiEntropy in Cassandra
 
Making Cassandra Perform as a Time Series Database - Cassandra Summit 15
Making Cassandra Perform as a Time Series Database - Cassandra Summit 15Making Cassandra Perform as a Time Series Database - Cassandra Summit 15
Making Cassandra Perform as a Time Series Database - Cassandra Summit 15
 
SignalFx: Making Cassandra Perform as a Time Series Database
SignalFx: Making Cassandra Perform as a Time Series DatabaseSignalFx: Making Cassandra Perform as a Time Series Database
SignalFx: Making Cassandra Perform as a Time Series Database
 
The Apache Cassandra ecosystem
The Apache Cassandra ecosystemThe Apache Cassandra ecosystem
The Apache Cassandra ecosystem
 
06 data
06 data06 data
06 data
 
ScyllaDB: NoSQL at Ludicrous Speed
ScyllaDB: NoSQL at Ludicrous SpeedScyllaDB: NoSQL at Ludicrous Speed
ScyllaDB: NoSQL at Ludicrous Speed
 
04 Reports
04 Reports04 Reports
04 Reports
 
Automatic Storage Management (ASM) metrics are a goldmine: Let's use them!
Automatic Storage Management (ASM) metrics are a goldmine: Let's use them!Automatic Storage Management (ASM) metrics are a goldmine: Let's use them!
Automatic Storage Management (ASM) metrics are a goldmine: Let's use them!
 

Kürzlich hochgeladen

Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 

Kürzlich hochgeladen (20)

Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 

Distributed Counters in Cassandra (Cassandra Summit 2010)

  • 1. Distributed Counters in Cassandra Friday, August 13, 2010
  • 2. I: Goal II: Design III: Implementation Distributed Counters in Cassandra Friday, August 13, 2010
  • 3. I: Goal Distributed Counters in Cassandra Friday, August 13, 2010
  • 4. Goal Low Latency, Highly Available Counters Distributed Counters in Cassandra Friday, August 13, 2010
  • 5. II: Design Distributed Counters in Cassandra Friday, August 13, 2010
  • 6. I: Traditional Counter Design II: Abstract Strategy III: Distributed Counter Design Distributed Counters in Cassandra Friday, August 13, 2010
  • 7. Design I: Traditional Counter Design Distributed Counters in Cassandra Friday, August 13, 2010
  • 8. Traditional Counter Design Atomic Counters 1. single machine 2. one order of execution 3. strongly consistent Distributed Counters in Cassandra Friday, August 13, 2010
  • 9. Traditional Counter Design Problems 1. SPOF / single master 2. high latency 3. manually sharded Distributed Counters in Cassandra Friday, August 13, 2010
  • 10. Traditional Counter Design Question What constraints can we relax? Distributed Counters in Cassandra Friday, August 13, 2010
  • 11. Design II: Abstract Strategy Distributed Counters in Cassandra Friday, August 13, 2010
  • 12. Abstract Strategy Constraints to Relax 1. one order of execution 2. strong consistency Distributed Counters in Cassandra Friday, August 13, 2010
  • 13. Abstract Strategy Relax: One Order of Execution commutative operation: - operations must be re-orderable Distributed Counters in Cassandra Friday, August 13, 2010
  • 14. Abstract Strategy Relax: Strong Consistency partitioned work: - each op must occur once - unique partition identifier idempotent repair: - recognize ops from other partitions Distributed Counters in Cassandra Friday, August 13, 2010
  • 15. Design III: Distributed Counter Design Distributed Counters in Cassandra Friday, August 13, 2010
  • 16. Distributed Counter Design Requirements 1. commutative operation 2. partitioned work 3. idempotent repair Distributed Counters in Cassandra Friday, August 13, 2010
  • 17. Distributed Counter Design Commutative Operation addition: - commutative operation - sum ops performed by all replicas -a + b = b + a Distributed Counters in Cassandra Friday, August 13, 2010
  • 18. Distributed Counter Design Partitioned Work each op assigned to a replica: - every replica sums all of its ops Distributed Counters in Cassandra Friday, August 13, 2010
  • 19. Distributed Counter Design Idempotent Repair save counts from remote replicas: - keep highest count seen prevent multiple execution: - do not transfer the target replica’s count Distributed Counters in Cassandra Friday, August 13, 2010
  • 20. III: Implementation Distributed Counters in Cassandra Friday, August 13, 2010
  • 21. I: Data Structure II: Single Node III: Eventual Consistency Distributed Counters in Cassandra Friday, August 13, 2010
  • 22. I: Data Structure Distributed Counters in Cassandra Friday, August 13, 2010
  • 23. Data Structure Requirements local counts: - incrementally update remote counts: - independently track partitions Distributed Counters in Cassandra Friday, August 13, 2010
  • 24. Data Structure Context Format list of (replica id, count) tuples: [(replica A, count), (replica B, count), ...] Distributed Counters in Cassandra Friday, August 13, 2010
  • 25. Data Structure Context Mutations local write: sum local count and write delta note: memtable Distributed Counters in Cassandra Friday, August 13, 2010
  • 26. Data Structure Context Mutations remote repair: for each replica, keep highest count seen (local or from repair) Distributed Counters in Cassandra Friday, August 13, 2010
  • 27. II: Single Node Distributed Counters in Cassandra Friday, August 13, 2010
  • 28. Single Node Write Path client 1. construct column - value: delta (big-endian long) - clock: empty 2. thrift: insert / batch_mutate Distributed Counters in Cassandra Friday, August 13, 2010
  • 29. Single Node Write Path coordinator 1. choose partition - choose target replica - requirement: ConsistencyLevel.ONE 2. construct clock - context format: [(target replica id, count delta)] Distributed Counters in Cassandra Friday, August 13, 2010
  • 30. Single Node Write Path target replica insert: 1. memtable does not contain column 2. insert column into memtable Distributed Counters in Cassandra Friday, August 13, 2010
  • 31. Single Node Write Path target replica update: 1. memtable contains column 2. retrieve existing column 3. create new column - context: sum local count w/ delta from write 4. replace column in ConcurrentSkipListMap 5. if failed to replace column, go to step 2. Distributed Counters in Cassandra Friday, August 13, 2010
  • 32. Single Node Write Path Interesting Note: MTs are serialized to SSTs, as-is - each SST encapsulates the updates when it was an MT - local count total must be aggregated across the MT and all SSTs Distributed Counters in Cassandra Friday, August 13, 2010
  • 33. Single Node Read Path target replica read: 1. construct collating iterator over: - frozen snapshot of MT - all relevant SSTs 2. resolve column - local counts: sum - remote counts: keep max 3. construct value - sum local and remote counts (big-endian long) Distributed Counters in Cassandra Friday, August 13, 2010
  • 34. Single Node Compaction replica compaction: 1. construct collating iterator over all SSTs 2. resolve every column in the CF - local counts: sum - remote counts: keep max 3. write out resolved CF Distributed Counters in Cassandra Friday, August 13, 2010
  • 35. III: Eventual Consistency Distributed Counters in Cassandra Friday, August 13, 2010
  • 36. Eventual Consistency Read Repair coordinator / replica read repair: 1. calculate resolved (superset) CF - resolve every column (local: sum, remote: max) 2. return resolved CF to client Distributed Counters in Cassandra Friday, August 13, 2010
  • 37. Eventual Consistency Read Repair coordinator / replica read repair: 1. calculate repair CF for each replica - calculate diff CF between resolved and received - modify columns to remove target replica’s counts 2. send repair CF to each replica Distributed Counters in Cassandra Friday, August 13, 2010
  • 38. Eventual Consistency Anti-Entropy Service sending replica AES: 1. follow normal AES code path - calculate repair SST based on shared ranges - send repair SST Distributed Counters in Cassandra Friday, August 13, 2010
  • 39. Eventual Consistency Anti-Entropy Service receiving replica AES: 1. post-process streamed SST - re-build streamed SST - note: strip out local replica’s counts 2. remove temporary descriptor 3. add to SSTableTracker Distributed Counters in Cassandra Friday, August 13, 2010
  • 40. Questions? Distributed Counters in Cassandra Friday, August 13, 2010
  • 41. More Information Issues: #580: Vector Clocks #1072: Distributed Counters Related Work: Helland and Campbell, Building on Quicksand, CIDR (2009), Sections 5 & 6. My email address: kakugawa@gmail.com Distributed Counters in Cassandra Friday, August 13, 2010