Skip to content

Instantly share code, notes, and snippets.

@dmusicant-dk
Created June 13, 2023 21:53
Show Gist options
  • Save dmusicant-dk/1093a96fcb26891ee1b9942a2484b60a to your computer and use it in GitHub Desktop.
Save dmusicant-dk/1093a96fcb26891ee1b9942a2484b60a to your computer and use it in GitHub Desktop.
Details Why / Benefits
Partition
  • A way of breaking up a topic's messages into separate, distributed, "logs"
  • Partitions can live on different nodes in the cluster
  • If a message has no key, it is distributed "round-robin" into a partition
  • If a message has a key, its hash is used to determine which partition it's written to
  • Enables scaling reads/writes across diff nodes
  • Removes single bottlenecks
  • Guarantees messages of the same key are always on the same partition (to guarantee order and efficiency)
Segment
  • A collection of messages within a partition
  • Is the way partitions are efficiently broken down to store messages
  • Each partition is divided into "segments"
  • There is always an active segment to write messages into
  • When the active segment reaches the limit (determined by your configuration), it's closed and a new active segment created
  • Enables a partition to store messages across many files instead of one massive file
  • Make cleanup much more efficient
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment