Retention Policy
In this microlearning, we will explore how retention policies manage the lifecycle of messages in your streaming system. Specifically, we will focus on the factors that influence when messages are cleaned up and the actions taken when this occurs.
Should you have any questions, please get in touch with academy@emagiz.com.
1. Prerequisites
- Intermediate knowledge of the eMagiz platform
2. Key concepts
This microlearning centers on the retention policy for Event Streaming.
3. Event Streaming
In this microlearning, we will dive a little bit deeper into the concept of the retention policy concerning Event Streaming. Retention policy determines when a message needs to be cleaned up and, if so, what will happen to the message.
- The key aspects are:
- Retention Hours
- Retention Bytes
- Cleanup Policy
- These three items determine the retention policy
As we learned in the introductory microlearning, the topic holds a log with a sequence of messages. Based on several criteria, the broker decides when to remove messages from the back of the log to ensure that the topic stays within specific parameters. These parameters are the retention hours and the retention bytes. If you want to learn more about them specifically, please check out this microlearning.
These parameters combined with the cleanup policy determine what happens with a message after it is expired. There are two options available:
- delete
- compact
The delete option is the default that eMagiz uses and advises. This option will, as the name suggests, delete all messages that are expired. There is an alternative approach called compact. This functionality will enable log compaction on the topic.
These three aspects above combine to make up the retention policy. Defining the correct values for both the retention hours and the retention bytes is a science as a form of art. As you only have limited storage capacity available, the challenge becomes how much retention you reserve per topic. The more you assign, the less free storage capacity remains for other topics. As a consequence, you need to strive to optimize your retention policy per topic continually.
4. Key takeaways
- Retention Hours: Defines how long messages are kept before they are eligible for cleanup.
- Retention Bytes: Specifies the maximum amount of storage space allocated for messages before older ones are removed.
- Cleanup Policy: Determines the method of message removal once the retention criteria are met. The default policy is to delete expired messages, though an alternative, compact, is not used in eMagiz.
5. Suggested Additional Readings
If you are interested in this topic and want more information on it, please read the help text provided by eMagiz when executing these actions and browse through the following links: