All Products
Search
Document Center

ApsaraMQ for Kafka:Why is an expired message retained?

Last Updated:Aug 11, 2023

Problem description

A message that you sent can still be queried on the ApsaraMQ for Kafka broker even though the retention period of the message expires.

Note

The Message Retention Period parameter specifies the maximum period that messages can be retained if the disk capacity is sufficient. Valid values: 24 to 480. Default value: 72. Unit: hours. If the disk usage reaches 85%, the system deletes messages from the earliest stored ones to ensure service availability, regardless of whether the value that is specified by the Message Retention Period is reached.

Cause

  • The size of the message segment is smaller than 1 GB.

    Note

    To prevent storage fragmentation, messages are stored in the form of segments. By default, a segment can be up to 1 GB in size. The system deletes segments to delete messages. If the size of a segment does not reach the maximum size allowed, the message involved is retained.

  • The disk usage is lower than 75%. In this case, messages are retained until the scheduled time for ApsaraMQ for Kafka to delete expired messages arrives.

    Note

    If the disk usage of an ApsaraMQ for Kafka instance is lower than 75%, ApsaraMQ for Kafka deletes expired messages on the instance at 4: 00 a.m. every day.