Das Commit Log: So speichert Kafka Daten
Lernen Sie, wie Kafka Nachrichten als ausschließlich erweiterbares Commit Log speichert, wie Offsets und Aufbewahrung funktionieren und warum dieses Design Kafka schnell und robust macht.
Das Commit Log: So speichert Kafka Daten ist eine kostenlose Apache Kafka & Stream Processing Fundamentals-Lektion auf CoddyKit. Dies ist Lektion 4 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des Apache Kafka & Stream Processing Fundamentals-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der Apache Kafka & Stream Processing Fundamentals-Kurs umfasst insgesamt 4 Lektionen.
Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.
Kafka Is a Log
At its core Kafka is a distributed, append-only commit log. Producers append to the end and data is never modified in place — that's the secret to its speed and durability.
Append-Only Writes
Every record is written sequentially to the end of a partition's log. Sequential disk writes are far faster than random ones, sustaining high throughput on cheap disks.
The Offset
Each record gets a monotonically increasing offset — its position in the partition. Offsets are unique within a partition and never reused.
Partition 0: [off 0][off 1][off 2][off 3] -> next write off 4Reads Don't Delete
Unlike a queue, consuming a record does not delete it. Many consumers read the same log independently, each tracking its own offset.
Log Segments
A partition log is split into segment files on disk. Only the active segment is written to; older segments are immutable and can be deleted or compacted.
00000000000000000000.log
00000000000000010000.logRetention by Time
Kafka keeps data for a configurable period regardless of whether it's consumed. The default retention is 7 days.
retention.ms=604800000Retention by Size
You can also cap a partition by size. Whichever limit hits first — time or bytes — triggers deletion of the oldest segments.
retention.bytes=1073741824Log Compaction
Instead of deleting by age, compaction keeps only the latest record per key — perfect for changelog topics where you just want each key's current value.
cleanup.policy=compactZero-Copy Reads
Kafka serves reads straight from the OS page cache to the network using zero-copy, skipping extra memory copies. Another big reason consumption is so fast.
Durability via Flush and Replicas
Records are durable because they're written to disk and replicated to other brokers. Even if the OS cache is lost, replicas preserve the data.
Putting It Together
The commit log explains Kafka's character: sequential writes for speed, offsets for replayable reads, retention and compaction for storage, replication for durability.
Quick Check
Test your understanding of the commit log.
Recap
You learned Kafka's storage: an append-only commit log with stable offsets, reads that don't delete, retention plus compaction, and replication for durability.
Häufig gestellte Fragen
Ist die Lektion „Das Commit Log: So speichert Kafka Daten“ kostenlos?
Ja — der vollständige Text von „Das Commit Log: So speichert Kafka Daten“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des Apache Kafka & Stream Processing Fundamentals-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der Apache Kafka & Stream Processing Fundamentals-Kurs umfasst insgesamt 4 Lektionen.
Was lerne ich in „Das Commit Log: So speichert Kafka Daten“?
Lernen Sie, wie Kafka Nachrichten als ausschließlich erweiterbares Commit Log speichert, wie Offsets und Aufbewahrung funktionieren und warum dieses Design Kafka schnell und robust macht. Du übst Apache Kafka & Stream Processing Fundamentals mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.
Brauche ich Erfahrung, um Apache Kafka & Stream Processing Fundamentals zu starten?
Keine Vorkenntnisse erforderlich. Apache Kafka & Stream Processing Fundamentals auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 4 von 4.
Wie lange dauert die Lektion „Das Commit Log: So speichert Kafka Daten“?
Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.
Kann ich in dieser Apache Kafka & Stream Processing Fundamentals-Lektion Code schreiben und ausführen?
Ja. Jede Apache Kafka & Stream Processing Fundamentals-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.
Alle Lektionen in diesem Kurs
- Was ist Apache Kafka?
- Kafka-Grundkonzepte: Broker und Topics
- Kafka lokal einrichten
- Das Commit Log: So speichert Kafka Daten