Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Lightweight and Fault-tolerant: Using compacted topics as a source of truth
Search
Elizabeth Giles
June 14, 2018
Technology
0
83
Lightweight and Fault-tolerant: Using compacted topics as a source of truth
Deck presented at the June 2018 Toronto Kafka meetup
Elizabeth Giles
June 14, 2018
Tweet
Share
Other Decks in Technology
See All in Technology
プロンプトエンジニアリングでがんばらない-Agentic Workflow へ-近藤憲児
kenjikondobai
2
350
レガシーをぶっ壊せ。AEONで始めるDevRelの話 / Qiita Night 2024-2-22
aeonpeople
3
1.3k
AOAI をきっかけに 社内の Azure 管理を見直した話
recruitengineers
PRO
1
280
Yahoo! 知恵袋フロントエンドをリアーキテクトしている話
lycorptech_jp
PRO
1
120
競技としてのKaggle、役に立つKaggle
yu4u
3
590
どうするコスト最適化のトレードオフ
tetsuyaooooo
1
510
地理空間データ可視化・解析・活用ソリューション Pacific Spatial Solutions (PSS)
pacificspatialsolutions
0
230
On Your Data を超えていく!
hirotomotaguchi
2
670
Compose Compiler Metricsを使った実践的なコードレビュー
tomorrowkey
1
220
20分で完全に理解するGrafanaダッシュボード
hamadakoji
3
510
アクセシビリティを考慮したUI/CSSフレームワーク・ライブラリ選定
yajihum
2
1k
自己改善からチームを動かす! 「セルフエンジニアリングマネージャー」のすゝめ
shoota
6
450
Featured
See All Featured
YesSQL, Process and Tooling at Scale
rocio
164
13k
Code Review Best Practice
trishagee
55
15k
Clear Off the Table
cherdarchuk
84
310k
Designing with Data
zakiwarfel
96
4.8k
KATA
mclloyd
15
12k
Facilitating Awesome Meetings
lara
42
5.6k
Automating Front-end Workflow
addyosmani
1356
200k
For a Future-Friendly Web
brad_frost
172
9k
GraphQLとの向き合い方2022年版
quramy
32
12k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
241
1.2M
BBQ
matthewcrist
80
8.8k
A Philosophy of Restraint
colly
197
16k
Transcript
Lightweight and Fault-tolerant: Using compacted topics as a source of
truth Elizabeth Giles · PagerDuty
Context The Problem of Backpressure Compacted Topics Our Solution
None
Ingestion Service Processing Service Ingestion Service Ingestion Service Processing Service
Processing Service Event Event Event Event Event
Context The Problem of Backpressure Compacted Topics Our Solution
Ingestion Service Processing Service Ingestion Service Ingestion Service Processing Service
Processing Service Event Event Event Event Event Event Event Event Event Event Event Event Event Event Event
Ingestion Service Processing Service Ingestion Service Ingestion Service Processing Service
Processing Service Event Event Event Event Event Event Event Event Event Event Event Event Event Event Event Processing Service Ingestion Service HELP!!!
Ingestion Service Processing Service Ingestion Service Ingestion Service Processing Service
Processing Service Event Event Event Event Event Event Event Event Event Event Event Event Event Event Event Processing Service Ingestion Service Customer: Acme Age: 5 minutes Customer: Acme Age: 0 minutes Throttle: Customer: Acme For: 10 minutes To: 20 events/minute
Context The Problem of Backpressure Compacted Topics Our Solution
What happens to Kafka data?
--config cleanup.policy=delete
Topic > Partition > Log Segment > Message
Offset 0 1 2 3 4 5 6 7 Key
“a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 segment.bytes=4, roll.ms=10 1 byte
Offset 0 1 2 3 4 5 6 7 Key
“a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 4 bytes segment.bytes=4, roll.ms=10
Offset 0 1 2 3 4 5 6 7 Key
“a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 10 ms segment.bytes=4, roll.ms=10 4 bytes
Offset 0 1 2 3 4 5 6 7 Key
“a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 10 ms segment.bytes=4, roll.ms=10 10 ms 4 bytes
Offset 0 1 2 3 4 5 6 7 Key
“a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 Current Segment segment.bytes=4, roll.ms=10 10 ms 10 ms 4 bytes
Offset 0 1 2 3 4 5 6 7 Key
“a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 segment.bytes=4, roll.ms=10 S4 S3 S2 S1
Offset 0 1 2 3 4 5 6 7 Key
“a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=delete, retention.bytes=4 S4 S3 S2 S1
Offset 0 1 2 3 4 5 6 7 Key
“a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=delete, retention.bytes=4 S4 S3 S2 S1
Offset 0 1 2 3 4 5 6 7 Key
“a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=delete, retention.bytes=4 S4 S3 S2
Offset 0 1 2 3 4 5 6 7 Key
“a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=delete, retention.ms=10 S4 S3 S2 S1
Offset 0 1 2 3 4 5 6 7 Key
“a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=delete, retention.ms=10 S4 S3 S2 S1
Offset 0 1 2 3 4 5 6 7 Key
“a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=delete, retention.ms=10 S4
--config cleanup.policy=compact
Offset 0 1 2 3 4 5 6 7 Key
“a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=compact S4 S3 S2 S1
Offset 0 1 2 3 4 5 6 7 Key
“a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=compact S4 S3 S2 S1 Clean Dirty Uncleanable Cleanable
Offset 0 1 2 3 4 5 6 7 Key
“a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=compact S4 S3 S2 S1 Clean Key Last Offset “a” 7 “d” 6
Offset 0 1 2 3 4 5 6 7 Key
“a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=compact S4 S3 S2 S1 Key Last Offset “a” 7 “d” 6
Offset 0 1 2 3 4 5 6 7 Key
“a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=compact S4 S3 S2 S1 Key Last Offset “a” 7 “d” 6
Offset 0 1 2 3 4 5 6 7 Key
“a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=compact S4 S3 S2 S1 Key Last Offset “a” 7 “d” 6
Offset 0 1 2 3 4 5 6 7 Key
“a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=compact S4 S3 S2 S1 Key Last Offset “a” 7 “d” 6
Offset 0 1 2 3 4 5 6 7 Key
“a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=compact S4 S3 S2 S1 Key Last Offset “a” 7 “d” 6
Offset 0 1 2 3 4 5 6 7 Key
“a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=compact S4 S3 S2 S1 Key Last Offset “a” 7 “d” 6
Offset 0 1 2 3 4 5 6 7 Key
“a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=compact S4 S1
Offset 1 2 3 6 7 Key “b” “f” “c”
“d” “a” Value 2 3 4 7 8 Time 1 2 3 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=compact S4 S1
segment.bytes=4, roll.ms=10, cleanup.policy=compact, cleaner.min.cleanable.ratio=0.5 Clean Dirty Clean Dirty Clean Dirty
Clean Dirty
segment.bytes=4, roll.ms=10, cleanup.policy=compact, cleaner.min.cleanable.ratio=0.5 Clean Dirty Clean Dirty Clean Dirty
Clean Dirty
segment.bytes=4, roll.ms=10, cleanup.policy=compact, cleaner.min.cleanable.ratio=0.5 Clean Dirty Clean Dirty Clean Dirty
Clean Dirty
Offset 0 1 2 3 4 5 6 7 Key
“a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=compact, cleaner.min.compaction.lag.ms=20 S4 S3 S2 S1
Offset 0 1 2 3 4 5 6 7 Key
“a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=compact, cleaner.min.compaction.lag.ms=20 S4 S3 S2 S1
Offset 1 2 3 5 6 7 Key “b” “f”
“c” “a” “d” “a” Value 2 3 4 6 7 8 Time 1 2 3 25 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=compact, cleaner.min.compaction.lag.ms=20 S4 S3 S1
Offset 0 1 2 3 4 5 6 7 8
9 Key “a” “b” “f” “c” “f” “d” “a” “c” “d” “a” Value 1 2 3 4 null 5 6 null 7 8 Time 0 1 2 3 4 5 25 6 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=compact, cleaner.delete.retention.ms=20 S4 S3 S2 S1
Offset 0 1 2 3 4 5 6 7 8
9 Key “a” “b” “f” “c” “f” “d” “a” “c” “d” “a” Value 1 2 3 4 null 5 6 null 7 8 Time 0 1 2 3 4 5 25 6 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=compact, cleaner.delete.retention.ms=20 S4 S3 S2 S1
Offset 0 1 2 3 4 5 6 7 8
9 Key “a” “b” “f” “c” “f” “d” “a” “c” “d” “a” Value 1 2 3 4 null 5 6 null 7 8 Time 0 1 2 3 4 5 25 6 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=compact, cleaner.delete.retention.ms=20 S4 S3 S2 S1
Offset 1 7 8 9 Key “b” “c” “d” “a”
Value 2 null 7 8 Time 1 6 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=compact, cleaner.delete.retention.ms=20 S4 S3 S1
So… what’s the point?
Context The Problem of Backpressure Compacted Topics Our Solution
Ingestion Service Processing Service Ingestion Service Ingestion Service Processing Service
Processing Service Event Event Event Event Event Event Event Event Event Event Event Event Event Event Event Processing Service Ingestion Service Customer: Acme Age: 5 minutes Customer: Acme Age: 0 minutes Throttle: Customer: Acme For: 10 minutes To: 20 events/minute
Requirements: 1. Processing service can create throttles 2. Ingestion service
can use throttles 3. Resilience to loss of throttle data
Compacted Topics!
Requirements: 1. Processing service can create throttles 2. Ingestion service
can use throttles 3. Resilience to loss of throttle data
What about...
Ingestion Service Processing Service Event Event Event Event Event
Ingestion Service Processing Service Event Event Event Event Event Throttle
Ingestion Service Processing Service Event Event Event Event Event Throttle
Throttle Throttle
Ingestion Service Processing Service Event Event Event Event Event Throttle
Throttle Throttle Throttle
Questions?