SlideShare uma empresa Scribd logo
1 de 50
Pragmatic Guide to
Apache Kafka’s
Exactly Once Semantics
Gwen Shapira, Principal Engineer II
Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. 2
Exactly-once
Semantics is two
features:
Idempotent Producer
Transactions:
● Atomic multi-partition write
● Read committed
Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc.
Setting the stage
3
Stream Processing Application
Consume
Process
Produce
A B C D
A’
Input Topic
Output Topic
1
offset Topic
Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc.
Duplicate messages
caused by producer retry
Writing Exactly Once to Kafka - What can go wrong?
4
Re-processing due to
application crash
Re-processing due to
zombie application
instance
Produce Output
A
Produce
A
Output
Produce
A A
Output
A
Consumer 1
A B C D
Input
offset
Consumer 2
A B C D
Input
Consumer 1
X
Idempotent Producer
Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc.
What does it solve? Duplicates caused by retries
6
Produce
Output Topic
Produce
A’
Output Topic
Produce
A’ A’
Output Topic
A’
No Response
A’
Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc.
How does it solve it?
7
Produce (ID = 1)
Output Topic
Produce (ID = 1)
A’
Output Topic
Produce (ID = 1)
A’
Output Topic
A’
p.id = 1
seq = 2
No Response
P.id=1, seq=2
P.id=1, seq=2
A’
p.id = 1
seq = 2
Warning:
Duplicate
Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc.
How to use it?
enable.idempotence=true
8
Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. 9
What doesn’t it solve? • Duplicates caused by calling
producer.send()twice with same
record
• Duplicates from external sources
• Duplicates caused by two different
producers
• Duplicates between application
restarts
Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc.
When to avoid it?
• If you don’t care about reliability.
• If you use very short lived producers (new
producer per record or close).
10
99.95% of the time, idempotent
producer is safe and recommended
Transactions
Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc.
What does it solve? Duplicates due to crashes
13
Stream Processing Application
Consume
Process
Produce
A B C D
A’
Input Topic
Output Topic
1
offset Topic
1
3
2
Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc.
What does it solve? Duplicates due to crashes
14
Stream Processing Application
Consume
Process
Produce
A B C D
A’ B’ C’
Input Topic
Output Topic
offset Topic
1
2
Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc.
What does it solve? Duplicates due to crashes
15
Stream Processing Application
Consume
Process
Produce
A B C D
A’ B’ C’
Input Topic
Output Topic
offset Topic
1
2
X
Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc.
What does it solve? Duplicates due to crashes
16
Stream Processing Application
Consume
Process
Produce
A B C D
A’ B’ C’
Input Topic
Output Topic
offset Topic
1
2
X
Consume
Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc.
What does it solve? Duplicates due to crashes
17
Stream Processing Application
Consume
Process
Produce
A B C D
A’ B’ C’ A’
Input Topic
Output Topic
offset Topic
1
2
X
Consume
Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc.
How does it solve it? Atomic multi-partition write
18
Stream Processing Application
Consume
Process
Produce
A B C D
A’
Input Topic
Output Topic
1
offset Topic
1
2
2
We want two writes
“at the same time”
Or at least:
Either we wrote both output and offset
or pretend neither happened
Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc.
How does it solve it? Atomic multi-partition write
19
Stream Processing Application
Consume
Process
Produce
A B C D
A’
Input Topic
Output Topic
1
offset Topic
1
2
2
Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc.
How does it solve it? Atomic multi-partition write
20
Produce
A’
Output Topic
1
offset Topic
I’m going to write
to output and offsets
topics
Transaction Log
1
2
2
Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc.
How does it solve it? Atomic multi-partition write
21
Produce
A’ C
Output Topic
1 C
offset Topic
I’m going to write
to output and offsets
topics
Transaction Log
3
4
4
Writing was successful. I’m
about to commit!
Committed and we are
done. TTYL
5
Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc.
Transactions - Consumer view
Read committed Consumer
A’
Output Topic
<NOTHING>
Console
Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc.
Transactions - Consumer view
Read committed Consumer
A’ C
Output Topic
A’
Console
Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc.
Transactions - Consumer view
Read committed Consumer
A’ C D E
Output Topic
A’
Console
Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc.
Transactions - Consumer view
Read committed Consumer
A’ C D E A
Output Topic
A’
Console
Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc.
Transactions - Consumer view
Read committed Consumer
A’ C D’ E’ A V
Output Topic
A’, V
Console
Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc.
What does it solve? Duplicates due to Zombies
27
Stream Processing Application
Consume
Process
Produce
A B C D
Input Topic
Output Topic
offset Topic
1
2
A B C
Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc.
What does it solve? Duplicates due to Zombies
28
Stream Processing Application
Consume
Process
Produce
A B C D
Input Topic
Output Topic
offset Topic
1
2
A B C
Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc.
What does it solve? Duplicates due to Zombies
29
Stream Processing
Application
Consume
Process
Produce
A B C D
A’ B’ C’
Input Topic
Output Topic
offset Topic
A’ B’ C’
Stream Processing Application
Consume
Process
Produce
A B C
Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc.
What does it solve? Duplicates due to Zombies
30
Stream Processing
Application
Consume
Process
Produce
A B C D
A’ B’ C’
Input Topic
Output Topic
offset Topic
A’ B’ C’
Stream Processing Application
Consume
Process
Produce
A B C
Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc.
What does it solve? Duplicates due to Zombies
31
Stream Processing
Application
Consume
Process
Produce
A B C D
A’ B’ C’ A’ B’ C’
Input Topic
Output Topic
offset Topic
A’ B’ C’
Stream Processing Application
Consume
Process
Produce
Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc.
How does it solve it? zombie fencing
32
Application 1
Consume
Process
Produce
A B C D
A’ B’ C’
Input Topic
Output Topic
offset Topic
A’ B’ C’
Application 1
Consume
Process
Produce
A B C
How do we know
that we have a
zombie?
We give unique
transactional.id
to every application
instance.
Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc.
How does it solve it? zombie fencing
33
Application 1
Epoch 0
Consume
Process
Produce
A B C D
A’ B’ C’
Input Topic
Output Topic
offset Topic
A’ B’ C’
Application 1
Epoch 1
Consume
Process
Produce
A B C
How do we know
who is the zombie?
Apps register
transactional.id when
they start and get
an epoch.
Newest epoch wins
Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc.
How does it solve it? zombie fencing
34
Application 1
Epoch 0
Consume
Process
Produce
A B C D
A’ B’ C’
Input Topic
Output Topic
offset Topic
A’ B’ C’
Application 1
Epoch 1
Consume
Process
Produce
A’, epoch 0
Dude, you are
dead.
Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc.
How to use it? (The sane way)
Use Kafka Streams with
processing.guarantee = exactly_once
(If you have broker 2.5+: exactly_once_beta)
35
Sidebar: Exactly Once Beta
Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. 37
Picking a good
transactional.id
is non-trivial
What is “same instance of app”?
In Kafka streams it is
“consuming from same partition”
Task = consumer + processor + producer
exactly_once uses task_id as
transactional.id
But…
- Producer per task is heavy
- Need to initialize new producer on every
rebalance
Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. 38
exactly_once_beta • Does not use transactional.id for
fencing
• Use consumer group information
instead:
Group ID
Consumer group generation
(epoch)
• Fencing happens during the offset
commit, which includes the consumer
group information
• Made possible by KIP-477
Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc.
How to use it? (Hard and likely wrong way)
39
Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc.
How to use it? (Hard and likely wrong way)
40
What does it solve?
The main use-case is accurate aggregation in
streams processing applications.
Easy to use in any Kafka Streams application.
Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc.
What doesn’t it solve?
● Side-effects during processing
● Reading from Kafka and writing to a database
● Reading from a database and writing to Kafka
● Replicating from one Kafka to another (unless replicating all topics)
● Publish-subscribe pattern (or rather - this depends a lot on the consumer)
42
When to avoid it?
If it doesn’t fit into a Kafka Streams app, it is
probably not a good idea.
Don’t keep creating new transactional.id
Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc.
Performance Notes
● Overhead on producer - fixed per transaction:
○ Register transactional.id once in its lifetime
○ Register partition in transaction once per partition per transaction
○ Extra commit marker per partition
○ Synchronous commit
● Consumer:
○ Reads extra commit markers
○ read_committed will wait for transaction commits.
Large transactions will increase end to end latency
Larger transactions == higher throughput (due to lower overhead), but higher e2e latency
44
Summary
Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. 47
Two things to
remember
Use idempotent producer,
but not with FaaS.
Use Kafka Streams with
processing.guarantee = exactly_once
Or exactly_once_beta
if you have 2.5+ brokers
Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. 48
Small Plug
The talk is based on a new chapter.
Early release is available via O’Reilly Safari.
Thanks to Ron Dagostino, Justine Olshan,
Lucas Bradstreet, Mike Bin, Bob Barrett,
Boyang Chen, Guozhang Wang and
Jason Gustafson for all the help.
Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc.
Good resources
https://github.com/apache/kafka/blob/trunk/tools/src/main/java/org/apache/kafka/tools/Trans
actionalMessageCopier.java
https://www.confluent.io/blog/enabling-exactly-once-kafka-streams/
https://www.confluent.io/blog/transactions-apache-kafka/
https://www.confluent.io/blog/simplified-robust-exactly-one-semantics-in-kafka-2-5/
https://cwiki.apache.org/confluence/display/KAFKA/KIP-129%3A+Streams+Exactly-Once+Sem
antics
49
Thank you!
@gwenshap
gwen@confluent.io
cnfl.io/meetups cnfl.io/slack
cnfl.io/blog

Mais conteúdo relacionado

Mais procurados

Disaster Recovery Plans for Apache Kafka
Disaster Recovery Plans for Apache KafkaDisaster Recovery Plans for Apache Kafka
Disaster Recovery Plans for Apache Kafkaconfluent
 
Introduction to Apache Kafka
Introduction to Apache KafkaIntroduction to Apache Kafka
Introduction to Apache KafkaJeff Holoman
 
Stream processing using Kafka
Stream processing using KafkaStream processing using Kafka
Stream processing using KafkaKnoldus Inc.
 
Managing multiple event types in a single topic with Schema Registry | Bill B...
Managing multiple event types in a single topic with Schema Registry | Bill B...Managing multiple event types in a single topic with Schema Registry | Bill B...
Managing multiple event types in a single topic with Schema Registry | Bill B...HostedbyConfluent
 
Citi Tech Talk Disaster Recovery Solutions Deep Dive
Citi Tech Talk  Disaster Recovery Solutions Deep DiveCiti Tech Talk  Disaster Recovery Solutions Deep Dive
Citi Tech Talk Disaster Recovery Solutions Deep Diveconfluent
 
Introduction To Microservices
Introduction To MicroservicesIntroduction To Microservices
Introduction To MicroservicesLalit Kale
 
Troubleshooting Kafka's socket server: from incident to resolution
Troubleshooting Kafka's socket server: from incident to resolutionTroubleshooting Kafka's socket server: from incident to resolution
Troubleshooting Kafka's socket server: from incident to resolutionJoel Koshy
 
Hardening Kafka Replication
Hardening Kafka Replication Hardening Kafka Replication
Hardening Kafka Replication confluent
 
Apache Kafka vs RabbitMQ: Fit For Purpose / Decision Tree
Apache Kafka vs RabbitMQ: Fit For Purpose / Decision TreeApache Kafka vs RabbitMQ: Fit For Purpose / Decision Tree
Apache Kafka vs RabbitMQ: Fit For Purpose / Decision TreeSlim Baltagi
 
Quarkus tips, tricks, and techniques
Quarkus tips, tricks, and techniquesQuarkus tips, tricks, and techniques
Quarkus tips, tricks, and techniquesRed Hat Developers
 
Walking through the Spring Stack for Apache Kafka with Soby Chacko | Kafka S...
 Walking through the Spring Stack for Apache Kafka with Soby Chacko | Kafka S... Walking through the Spring Stack for Apache Kafka with Soby Chacko | Kafka S...
Walking through the Spring Stack for Apache Kafka with Soby Chacko | Kafka S...HostedbyConfluent
 
Event Driven Architecture
Event Driven ArchitectureEvent Driven Architecture
Event Driven ArchitectureStefan Norberg
 
Introduction to Kafka connect
Introduction to Kafka connectIntroduction to Kafka connect
Introduction to Kafka connectKnoldus Inc.
 
Event Driven-Architecture from a Scalability perspective
Event Driven-Architecture from a Scalability perspectiveEvent Driven-Architecture from a Scalability perspective
Event Driven-Architecture from a Scalability perspectiveJonas Bonér
 
Kafka Connect: Real-time Data Integration at Scale with Apache Kafka, Ewen Ch...
Kafka Connect: Real-time Data Integration at Scale with Apache Kafka, Ewen Ch...Kafka Connect: Real-time Data Integration at Scale with Apache Kafka, Ewen Ch...
Kafka Connect: Real-time Data Integration at Scale with Apache Kafka, Ewen Ch...confluent
 
Reactive Programming for Real Use Cases
Reactive Programming for Real Use CasesReactive Programming for Real Use Cases
Reactive Programming for Real Use CasesAlex Soto
 
Discover Quarkus and GraalVM
Discover Quarkus and GraalVMDiscover Quarkus and GraalVM
Discover Quarkus and GraalVMRomain Schlick
 

Mais procurados (20)

Disaster Recovery Plans for Apache Kafka
Disaster Recovery Plans for Apache KafkaDisaster Recovery Plans for Apache Kafka
Disaster Recovery Plans for Apache Kafka
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
 
Introduction to Apache Kafka
Introduction to Apache KafkaIntroduction to Apache Kafka
Introduction to Apache Kafka
 
Stream processing using Kafka
Stream processing using KafkaStream processing using Kafka
Stream processing using Kafka
 
Managing multiple event types in a single topic with Schema Registry | Bill B...
Managing multiple event types in a single topic with Schema Registry | Bill B...Managing multiple event types in a single topic with Schema Registry | Bill B...
Managing multiple event types in a single topic with Schema Registry | Bill B...
 
Apache Kafka Best Practices
Apache Kafka Best PracticesApache Kafka Best Practices
Apache Kafka Best Practices
 
Citi Tech Talk Disaster Recovery Solutions Deep Dive
Citi Tech Talk  Disaster Recovery Solutions Deep DiveCiti Tech Talk  Disaster Recovery Solutions Deep Dive
Citi Tech Talk Disaster Recovery Solutions Deep Dive
 
Introduction To Microservices
Introduction To MicroservicesIntroduction To Microservices
Introduction To Microservices
 
Troubleshooting Kafka's socket server: from incident to resolution
Troubleshooting Kafka's socket server: from incident to resolutionTroubleshooting Kafka's socket server: from incident to resolution
Troubleshooting Kafka's socket server: from incident to resolution
 
Hardening Kafka Replication
Hardening Kafka Replication Hardening Kafka Replication
Hardening Kafka Replication
 
Apache Kafka vs RabbitMQ: Fit For Purpose / Decision Tree
Apache Kafka vs RabbitMQ: Fit For Purpose / Decision TreeApache Kafka vs RabbitMQ: Fit For Purpose / Decision Tree
Apache Kafka vs RabbitMQ: Fit For Purpose / Decision Tree
 
Quarkus tips, tricks, and techniques
Quarkus tips, tricks, and techniquesQuarkus tips, tricks, and techniques
Quarkus tips, tricks, and techniques
 
Walking through the Spring Stack for Apache Kafka with Soby Chacko | Kafka S...
 Walking through the Spring Stack for Apache Kafka with Soby Chacko | Kafka S... Walking through the Spring Stack for Apache Kafka with Soby Chacko | Kafka S...
Walking through the Spring Stack for Apache Kafka with Soby Chacko | Kafka S...
 
Event Driven Architecture
Event Driven ArchitectureEvent Driven Architecture
Event Driven Architecture
 
Introduction to Kafka connect
Introduction to Kafka connectIntroduction to Kafka connect
Introduction to Kafka connect
 
Event Driven-Architecture from a Scalability perspective
Event Driven-Architecture from a Scalability perspectiveEvent Driven-Architecture from a Scalability perspective
Event Driven-Architecture from a Scalability perspective
 
Kafka Connect: Real-time Data Integration at Scale with Apache Kafka, Ewen Ch...
Kafka Connect: Real-time Data Integration at Scale with Apache Kafka, Ewen Ch...Kafka Connect: Real-time Data Integration at Scale with Apache Kafka, Ewen Ch...
Kafka Connect: Real-time Data Integration at Scale with Apache Kafka, Ewen Ch...
 
Kafka 101
Kafka 101Kafka 101
Kafka 101
 
Reactive Programming for Real Use Cases
Reactive Programming for Real Use CasesReactive Programming for Real Use Cases
Reactive Programming for Real Use Cases
 
Discover Quarkus and GraalVM
Discover Quarkus and GraalVMDiscover Quarkus and GraalVM
Discover Quarkus and GraalVM
 

Semelhante a Pragmatic Guide to Apache Kafka®'s Exactly Once Semantics

Rethinking Geo-replication for the Cloud | Luke Knepper, Confluent
Rethinking Geo-replication for the Cloud | Luke Knepper, ConfluentRethinking Geo-replication for the Cloud | Luke Knepper, Confluent
Rethinking Geo-replication for the Cloud | Luke Knepper, ConfluentHostedbyConfluent
 
스타트업을 위한 Confluent 세미나
스타트업을 위한 Confluent 세미나스타트업을 위한 Confluent 세미나
스타트업을 위한 Confluent 세미나confluent
 
Simplifying the OpenAPI Development Experience
Simplifying the OpenAPI Development Experience Simplifying the OpenAPI Development Experience
Simplifying the OpenAPI Development Experience confluent
 
Construcción de web aps- un enfoque hexagonal
Construcción de web aps- un enfoque hexagonalConstrucción de web aps- un enfoque hexagonal
Construcción de web aps- un enfoque hexagonalch1l3no
 
The secret life of Kafka JVM Heap | Adithya Chandra, Confluent
The secret life of Kafka JVM Heap | Adithya Chandra, ConfluentThe secret life of Kafka JVM Heap | Adithya Chandra, Confluent
The secret life of Kafka JVM Heap | Adithya Chandra, ConfluentHostedbyConfluent
 
Citi Tech Talk: Messaging Modernization
Citi Tech Talk: Messaging ModernizationCiti Tech Talk: Messaging Modernization
Citi Tech Talk: Messaging Modernizationconfluent
 
Control relay via schedule time
Control relay via schedule timeControl relay via schedule time
Control relay via schedule timetopomax
 
CS155 Computer Security at Stanford University
CS155 Computer Security at Stanford UniversityCS155 Computer Security at Stanford University
CS155 Computer Security at Stanford UniversityRick Patterson
 
Onlne Retail Management By Jitendra
Onlne Retail Management By JitendraOnlne Retail Management By Jitendra
Onlne Retail Management By JitendraJitendra
 
Android Study Jams - Session 1
Android Study Jams - Session 1Android Study Jams - Session 1
Android Study Jams - Session 1AditiSaxena72
 
Tracing Software Build Processes to Uncover License Compliance Inconsistencies
Tracing Software Build Processes to Uncover License Compliance InconsistenciesTracing Software Build Processes to Uncover License Compliance Inconsistencies
Tracing Software Build Processes to Uncover License Compliance InconsistenciesShane McIntosh
 
3DC Intro to Git Workshop
3DC Intro to Git Workshop3DC Intro to Git Workshop
3DC Intro to Git WorkshopBeckhamWee
 
Refactoring 2TheMax (con ReSharper)
Refactoring 2TheMax (con ReSharper)Refactoring 2TheMax (con ReSharper)
Refactoring 2TheMax (con ReSharper)DotNetMarche
 
Full screen Web Browser support RS-232 / TCPIP peripheral (plugin)
Full screen Web Browser support RS-232 / TCPIP peripheral (plugin)Full screen Web Browser support RS-232 / TCPIP peripheral (plugin)
Full screen Web Browser support RS-232 / TCPIP peripheral (plugin)topomax
 
Reflections on Trusting Trust for Go
Reflections on Trusting Trust for GoReflections on Trusting Trust for Go
Reflections on Trusting Trust for Goyeokm1
 

Semelhante a Pragmatic Guide to Apache Kafka®'s Exactly Once Semantics (20)

Rethinking Geo-replication for the Cloud | Luke Knepper, Confluent
Rethinking Geo-replication for the Cloud | Luke Knepper, ConfluentRethinking Geo-replication for the Cloud | Luke Knepper, Confluent
Rethinking Geo-replication for the Cloud | Luke Knepper, Confluent
 
스타트업을 위한 Confluent 세미나
스타트업을 위한 Confluent 세미나스타트업을 위한 Confluent 세미나
스타트업을 위한 Confluent 세미나
 
Simplifying the OpenAPI Development Experience
Simplifying the OpenAPI Development Experience Simplifying the OpenAPI Development Experience
Simplifying the OpenAPI Development Experience
 
Construcción de web aps- un enfoque hexagonal
Construcción de web aps- un enfoque hexagonalConstrucción de web aps- un enfoque hexagonal
Construcción de web aps- un enfoque hexagonal
 
The secret life of Kafka JVM Heap | Adithya Chandra, Confluent
The secret life of Kafka JVM Heap | Adithya Chandra, ConfluentThe secret life of Kafka JVM Heap | Adithya Chandra, Confluent
The secret life of Kafka JVM Heap | Adithya Chandra, Confluent
 
Citi Tech Talk: Messaging Modernization
Citi Tech Talk: Messaging ModernizationCiti Tech Talk: Messaging Modernization
Citi Tech Talk: Messaging Modernization
 
Bugzilla
BugzillaBugzilla
Bugzilla
 
Control relay via schedule time
Control relay via schedule timeControl relay via schedule time
Control relay via schedule time
 
CS155 Computer Security at Stanford University
CS155 Computer Security at Stanford UniversityCS155 Computer Security at Stanford University
CS155 Computer Security at Stanford University
 
Onlne Retail Management By Jitendra
Onlne Retail Management By JitendraOnlne Retail Management By Jitendra
Onlne Retail Management By Jitendra
 
Android Study Jams - Session 1
Android Study Jams - Session 1Android Study Jams - Session 1
Android Study Jams - Session 1
 
Tracing Software Build Processes to Uncover License Compliance Inconsistencies
Tracing Software Build Processes to Uncover License Compliance InconsistenciesTracing Software Build Processes to Uncover License Compliance Inconsistencies
Tracing Software Build Processes to Uncover License Compliance Inconsistencies
 
CI & CD- mobile application
CI & CD- mobile applicationCI & CD- mobile application
CI & CD- mobile application
 
CI & CD- mobile application
CI & CD- mobile applicationCI & CD- mobile application
CI & CD- mobile application
 
3DC Intro to Git Workshop
3DC Intro to Git Workshop3DC Intro to Git Workshop
3DC Intro to Git Workshop
 
Ionic debugger
Ionic debuggerIonic debugger
Ionic debugger
 
TibcoBE-Development
TibcoBE-DevelopmentTibcoBE-Development
TibcoBE-Development
 
Refactoring 2TheMax (con ReSharper)
Refactoring 2TheMax (con ReSharper)Refactoring 2TheMax (con ReSharper)
Refactoring 2TheMax (con ReSharper)
 
Full screen Web Browser support RS-232 / TCPIP peripheral (plugin)
Full screen Web Browser support RS-232 / TCPIP peripheral (plugin)Full screen Web Browser support RS-232 / TCPIP peripheral (plugin)
Full screen Web Browser support RS-232 / TCPIP peripheral (plugin)
 
Reflections on Trusting Trust for Go
Reflections on Trusting Trust for GoReflections on Trusting Trust for Go
Reflections on Trusting Trust for Go
 

Mais de confluent

Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
Santander Stream Processing with Apache Flink
Santander Stream Processing with Apache FlinkSantander Stream Processing with Apache Flink
Santander Stream Processing with Apache Flinkconfluent
 
Unlocking the Power of IoT: A comprehensive approach to real-time insights
Unlocking the Power of IoT: A comprehensive approach to real-time insightsUnlocking the Power of IoT: A comprehensive approach to real-time insights
Unlocking the Power of IoT: A comprehensive approach to real-time insightsconfluent
 
Workshop híbrido: Stream Processing con Flink
Workshop híbrido: Stream Processing con FlinkWorkshop híbrido: Stream Processing con Flink
Workshop híbrido: Stream Processing con Flinkconfluent
 
Industry 4.0: Building the Unified Namespace with Confluent, HiveMQ and Spark...
Industry 4.0: Building the Unified Namespace with Confluent, HiveMQ and Spark...Industry 4.0: Building the Unified Namespace with Confluent, HiveMQ and Spark...
Industry 4.0: Building the Unified Namespace with Confluent, HiveMQ and Spark...confluent
 
AWS Immersion Day Mapfre - Confluent
AWS Immersion Day Mapfre   -   ConfluentAWS Immersion Day Mapfre   -   Confluent
AWS Immersion Day Mapfre - Confluentconfluent
 
Eventos y Microservicios - Santander TechTalk
Eventos y Microservicios - Santander TechTalkEventos y Microservicios - Santander TechTalk
Eventos y Microservicios - Santander TechTalkconfluent
 
Q&A with Confluent Experts: Navigating Networking in Confluent Cloud
Q&A with Confluent Experts: Navigating Networking in Confluent CloudQ&A with Confluent Experts: Navigating Networking in Confluent Cloud
Q&A with Confluent Experts: Navigating Networking in Confluent Cloudconfluent
 
Citi TechTalk Session 2: Kafka Deep Dive
Citi TechTalk Session 2: Kafka Deep DiveCiti TechTalk Session 2: Kafka Deep Dive
Citi TechTalk Session 2: Kafka Deep Diveconfluent
 
Build real-time streaming data pipelines to AWS with Confluent
Build real-time streaming data pipelines to AWS with ConfluentBuild real-time streaming data pipelines to AWS with Confluent
Build real-time streaming data pipelines to AWS with Confluentconfluent
 
Q&A with Confluent Professional Services: Confluent Service Mesh
Q&A with Confluent Professional Services: Confluent Service MeshQ&A with Confluent Professional Services: Confluent Service Mesh
Q&A with Confluent Professional Services: Confluent Service Meshconfluent
 
Citi Tech Talk: Event Driven Kafka Microservices
Citi Tech Talk: Event Driven Kafka MicroservicesCiti Tech Talk: Event Driven Kafka Microservices
Citi Tech Talk: Event Driven Kafka Microservicesconfluent
 
Confluent & GSI Webinars series - Session 3
Confluent & GSI Webinars series - Session 3Confluent & GSI Webinars series - Session 3
Confluent & GSI Webinars series - Session 3confluent
 
Citi Tech Talk: Data Governance for streaming and real time data
Citi Tech Talk: Data Governance for streaming and real time dataCiti Tech Talk: Data Governance for streaming and real time data
Citi Tech Talk: Data Governance for streaming and real time dataconfluent
 
Confluent & GSI Webinars series: Session 2
Confluent & GSI Webinars series: Session 2Confluent & GSI Webinars series: Session 2
Confluent & GSI Webinars series: Session 2confluent
 
Data In Motion Paris 2023
Data In Motion Paris 2023Data In Motion Paris 2023
Data In Motion Paris 2023confluent
 
Confluent Partner Tech Talk with Synthesis
Confluent Partner Tech Talk with SynthesisConfluent Partner Tech Talk with Synthesis
Confluent Partner Tech Talk with Synthesisconfluent
 
The Future of Application Development - API Days - Melbourne 2023
The Future of Application Development - API Days - Melbourne 2023The Future of Application Development - API Days - Melbourne 2023
The Future of Application Development - API Days - Melbourne 2023confluent
 
The Playful Bond Between REST And Data Streams
The Playful Bond Between REST And Data StreamsThe Playful Bond Between REST And Data Streams
The Playful Bond Between REST And Data Streamsconfluent
 
The Journey to Data Mesh with Confluent
The Journey to Data Mesh with ConfluentThe Journey to Data Mesh with Confluent
The Journey to Data Mesh with Confluentconfluent
 

Mais de confluent (20)

Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
Santander Stream Processing with Apache Flink
Santander Stream Processing with Apache FlinkSantander Stream Processing with Apache Flink
Santander Stream Processing with Apache Flink
 
Unlocking the Power of IoT: A comprehensive approach to real-time insights
Unlocking the Power of IoT: A comprehensive approach to real-time insightsUnlocking the Power of IoT: A comprehensive approach to real-time insights
Unlocking the Power of IoT: A comprehensive approach to real-time insights
 
Workshop híbrido: Stream Processing con Flink
Workshop híbrido: Stream Processing con FlinkWorkshop híbrido: Stream Processing con Flink
Workshop híbrido: Stream Processing con Flink
 
Industry 4.0: Building the Unified Namespace with Confluent, HiveMQ and Spark...
Industry 4.0: Building the Unified Namespace with Confluent, HiveMQ and Spark...Industry 4.0: Building the Unified Namespace with Confluent, HiveMQ and Spark...
Industry 4.0: Building the Unified Namespace with Confluent, HiveMQ and Spark...
 
AWS Immersion Day Mapfre - Confluent
AWS Immersion Day Mapfre   -   ConfluentAWS Immersion Day Mapfre   -   Confluent
AWS Immersion Day Mapfre - Confluent
 
Eventos y Microservicios - Santander TechTalk
Eventos y Microservicios - Santander TechTalkEventos y Microservicios - Santander TechTalk
Eventos y Microservicios - Santander TechTalk
 
Q&A with Confluent Experts: Navigating Networking in Confluent Cloud
Q&A with Confluent Experts: Navigating Networking in Confluent CloudQ&A with Confluent Experts: Navigating Networking in Confluent Cloud
Q&A with Confluent Experts: Navigating Networking in Confluent Cloud
 
Citi TechTalk Session 2: Kafka Deep Dive
Citi TechTalk Session 2: Kafka Deep DiveCiti TechTalk Session 2: Kafka Deep Dive
Citi TechTalk Session 2: Kafka Deep Dive
 
Build real-time streaming data pipelines to AWS with Confluent
Build real-time streaming data pipelines to AWS with ConfluentBuild real-time streaming data pipelines to AWS with Confluent
Build real-time streaming data pipelines to AWS with Confluent
 
Q&A with Confluent Professional Services: Confluent Service Mesh
Q&A with Confluent Professional Services: Confluent Service MeshQ&A with Confluent Professional Services: Confluent Service Mesh
Q&A with Confluent Professional Services: Confluent Service Mesh
 
Citi Tech Talk: Event Driven Kafka Microservices
Citi Tech Talk: Event Driven Kafka MicroservicesCiti Tech Talk: Event Driven Kafka Microservices
Citi Tech Talk: Event Driven Kafka Microservices
 
Confluent & GSI Webinars series - Session 3
Confluent & GSI Webinars series - Session 3Confluent & GSI Webinars series - Session 3
Confluent & GSI Webinars series - Session 3
 
Citi Tech Talk: Data Governance for streaming and real time data
Citi Tech Talk: Data Governance for streaming and real time dataCiti Tech Talk: Data Governance for streaming and real time data
Citi Tech Talk: Data Governance for streaming and real time data
 
Confluent & GSI Webinars series: Session 2
Confluent & GSI Webinars series: Session 2Confluent & GSI Webinars series: Session 2
Confluent & GSI Webinars series: Session 2
 
Data In Motion Paris 2023
Data In Motion Paris 2023Data In Motion Paris 2023
Data In Motion Paris 2023
 
Confluent Partner Tech Talk with Synthesis
Confluent Partner Tech Talk with SynthesisConfluent Partner Tech Talk with Synthesis
Confluent Partner Tech Talk with Synthesis
 
The Future of Application Development - API Days - Melbourne 2023
The Future of Application Development - API Days - Melbourne 2023The Future of Application Development - API Days - Melbourne 2023
The Future of Application Development - API Days - Melbourne 2023
 
The Playful Bond Between REST And Data Streams
The Playful Bond Between REST And Data StreamsThe Playful Bond Between REST And Data Streams
The Playful Bond Between REST And Data Streams
 
The Journey to Data Mesh with Confluent
The Journey to Data Mesh with ConfluentThe Journey to Data Mesh with Confluent
The Journey to Data Mesh with Confluent
 

Último

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
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
 
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
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
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
 
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
 
[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
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
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
 
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
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 

Último (20)

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
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
 
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
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
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
 
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 ...
 
[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
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).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)
 
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
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 

Pragmatic Guide to Apache Kafka®'s Exactly Once Semantics

  • 1. Pragmatic Guide to Apache Kafka’s Exactly Once Semantics Gwen Shapira, Principal Engineer II
  • 2. Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. 2 Exactly-once Semantics is two features: Idempotent Producer Transactions: ● Atomic multi-partition write ● Read committed
  • 3. Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. Setting the stage 3 Stream Processing Application Consume Process Produce A B C D A’ Input Topic Output Topic 1 offset Topic
  • 4. Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. Duplicate messages caused by producer retry Writing Exactly Once to Kafka - What can go wrong? 4 Re-processing due to application crash Re-processing due to zombie application instance Produce Output A Produce A Output Produce A A Output A Consumer 1 A B C D Input offset Consumer 2 A B C D Input Consumer 1 X
  • 6. Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. What does it solve? Duplicates caused by retries 6 Produce Output Topic Produce A’ Output Topic Produce A’ A’ Output Topic A’ No Response A’
  • 7. Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. How does it solve it? 7 Produce (ID = 1) Output Topic Produce (ID = 1) A’ Output Topic Produce (ID = 1) A’ Output Topic A’ p.id = 1 seq = 2 No Response P.id=1, seq=2 P.id=1, seq=2 A’ p.id = 1 seq = 2 Warning: Duplicate
  • 8. Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. How to use it? enable.idempotence=true 8
  • 9. Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. 9 What doesn’t it solve? • Duplicates caused by calling producer.send()twice with same record • Duplicates from external sources • Duplicates caused by two different producers • Duplicates between application restarts
  • 10. Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. When to avoid it? • If you don’t care about reliability. • If you use very short lived producers (new producer per record or close). 10
  • 11. 99.95% of the time, idempotent producer is safe and recommended
  • 13. Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. What does it solve? Duplicates due to crashes 13 Stream Processing Application Consume Process Produce A B C D A’ Input Topic Output Topic 1 offset Topic 1 3 2
  • 14. Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. What does it solve? Duplicates due to crashes 14 Stream Processing Application Consume Process Produce A B C D A’ B’ C’ Input Topic Output Topic offset Topic 1 2
  • 15. Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. What does it solve? Duplicates due to crashes 15 Stream Processing Application Consume Process Produce A B C D A’ B’ C’ Input Topic Output Topic offset Topic 1 2 X
  • 16. Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. What does it solve? Duplicates due to crashes 16 Stream Processing Application Consume Process Produce A B C D A’ B’ C’ Input Topic Output Topic offset Topic 1 2 X Consume
  • 17. Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. What does it solve? Duplicates due to crashes 17 Stream Processing Application Consume Process Produce A B C D A’ B’ C’ A’ Input Topic Output Topic offset Topic 1 2 X Consume
  • 18. Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. How does it solve it? Atomic multi-partition write 18 Stream Processing Application Consume Process Produce A B C D A’ Input Topic Output Topic 1 offset Topic 1 2 2 We want two writes “at the same time” Or at least: Either we wrote both output and offset or pretend neither happened
  • 19. Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. How does it solve it? Atomic multi-partition write 19 Stream Processing Application Consume Process Produce A B C D A’ Input Topic Output Topic 1 offset Topic 1 2 2
  • 20. Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. How does it solve it? Atomic multi-partition write 20 Produce A’ Output Topic 1 offset Topic I’m going to write to output and offsets topics Transaction Log 1 2 2
  • 21. Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. How does it solve it? Atomic multi-partition write 21 Produce A’ C Output Topic 1 C offset Topic I’m going to write to output and offsets topics Transaction Log 3 4 4 Writing was successful. I’m about to commit! Committed and we are done. TTYL 5
  • 22. Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. Transactions - Consumer view Read committed Consumer A’ Output Topic <NOTHING> Console
  • 23. Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. Transactions - Consumer view Read committed Consumer A’ C Output Topic A’ Console
  • 24. Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. Transactions - Consumer view Read committed Consumer A’ C D E Output Topic A’ Console
  • 25. Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. Transactions - Consumer view Read committed Consumer A’ C D E A Output Topic A’ Console
  • 26. Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. Transactions - Consumer view Read committed Consumer A’ C D’ E’ A V Output Topic A’, V Console
  • 27. Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. What does it solve? Duplicates due to Zombies 27 Stream Processing Application Consume Process Produce A B C D Input Topic Output Topic offset Topic 1 2 A B C
  • 28. Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. What does it solve? Duplicates due to Zombies 28 Stream Processing Application Consume Process Produce A B C D Input Topic Output Topic offset Topic 1 2 A B C
  • 29. Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. What does it solve? Duplicates due to Zombies 29 Stream Processing Application Consume Process Produce A B C D A’ B’ C’ Input Topic Output Topic offset Topic A’ B’ C’ Stream Processing Application Consume Process Produce A B C
  • 30. Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. What does it solve? Duplicates due to Zombies 30 Stream Processing Application Consume Process Produce A B C D A’ B’ C’ Input Topic Output Topic offset Topic A’ B’ C’ Stream Processing Application Consume Process Produce A B C
  • 31. Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. What does it solve? Duplicates due to Zombies 31 Stream Processing Application Consume Process Produce A B C D A’ B’ C’ A’ B’ C’ Input Topic Output Topic offset Topic A’ B’ C’ Stream Processing Application Consume Process Produce
  • 32. Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. How does it solve it? zombie fencing 32 Application 1 Consume Process Produce A B C D A’ B’ C’ Input Topic Output Topic offset Topic A’ B’ C’ Application 1 Consume Process Produce A B C How do we know that we have a zombie? We give unique transactional.id to every application instance.
  • 33. Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. How does it solve it? zombie fencing 33 Application 1 Epoch 0 Consume Process Produce A B C D A’ B’ C’ Input Topic Output Topic offset Topic A’ B’ C’ Application 1 Epoch 1 Consume Process Produce A B C How do we know who is the zombie? Apps register transactional.id when they start and get an epoch. Newest epoch wins
  • 34. Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. How does it solve it? zombie fencing 34 Application 1 Epoch 0 Consume Process Produce A B C D A’ B’ C’ Input Topic Output Topic offset Topic A’ B’ C’ Application 1 Epoch 1 Consume Process Produce A’, epoch 0 Dude, you are dead.
  • 35. Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. How to use it? (The sane way) Use Kafka Streams with processing.guarantee = exactly_once (If you have broker 2.5+: exactly_once_beta) 35
  • 37. Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. 37 Picking a good transactional.id is non-trivial What is “same instance of app”? In Kafka streams it is “consuming from same partition” Task = consumer + processor + producer exactly_once uses task_id as transactional.id But… - Producer per task is heavy - Need to initialize new producer on every rebalance
  • 38. Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. 38 exactly_once_beta • Does not use transactional.id for fencing • Use consumer group information instead: Group ID Consumer group generation (epoch) • Fencing happens during the offset commit, which includes the consumer group information • Made possible by KIP-477
  • 39. Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. How to use it? (Hard and likely wrong way) 39
  • 40. Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. How to use it? (Hard and likely wrong way) 40
  • 41. What does it solve? The main use-case is accurate aggregation in streams processing applications. Easy to use in any Kafka Streams application.
  • 42. Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. What doesn’t it solve? ● Side-effects during processing ● Reading from Kafka and writing to a database ● Reading from a database and writing to Kafka ● Replicating from one Kafka to another (unless replicating all topics) ● Publish-subscribe pattern (or rather - this depends a lot on the consumer) 42
  • 43. When to avoid it? If it doesn’t fit into a Kafka Streams app, it is probably not a good idea. Don’t keep creating new transactional.id
  • 44. Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. Performance Notes ● Overhead on producer - fixed per transaction: ○ Register transactional.id once in its lifetime ○ Register partition in transaction once per partition per transaction ○ Extra commit marker per partition ○ Synchronous commit ● Consumer: ○ Reads extra commit markers ○ read_committed will wait for transaction commits. Large transactions will increase end to end latency Larger transactions == higher throughput (due to lower overhead), but higher e2e latency 44
  • 46.
  • 47. Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. 47 Two things to remember Use idempotent producer, but not with FaaS. Use Kafka Streams with processing.guarantee = exactly_once Or exactly_once_beta if you have 2.5+ brokers
  • 48. Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. 48 Small Plug The talk is based on a new chapter. Early release is available via O’Reilly Safari. Thanks to Ron Dagostino, Justine Olshan, Lucas Bradstreet, Mike Bin, Bob Barrett, Boyang Chen, Guozhang Wang and Jason Gustafson for all the help.
  • 49. Copyright 2021, Confluent, Inc. All rights reserved. This document may not be reproduced in any manner without the express written permission of Confluent, Inc. Good resources https://github.com/apache/kafka/blob/trunk/tools/src/main/java/org/apache/kafka/tools/Trans actionalMessageCopier.java https://www.confluent.io/blog/enabling-exactly-once-kafka-streams/ https://www.confluent.io/blog/transactions-apache-kafka/ https://www.confluent.io/blog/simplified-robust-exactly-one-semantics-in-kafka-2-5/ https://cwiki.apache.org/confluence/display/KAFKA/KIP-129%3A+Streams+Exactly-Once+Sem antics 49