ApsaraMQ for Kafka automatically deletes old messages based on disk usage and retention settings. As disk usage increases, cleanup escalates from scheduled deletion of expired messages to forced purging, and eventually to write-protection. This prevents server breakdowns due to insufficient disk capacity.
If you receive a Queue full error or a "disk full" message when writing to a topic, the instance has triggered one of these cleanup policies.
Cleanup policies by instance and topic type
Cleanup behavior depends on the instance edition (Non-Serverless or Serverless) and, for Non-Serverless instances, the topic storage type (cloud storage or local storage).
Non-Serverless instances with cloud storage topics
| Disk usage | Behavior |
|---|---|
| Below 75% | Messages that exceed the Message Retention Period are deleted at 04:00 daily. |
| 75%--85% | Messages that exceed the Message Retention Period are deleted periodically until disk usage drops below 75%. |
| 85%--90% | The earliest messages are purged in chronological order, regardless of whether they have exceeded the Message Retention Period. |
| 90% or above | The service enters write-protection. No new messages can be written. |
Non-Serverless instances with local storage topics
| Disk usage | Behavior |
|---|---|
| Below 83% | Messages are deleted based on the configured TTL. |
| 83%--88% | Up to 10% of stored messages in each partition are purged in chronological order, regardless of the message retention period. |
| 88% or above | The service enters write-protection. No new messages can be written. |
Serverless instances
Messages are deleted based on the configured TTL. No disk-usage-based cleanup thresholds apply.
Recommended disk usage
To maintain enough headroom for message backtracking and prevent forced purging or write-protection, keep disk usage at 70% or lower.
Message cleanup is managed dynamically. Manual deletion is not supported.
Monitor disk usage
Check disk usage on the Instance Details page under . For details, see Cloud Monitor.
In scenarios with small disk capacity and high traffic, the displayed monitoring data may drift from the actual value.
The Total Messages on Current Server metric on the Topic Details page shows the total number of unexpired messages sent to the topic. This metric is not used as a basis for the cleanup policy.
What to do when the disk is full
Wait for expired messages to be automatically deleted.
Upgrade the instance to increase disk capacity. For details, see Upgrade instance configurations.