Skip to content

Instantly share code, notes, and snippets.

@dmusicant-dk
Created June 13, 2023 19:10
Show Gist options
  • Save dmusicant-dk/70592eca1057ea25bb14621cd5df1520 to your computer and use it in GitHub Desktop.
Save dmusicant-dk/70592eca1057ea25bb14621cd5df1520 to your computer and use it in GitHub Desktop.
Description Use Case
Delete
  • Retains messages for a fixed period of time or size of the partition
  • Fixed period is set by the Topic's log.cleaner.delete.retention.ms|minutes|hours
  • Fixed size of partition is set by Topic's retention.bytes
  • It can be a combination of time and size
  • Where data isn't needed (or shouldn't be retained) beyond a specific amount of time or size
  • e.g. adhere to data privacy retention laws or this data not needed after a certain period
  • Compact
    • Keeps only the most latest version of a message "instance"
    • Messages are identified by their key for versioning
    • This does not prevent message duplication
    • Compaction works only per partition, if you will have message with the same key in different partitions - it will not be compacted
    • Messages can be deleted only by application
  • Where only the "freshest" data is going to be used and the application will decide what data should be deleted
  • e.g. real-time data, information regarding sessions
  • Delete,Compact
    • Combination of both Delete and Compact policies.
  • Where only the "freshest" data is going to be used and it is should be retained by time or size
  • e.g cache data, we need only fresh state for the last 2 days
  • Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment