SlideShare a Scribd company logo
1 of 34
Download to read offline
Message Reliability in Kafka
Mihai Ghita
Big Data Software Developer
● Delivery guarantees provided by Kafka:
○ At most once
○ At least once
○ Exactly once
● Kafka features:
○ Kafka Idempotent Producer
○ Kafka Transactional Consumer and Producer
Outline
Kafka Producer - Example
Kafka Producer - Example
Kafka Consumer - Example
Kafka Consumer - Example
Delivery
Guarantees
At most once At least once Exactly once
Message Delivery Guarantees
“At Most Once” Guarantee
Kafka Consumer - “At Most Once” Guarantee
Consumer
1 2 3 4 5 6 7 8 9
Batch Size
1.Read records
2.Commit unprocessed
records
Kafka
3. Data
Processing
Kafka Consumer - “At Most Once” Guarantee
Consumer
1 2 3 4 5 6 7 8 9
Batch Size
1.Read records
2.Commit unprocessed
records
Kafka
Consumer
4.Read next
records
5.Commit recordsBatch Size
3. Data
Processing
6. Data
Processing
Kafka Producer - “At Most Once” Guarantee
(x,y)Producer Broker
(x,y)Producer Broker
1. Send(x,y)
2. Append(x,y)
1. Send(a,b)
2. Append(a,b)
“At Least Once” Guarantee
Kafka Consumer - “At Least Once” Guarantee
Consumer
1 2 3 4 5 6 7 8 9
Batch Size
1.Read records
3.Commit records
Kafka
2. Data
Processing
Kafka Consumer - “At Least Once” Guarantee
Consumer
1 2 3 4 5 6 7 8 9
Batch Size
1.Read records
3.Commit records
Kafka
Consumer
4.Read next records
6.Commit recordsBatch Size
2. Data
Processing
5. Data
Processing
Kafka Producer - “At Least Once” Guarantee
(x,y)Producer Broker
(x,y) (a,b)Producer (a,b)Broker
1. Send(x,y) 2. Append(x,y)
3. Ack
1. Send(a,b)
2. Append(a,b)
3. Ack
5. Append(a,b)4. Resend(a,b)
6. Ack
“Exactly Once” Guarantee
Idempotent Producer
Acknowledgement failure leads to message duplication
(x,y)Producer Broker
(x,y) (a,b)Producer (a,b)Broker
1. Send(x,y) 2. Append(x,y)
3. Ack
1. Send(a,b)
2. Append(a,b)
3. Ack
5. Append(a,b)4. Resend(a,b)
6. Ack
The idempotent producer will eliminate message duplication from producer side
(x,y)
Seq = 0
PID = 100
Producer Broker
1. Send(x,y)
Seq = 0
PID = 100
2. Append(x,y)
Seq = 0
PID = 100
3. Ack
(x,y)
Seq = 0
PID = 100
Producer Broker
4. Send(a,b)
Seq = 1
PID = 100
2. Append(a,b)
Seq = 1
PID = 100
3. Ack
(a,b)
Seq = 1
PID = 100
5. Ack-Duplicate
1. Send(a,b)
Seq = 1
PID = 100
Kafka Transactions
Producer
Topic A, Partition 0
Topic B, Partition 0
Topic B, Partition 1
Transactional Producer
m1 m5
m3 m4 m6
m2
Producer
Topic A, Partition 0
Topic B, Partition 0
Topic B, Partition 1
Transactional Producer
Transactional Producer
m1 m5 C
m3 m4 m6 C
m2 C
Producer
Topic A, Partition 0
Topic B, Partition 0
Topic B, Partition 1
atomic commit
m1 m5 A
m3 m4 m6 A
m2 A
Producer
Topic A, Partition 0
Topic B, Partition 0
Topic B, Partition 1
atomic abort
Transactional Producer
m1 m5 C
m3 m4 m6 C
m2 C
Consumer
Topic A, Partition 0
Topic B, Partition 0
Topic B, Partition 1
read committed
Transactional Consumer
m11 m12 C
m3 A m8 C
A m2 m9 C
Consumer
Topic A, Partition 0
Topic B, Partition 0
Topic B, Partition 1
read committed
Transactional Consumer
Why are the Transactions Important?
Read
Write
Process
Input
Output
Write all results
Mark all messages as consumed
Write to the output topic
Write offsets to the commit topic
Why are the Transactions Important?
All or nothing!
End-to-End Exactly-Once
Kafka Transactions - Demo
● Delivery guarantees provided by Kafka:
○ At most once
○ At least once
○ Exactly once
● Depending on your needs, choose the right delivery guarantee
Putting it all Together
Kafka Transactional - Internal Implementation
Kafka Consumer - Internal Implementation

More Related Content

What's hot

Bcn open stack meet up - july 2014
Bcn open stack meet up - july 2014Bcn open stack meet up - july 2014
Bcn open stack meet up - july 2014Jaume Devesa Gomez
 
Functional Programming with JavaScript
Functional Programming with JavaScriptFunctional Programming with JavaScript
Functional Programming with JavaScriptMark Shelton
 
No More, No Less: A Formal Model for Serverless Computing
No More, No Less: A Formal Model for Serverless ComputingNo More, No Less: A Formal Model for Serverless Computing
No More, No Less: A Formal Model for Serverless ComputingMarco Peressotti
 
How to Build a Telegraf Plugin by Noah Crowley
How to Build a Telegraf Plugin by Noah CrowleyHow to Build a Telegraf Plugin by Noah Crowley
How to Build a Telegraf Plugin by Noah CrowleyInfluxData
 
Improving Performance of a WebKit Port MIPS Platform (ELC 2014)
Improving Performance of a WebKit Port MIPS Platform (ELC 2014)Improving Performance of a WebKit Port MIPS Platform (ELC 2014)
Improving Performance of a WebKit Port MIPS Platform (ELC 2014)Igalia
 

What's hot (7)

201801 CSE240 Lecture 15
201801 CSE240 Lecture 15201801 CSE240 Lecture 15
201801 CSE240 Lecture 15
 
Bcn open stack meet up - july 2014
Bcn open stack meet up - july 2014Bcn open stack meet up - july 2014
Bcn open stack meet up - july 2014
 
Functional Programming with JavaScript
Functional Programming with JavaScriptFunctional Programming with JavaScript
Functional Programming with JavaScript
 
No More, No Less: A Formal Model for Serverless Computing
No More, No Less: A Formal Model for Serverless ComputingNo More, No Less: A Formal Model for Serverless Computing
No More, No Less: A Formal Model for Serverless Computing
 
How to Build a Telegraf Plugin by Noah Crowley
How to Build a Telegraf Plugin by Noah CrowleyHow to Build a Telegraf Plugin by Noah Crowley
How to Build a Telegraf Plugin by Noah Crowley
 
Capturar direccion ip y mac en win cc scada
Capturar direccion ip y mac en win cc scadaCapturar direccion ip y mac en win cc scada
Capturar direccion ip y mac en win cc scada
 
Improving Performance of a WebKit Port MIPS Platform (ELC 2014)
Improving Performance of a WebKit Port MIPS Platform (ELC 2014)Improving Performance of a WebKit Port MIPS Platform (ELC 2014)
Improving Performance of a WebKit Port MIPS Platform (ELC 2014)
 

Similar to Message reliability in kafka

Introducing Exactly Once Semantics in Apache Kafka with Matthias J. Sax
Introducing Exactly Once Semantics in Apache Kafka with Matthias J. SaxIntroducing Exactly Once Semantics in Apache Kafka with Matthias J. Sax
Introducing Exactly Once Semantics in Apache Kafka with Matthias J. SaxDatabricks
 
TDEA 2018 Kafka EOS (Exactly-once)
TDEA 2018 Kafka EOS (Exactly-once)TDEA 2018 Kafka EOS (Exactly-once)
TDEA 2018 Kafka EOS (Exactly-once)Erhwen Kuo
 
Producer Performance Tuning for Apache Kafka
Producer Performance Tuning for Apache KafkaProducer Performance Tuning for Apache Kafka
Producer Performance Tuning for Apache KafkaJiangjie Qin
 
Transaction Support in Pulsar 2.5.0
Transaction Support in Pulsar 2.5.0Transaction Support in Pulsar 2.5.0
Transaction Support in Pulsar 2.5.0StreamNative
 
Transaction preview of Apache Pulsar
Transaction preview of Apache PulsarTransaction preview of Apache Pulsar
Transaction preview of Apache PulsarStreamNative
 
Multi cluster, multitenant and hierarchical kafka messaging service slideshare
Multi cluster, multitenant and hierarchical kafka messaging service   slideshareMulti cluster, multitenant and hierarchical kafka messaging service   slideshare
Multi cluster, multitenant and hierarchical kafka messaging service slideshareAllen (Xiaozhong) Wang
 
Kafka Summit SF 2017 - MultiCluster, MultiTenant and Hierarchical Kafka Messa...
Kafka Summit SF 2017 - MultiCluster, MultiTenant and Hierarchical Kafka Messa...Kafka Summit SF 2017 - MultiCluster, MultiTenant and Hierarchical Kafka Messa...
Kafka Summit SF 2017 - MultiCluster, MultiTenant and Hierarchical Kafka Messa...confluent
 
Exactly-Once Made Easy: Transactional Messaging Improvement for Usability and...
Exactly-Once Made Easy: Transactional Messaging Improvement for Usability and...Exactly-Once Made Easy: Transactional Messaging Improvement for Usability and...
Exactly-Once Made Easy: Transactional Messaging Improvement for Usability and...HostedbyConfluent
 
From a Kafkaesque Story to The Promised Land at LivePerson
From a Kafkaesque Story to The Promised Land at LivePersonFrom a Kafkaesque Story to The Promised Land at LivePerson
From a Kafkaesque Story to The Promised Land at LivePersonLivePerson
 
Exactly-Once Made Easy: Transactional Messaging Improvement for Usability and...
Exactly-Once Made Easy: Transactional Messaging Improvement for Usability and...Exactly-Once Made Easy: Transactional Messaging Improvement for Usability and...
Exactly-Once Made Easy: Transactional Messaging Improvement for Usability and...Guozhang Wang
 
Guaranteed Event Delivery with Kafka and NodeJS | Amitesh Madhur, Nutanix
Guaranteed Event Delivery with Kafka and NodeJS | Amitesh Madhur, NutanixGuaranteed Event Delivery with Kafka and NodeJS | Amitesh Madhur, Nutanix
Guaranteed Event Delivery with Kafka and NodeJS | Amitesh Madhur, NutanixHostedbyConfluent
 
Polyglot, fault-tolerant event-driven programming with kafka, kubernetes and ...
Polyglot, fault-tolerant event-driven programming with kafka, kubernetes and ...Polyglot, fault-tolerant event-driven programming with kafka, kubernetes and ...
Polyglot, fault-tolerant event-driven programming with kafka, kubernetes and ...Natan Silnitsky
 
Kafka in Adobe Ad Cloud's Analytics Platform: Building systems with exactly-o...
Kafka in Adobe Ad Cloud's Analytics Platform: Building systems with exactly-o...Kafka in Adobe Ad Cloud's Analytics Platform: Building systems with exactly-o...
Kafka in Adobe Ad Cloud's Analytics Platform: Building systems with exactly-o...Vikram Patankar
 
Apache Kafka in Adobe Ad Cloud's Analytics Platform
Apache Kafka in Adobe Ad Cloud's Analytics PlatformApache Kafka in Adobe Ad Cloud's Analytics Platform
Apache Kafka in Adobe Ad Cloud's Analytics Platformconfluent
 
Fluency - Yet another fluent logger
Fluency - Yet another fluent loggerFluency - Yet another fluent logger
Fluency - Yet another fluent loggerMitsunori Komatsu
 
From a kafkaesque story to The Promised Land
From a kafkaesque story to The Promised LandFrom a kafkaesque story to The Promised Land
From a kafkaesque story to The Promised LandRan Silberman
 
Apache Kafka Women Who Code Meetup
Apache Kafka Women Who Code MeetupApache Kafka Women Who Code Meetup
Apache Kafka Women Who Code MeetupSnehal Nagmote
 
Apache Kafka - Scalable Message-Processing and more !
Apache Kafka - Scalable Message-Processing and more !Apache Kafka - Scalable Message-Processing and more !
Apache Kafka - Scalable Message-Processing and more !Guido Schmutz
 
FPV Streaming Server with ffmpeg
FPV Streaming Server with ffmpegFPV Streaming Server with ffmpeg
FPV Streaming Server with ffmpegChan Shik Lim
 

Similar to Message reliability in kafka (20)

Introducing Exactly Once Semantics in Apache Kafka with Matthias J. Sax
Introducing Exactly Once Semantics in Apache Kafka with Matthias J. SaxIntroducing Exactly Once Semantics in Apache Kafka with Matthias J. Sax
Introducing Exactly Once Semantics in Apache Kafka with Matthias J. Sax
 
TDEA 2018 Kafka EOS (Exactly-once)
TDEA 2018 Kafka EOS (Exactly-once)TDEA 2018 Kafka EOS (Exactly-once)
TDEA 2018 Kafka EOS (Exactly-once)
 
Producer Performance Tuning for Apache Kafka
Producer Performance Tuning for Apache KafkaProducer Performance Tuning for Apache Kafka
Producer Performance Tuning for Apache Kafka
 
Transaction Support in Pulsar 2.5.0
Transaction Support in Pulsar 2.5.0Transaction Support in Pulsar 2.5.0
Transaction Support in Pulsar 2.5.0
 
Transaction preview of Apache Pulsar
Transaction preview of Apache PulsarTransaction preview of Apache Pulsar
Transaction preview of Apache Pulsar
 
Multi cluster, multitenant and hierarchical kafka messaging service slideshare
Multi cluster, multitenant and hierarchical kafka messaging service   slideshareMulti cluster, multitenant and hierarchical kafka messaging service   slideshare
Multi cluster, multitenant and hierarchical kafka messaging service slideshare
 
Kafka Summit SF 2017 - MultiCluster, MultiTenant and Hierarchical Kafka Messa...
Kafka Summit SF 2017 - MultiCluster, MultiTenant and Hierarchical Kafka Messa...Kafka Summit SF 2017 - MultiCluster, MultiTenant and Hierarchical Kafka Messa...
Kafka Summit SF 2017 - MultiCluster, MultiTenant and Hierarchical Kafka Messa...
 
Exactly-Once Made Easy: Transactional Messaging Improvement for Usability and...
Exactly-Once Made Easy: Transactional Messaging Improvement for Usability and...Exactly-Once Made Easy: Transactional Messaging Improvement for Usability and...
Exactly-Once Made Easy: Transactional Messaging Improvement for Usability and...
 
From a Kafkaesque Story to The Promised Land at LivePerson
From a Kafkaesque Story to The Promised Land at LivePersonFrom a Kafkaesque Story to The Promised Land at LivePerson
From a Kafkaesque Story to The Promised Land at LivePerson
 
Exactly-Once Made Easy: Transactional Messaging Improvement for Usability and...
Exactly-Once Made Easy: Transactional Messaging Improvement for Usability and...Exactly-Once Made Easy: Transactional Messaging Improvement for Usability and...
Exactly-Once Made Easy: Transactional Messaging Improvement for Usability and...
 
Guaranteed Event Delivery with Kafka and NodeJS | Amitesh Madhur, Nutanix
Guaranteed Event Delivery with Kafka and NodeJS | Amitesh Madhur, NutanixGuaranteed Event Delivery with Kafka and NodeJS | Amitesh Madhur, Nutanix
Guaranteed Event Delivery with Kafka and NodeJS | Amitesh Madhur, Nutanix
 
Polyglot, fault-tolerant event-driven programming with kafka, kubernetes and ...
Polyglot, fault-tolerant event-driven programming with kafka, kubernetes and ...Polyglot, fault-tolerant event-driven programming with kafka, kubernetes and ...
Polyglot, fault-tolerant event-driven programming with kafka, kubernetes and ...
 
Kafka in Adobe Ad Cloud's Analytics Platform: Building systems with exactly-o...
Kafka in Adobe Ad Cloud's Analytics Platform: Building systems with exactly-o...Kafka in Adobe Ad Cloud's Analytics Platform: Building systems with exactly-o...
Kafka in Adobe Ad Cloud's Analytics Platform: Building systems with exactly-o...
 
Apache Kafka in Adobe Ad Cloud's Analytics Platform
Apache Kafka in Adobe Ad Cloud's Analytics PlatformApache Kafka in Adobe Ad Cloud's Analytics Platform
Apache Kafka in Adobe Ad Cloud's Analytics Platform
 
Fluency - Yet another fluent logger
Fluency - Yet another fluent loggerFluency - Yet another fluent logger
Fluency - Yet another fluent logger
 
From a kafkaesque story to The Promised Land
From a kafkaesque story to The Promised LandFrom a kafkaesque story to The Promised Land
From a kafkaesque story to The Promised Land
 
Apache Kafka Women Who Code Meetup
Apache Kafka Women Who Code MeetupApache Kafka Women Who Code Meetup
Apache Kafka Women Who Code Meetup
 
Apache Kafka - Scalable Message-Processing and more !
Apache Kafka - Scalable Message-Processing and more !Apache Kafka - Scalable Message-Processing and more !
Apache Kafka - Scalable Message-Processing and more !
 
Kafka Workshop
Kafka WorkshopKafka Workshop
Kafka Workshop
 
FPV Streaming Server with ffmpeg
FPV Streaming Server with ffmpegFPV Streaming Server with ffmpeg
FPV Streaming Server with ffmpeg
 

Recently uploaded

Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 

Recently uploaded (20)

Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 

Message reliability in kafka

  • 1. Message Reliability in Kafka Mihai Ghita Big Data Software Developer
  • 2. ● Delivery guarantees provided by Kafka: ○ At most once ○ At least once ○ Exactly once ● Kafka features: ○ Kafka Idempotent Producer ○ Kafka Transactional Consumer and Producer Outline
  • 7. Delivery Guarantees At most once At least once Exactly once Message Delivery Guarantees
  • 8. “At Most Once” Guarantee
  • 9. Kafka Consumer - “At Most Once” Guarantee Consumer 1 2 3 4 5 6 7 8 9 Batch Size 1.Read records 2.Commit unprocessed records Kafka 3. Data Processing
  • 10. Kafka Consumer - “At Most Once” Guarantee Consumer 1 2 3 4 5 6 7 8 9 Batch Size 1.Read records 2.Commit unprocessed records Kafka Consumer 4.Read next records 5.Commit recordsBatch Size 3. Data Processing 6. Data Processing
  • 11. Kafka Producer - “At Most Once” Guarantee (x,y)Producer Broker (x,y)Producer Broker 1. Send(x,y) 2. Append(x,y) 1. Send(a,b) 2. Append(a,b)
  • 12. “At Least Once” Guarantee
  • 13. Kafka Consumer - “At Least Once” Guarantee Consumer 1 2 3 4 5 6 7 8 9 Batch Size 1.Read records 3.Commit records Kafka 2. Data Processing
  • 14. Kafka Consumer - “At Least Once” Guarantee Consumer 1 2 3 4 5 6 7 8 9 Batch Size 1.Read records 3.Commit records Kafka Consumer 4.Read next records 6.Commit recordsBatch Size 2. Data Processing 5. Data Processing
  • 15. Kafka Producer - “At Least Once” Guarantee (x,y)Producer Broker (x,y) (a,b)Producer (a,b)Broker 1. Send(x,y) 2. Append(x,y) 3. Ack 1. Send(a,b) 2. Append(a,b) 3. Ack 5. Append(a,b)4. Resend(a,b) 6. Ack
  • 18. Acknowledgement failure leads to message duplication (x,y)Producer Broker (x,y) (a,b)Producer (a,b)Broker 1. Send(x,y) 2. Append(x,y) 3. Ack 1. Send(a,b) 2. Append(a,b) 3. Ack 5. Append(a,b)4. Resend(a,b) 6. Ack
  • 19. The idempotent producer will eliminate message duplication from producer side (x,y) Seq = 0 PID = 100 Producer Broker 1. Send(x,y) Seq = 0 PID = 100 2. Append(x,y) Seq = 0 PID = 100 3. Ack (x,y) Seq = 0 PID = 100 Producer Broker 4. Send(a,b) Seq = 1 PID = 100 2. Append(a,b) Seq = 1 PID = 100 3. Ack (a,b) Seq = 1 PID = 100 5. Ack-Duplicate 1. Send(a,b) Seq = 1 PID = 100
  • 21. Producer Topic A, Partition 0 Topic B, Partition 0 Topic B, Partition 1 Transactional Producer
  • 22. m1 m5 m3 m4 m6 m2 Producer Topic A, Partition 0 Topic B, Partition 0 Topic B, Partition 1 Transactional Producer
  • 23. Transactional Producer m1 m5 C m3 m4 m6 C m2 C Producer Topic A, Partition 0 Topic B, Partition 0 Topic B, Partition 1 atomic commit
  • 24. m1 m5 A m3 m4 m6 A m2 A Producer Topic A, Partition 0 Topic B, Partition 0 Topic B, Partition 1 atomic abort Transactional Producer
  • 25. m1 m5 C m3 m4 m6 C m2 C Consumer Topic A, Partition 0 Topic B, Partition 0 Topic B, Partition 1 read committed Transactional Consumer
  • 26. m11 m12 C m3 A m8 C A m2 m9 C Consumer Topic A, Partition 0 Topic B, Partition 0 Topic B, Partition 1 read committed Transactional Consumer
  • 27. Why are the Transactions Important? Read Write Process Input Output
  • 28. Write all results Mark all messages as consumed Write to the output topic Write offsets to the commit topic Why are the Transactions Important? All or nothing!
  • 31. ● Delivery guarantees provided by Kafka: ○ At most once ○ At least once ○ Exactly once ● Depending on your needs, choose the right delivery guarantee Putting it all Together
  • 32.
  • 33. Kafka Transactional - Internal Implementation
  • 34. Kafka Consumer - Internal Implementation