ref: decrease Kafka log retention hours - #4442
Open
aldy505 wants to merge 1 commit into
Open
Conversation
This is coming from a discussion from @jan-auer on Slack. He figured that it would be fine (or perhaps better) if the retention hours is set to 1 hour. I have a personal argument that 1 hour might not be enough for folks running in bigger volume and therefore slower processing time, therefore this 3 hours is a compromise. To apply the change, the easiest way is to delete the Kafka volume, and let the `install.sh` script recreate it. But you can also do it manually using the kafka CLI: ```bash for topic in $(docker compose exec kafka kafka-topics \ --bootstrap-server kafka:9092 \ --list); do docker compose exec kafka kafka-configs \ --bootstrap-server kafka:9092 \ --entity-type topics \ --entity-name $topic \ --alter \ --add-config retention.ms=86400000 done ````
| # Lower the log retention to 1 hours to avoid filling up the disk, | ||
| # ONLY IF you have fast processing time and/or small data volumes. | ||
| # Otherwise, you can set it to a higher value if you have much slower | ||
| # processing time and/or larger data volumes. |
There was a problem hiding this comment.
Bug: The manual migration script in the PR description uses an incorrect retention.ms value (24 hours) instead of the intended 3 hours.
Severity: MEDIUM
Suggested Fix
In the pull request description, correct the manual migration command to use retention.ms=10800000 instead of retention.ms=86400000 to align with the intended 3-hour retention period.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: docker-compose.yml#L216
Potential issue: The manual migration script provided in the pull request description
contains an incorrect value. It instructs users to set `retention.ms` to `86400000`,
which is 24 hours, instead of the intended 3 hours. Users who follow this manual
migration path will not get the benefit of the reduced log retention, as the topic-level
configuration will override the new 3-hour broker-level default. This undermines the
primary goal of the pull request, which is to reduce disk usage.
Did we get this right? 👍 / 👎 to inform future reviews.
aminvakil
reviewed
Aug 1, 2026
| KAFKA_OFFSETS_TOPIC_NUM_PARTITIONS: "1" | ||
| KAFKA_LOG_RETENTION_HOURS: "24" | ||
| # Lower the log retention to 1 hours to avoid filling up the disk, | ||
| # ONLY IF you have fast processing time and/or small data volumes. |
Collaborator
There was a problem hiding this comment.
For small data volumes, 1 hour and 3 hours do not make much of a difference.
I would say let's make 3 hours default and keep higher value note below.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is coming from a discussion from @jan-auer on Slack. He figured that it would be fine (or perhaps better) if the retention hours is set to 1 hour. I have a personal argument that 1 hour might not be enough for folks running in bigger volume and therefore slower processing time, therefore this 3 hours is a compromise.
To apply the change, the easiest way is to delete the Kafka volume, and let the
install.shscript recreate it. But you can also do it manually using the kafka CLI: