SlideShare uma empresa Scribd logo
1 de 29
Baixar para ler offline
Deep Into Data Repair
Mechanisms

Cassandra Paris Meetup
@XebiaFR

12/2013

Clément Lardeur
About me

Software Engineer (Full Stack Developer)
-Cassandra Trainer, Certified Developer
-@ClemLardeur

clardeur
Summary
● Hinted Handoff
● Read Repair
● Anti-entropy repair node
Hinted Handoff
Goals
1. Offer full write availability when consistency is not
required = Extreme write availability
2. Improves response consistency after temporary
outages such as network failures = Repair data

hinted_handoff_enabled : (Default: true)
Hinted Handoff
How it works

RF: 3
1
Replica 1

Coordinator
6

2

Store a hint

Write Request

5

3
Replica 2
4
Replica 3
Hinted Handoff
The coordinator store a hint, when
A replica node for the row is either known to be down
ahead of time.

OR
A replica node for the row does not respond to the write
request.
Hinted Handoff
Hints are replayed, when

A node is making alive by the Gossiper

OR
The node checks every ten minutes for any hints for
writes that timed out during an outage too brief for the
failure detector to notice through gossip
Hinted Handoff
system.hints
Hinted Handoff
system.hints
● target_id : node ID concerned by the hint
● hint_id : hint ID (with a timestamp)
● message_version : internal message service version
● mutation : the actual data being written
Hinted Handoff
Hint TTL
● max_hint_window_in_ms : default 10800000 = 3H
Hinted Handoff
Hint optimizations
● max_hint_delivery_threads : default 2
Need to be increased for multiple DC

● hinted_handoff_throttle_in_kb : default 1024
(Maximum throttle in KBs per second, per delivery thread)
Hinted Handoff
Key points
● Hinted handoff is enabled by default
● Hinted handoff is an optional part of write
● Hinted handoff is an optimization
● Hints have a TTL
● Hints are uncorrelated to consistency level
Read Repair
Goals
1. Ensure that all replicas have the most recent
version of frequently-read data.
2. Anti-entropy real-time mechanism.

read_repair_chance : (Default: 0.1)
Read Repair
Global read setup
● Determine replicas to invoke
○ ConsistencyLevel vs Read Repair

● First data node respond with full data set,
others send digest
● Coordinator waits for ConsistencyLevel
Read Repair
Consistent reads - algorithm
● Compare digests
● If any mismatch
○ re-request to same nodes (full data set)
○ compare full data sets, send update
○ block until out-of-date replicas respond

● Return merged data set to the client
Read Repair
How it works

RF: 2
1
Replica 1

Coordinator
up-to-date

1

ou

Read Request

Re
ad

ConsistencyLevel.QUORUM

t-o

f-d

ate

rep

air
r

eq

ue

-da
-to

up

st
3

te

5

2

Replica 2
4
Read Repair
The coordinator send a read repair, when
A replica node for the row has responded an out-of-date
value.

OR
The read repair chance declared on the column family is
activated.
Read Repair
Read repair configuration
● read_repair_chance : Default to 0.1
● dclocal_read_repair_chance : Default to 0.0

Configured by Column Family (Table)
Read Repair
Key points
● Consistent read is a part of read request
● Read repair is a probability to sync data
● Read repair is configured by column family
● Read repair can be Local DC or Global
Anti-entropy repair node
Goals
1. Ensures that all data on a replica is made
consistent.
2. Repair inconsistencies on a node that has been
down for a while.

nodetool repair <keyspace> [table] <opts>
Anti-entropy repair node
Nodetool repair, when
During normal operation as part of regular, scheduled
cluster maintenance.

OR
During node recovery after a failure or on a node that
has been down for a while.

OR
On nodes that contains data that is not read frequently.
Anti-entropy repair node
How it works
● Determine peers nodes with matching ranges.
● Triggers a major (validation) compaction on peers.
○

i.e. do the read part of the compaction stage

● Read and generate the Merkle Tree on each peer.
● Initiator awaits trees from peers.
● Compare every trees to every other trees.
● If any differences, the differing nodes exchange
conflicting ranges.
Anti-entropy repair node
Top Hash

Merkle Tree
Hash
0

Hash
1

Hash
0-0

Hash
0-1

Hash
1-0

Hash
1-1

Partition
Data 1

Partition
Data 2

Partition
Data 3

Partition
Data 4
Anti-entropy repair node
Cautious
● Building the Merkle Tree is disk I/O and CPU intensive
○ due to validation compaction

● Overstreaming occurs
○ due to the streaming of partitions
Anti-entropy repair node
Options
●

-pr (--partitioner-range) : repairs only the main partition
range for that node
Use -pr for periodic repair maintenance, and execute
repair on each node.
Don’t use -pr for a recovering node because other
replicas for that node need to be repaired too.
Anti-entropy repair node
Options
● -snapshot : only one replica at a time do
computation => make sequential repairs.
Always use -snapshot to avoid overloading the
targeted node and it’s replica.

● Since 2.0.2, sequential repair is the default behavior.
○ renamed to -par (for parallel)
Anti-entropy repair node
Options
● -st : start token
● -et : end token

$ nodetool repair -st <start_token> -et <end_token>
Completely eliminates the overstreaming (subrange repair)
Anti-entropy repair node
Key points
● Use nodetool repair as a maintenance task
● Use nodetool repair cautiously
● Use relevant options when needed
Thank you !

Q & A time

@ClemLardeur

Mais conteúdo relacionado

Último

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Último (20)

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
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
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
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
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
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 

Destaque

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Destaque (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Deep into Cassandra data repair mechanisms

  • 1. Deep Into Data Repair Mechanisms Cassandra Paris Meetup @XebiaFR 12/2013 Clément Lardeur
  • 2. About me Software Engineer (Full Stack Developer) -Cassandra Trainer, Certified Developer -@ClemLardeur clardeur
  • 3. Summary ● Hinted Handoff ● Read Repair ● Anti-entropy repair node
  • 4. Hinted Handoff Goals 1. Offer full write availability when consistency is not required = Extreme write availability 2. Improves response consistency after temporary outages such as network failures = Repair data hinted_handoff_enabled : (Default: true)
  • 5. Hinted Handoff How it works RF: 3 1 Replica 1 Coordinator 6 2 Store a hint Write Request 5 3 Replica 2 4 Replica 3
  • 6. Hinted Handoff The coordinator store a hint, when A replica node for the row is either known to be down ahead of time. OR A replica node for the row does not respond to the write request.
  • 7. Hinted Handoff Hints are replayed, when A node is making alive by the Gossiper OR The node checks every ten minutes for any hints for writes that timed out during an outage too brief for the failure detector to notice through gossip
  • 9. Hinted Handoff system.hints ● target_id : node ID concerned by the hint ● hint_id : hint ID (with a timestamp) ● message_version : internal message service version ● mutation : the actual data being written
  • 10. Hinted Handoff Hint TTL ● max_hint_window_in_ms : default 10800000 = 3H
  • 11. Hinted Handoff Hint optimizations ● max_hint_delivery_threads : default 2 Need to be increased for multiple DC ● hinted_handoff_throttle_in_kb : default 1024 (Maximum throttle in KBs per second, per delivery thread)
  • 12. Hinted Handoff Key points ● Hinted handoff is enabled by default ● Hinted handoff is an optional part of write ● Hinted handoff is an optimization ● Hints have a TTL ● Hints are uncorrelated to consistency level
  • 13. Read Repair Goals 1. Ensure that all replicas have the most recent version of frequently-read data. 2. Anti-entropy real-time mechanism. read_repair_chance : (Default: 0.1)
  • 14. Read Repair Global read setup ● Determine replicas to invoke ○ ConsistencyLevel vs Read Repair ● First data node respond with full data set, others send digest ● Coordinator waits for ConsistencyLevel
  • 15. Read Repair Consistent reads - algorithm ● Compare digests ● If any mismatch ○ re-request to same nodes (full data set) ○ compare full data sets, send update ○ block until out-of-date replicas respond ● Return merged data set to the client
  • 16. Read Repair How it works RF: 2 1 Replica 1 Coordinator up-to-date 1 ou Read Request Re ad ConsistencyLevel.QUORUM t-o f-d ate rep air r eq ue -da -to up st 3 te 5 2 Replica 2 4
  • 17. Read Repair The coordinator send a read repair, when A replica node for the row has responded an out-of-date value. OR The read repair chance declared on the column family is activated.
  • 18. Read Repair Read repair configuration ● read_repair_chance : Default to 0.1 ● dclocal_read_repair_chance : Default to 0.0 Configured by Column Family (Table)
  • 19. Read Repair Key points ● Consistent read is a part of read request ● Read repair is a probability to sync data ● Read repair is configured by column family ● Read repair can be Local DC or Global
  • 20. Anti-entropy repair node Goals 1. Ensures that all data on a replica is made consistent. 2. Repair inconsistencies on a node that has been down for a while. nodetool repair <keyspace> [table] <opts>
  • 21. Anti-entropy repair node Nodetool repair, when During normal operation as part of regular, scheduled cluster maintenance. OR During node recovery after a failure or on a node that has been down for a while. OR On nodes that contains data that is not read frequently.
  • 22. Anti-entropy repair node How it works ● Determine peers nodes with matching ranges. ● Triggers a major (validation) compaction on peers. ○ i.e. do the read part of the compaction stage ● Read and generate the Merkle Tree on each peer. ● Initiator awaits trees from peers. ● Compare every trees to every other trees. ● If any differences, the differing nodes exchange conflicting ranges.
  • 23. Anti-entropy repair node Top Hash Merkle Tree Hash 0 Hash 1 Hash 0-0 Hash 0-1 Hash 1-0 Hash 1-1 Partition Data 1 Partition Data 2 Partition Data 3 Partition Data 4
  • 24. Anti-entropy repair node Cautious ● Building the Merkle Tree is disk I/O and CPU intensive ○ due to validation compaction ● Overstreaming occurs ○ due to the streaming of partitions
  • 25. Anti-entropy repair node Options ● -pr (--partitioner-range) : repairs only the main partition range for that node Use -pr for periodic repair maintenance, and execute repair on each node. Don’t use -pr for a recovering node because other replicas for that node need to be repaired too.
  • 26. Anti-entropy repair node Options ● -snapshot : only one replica at a time do computation => make sequential repairs. Always use -snapshot to avoid overloading the targeted node and it’s replica. ● Since 2.0.2, sequential repair is the default behavior. ○ renamed to -par (for parallel)
  • 27. Anti-entropy repair node Options ● -st : start token ● -et : end token $ nodetool repair -st <start_token> -et <end_token> Completely eliminates the overstreaming (subrange repair)
  • 28. Anti-entropy repair node Key points ● Use nodetool repair as a maintenance task ● Use nodetool repair cautiously ● Use relevant options when needed
  • 29. Thank you ! Q & A time @ClemLardeur