Topic Configs
Topic-level configurations can be set when creating a topic (via CreateTopics API) or modified later (via IncrementalAlterConfigs API). These override broker-level defaults.
Setting topic configs
Section titled “Setting topic configs”On creation
Section titled “On creation”Most Kafka client admin tools support setting configs at topic creation time:
# Using kafka-topics.sh (from Kafka distribution)kafka-topics.sh --bootstrap-server localhost:9092 \ --create --topic my-topic \ --partitions 6 \ --config retention.ms=86400000 \ --config cleanup.policy=compactModifying existing topics
Section titled “Modifying existing topics”# Using kafka-configs.shkafka-configs.sh --bootstrap-server localhost:9092 \ --alter --entity-type topics --entity-name my-topic \ --add-config retention.ms=172800000Or use any Kafka admin client library (franz-go, confluent-kafka, etc.) with the IncrementalAlterConfigs API.
Supported configs
Section titled “Supported configs”| Config | Type | Default | Description |
|---|---|---|---|
cleanup.policy | string | delete | delete — remove old segments by time/size. compact — retain only latest value per key. compact,delete — both. |
compression.type | string | producer | Compression for stored data: producer (preserve client compression), none, gzip, snappy, lz4, zstd. |
retention.ms | long | 604800000 (7d) | Maximum age of data in milliseconds. -1 for infinite retention. |
retention.bytes | long | -1 (infinite) | Maximum size per partition in bytes. Oldest segments are deleted when exceeded. |
max.message.bytes | int | 1048588 | Maximum size of a single RecordBatch in bytes. Larger batches are rejected with MESSAGE_TOO_LARGE. |
segment.bytes | int | 67108864 (64M) | Accepted for compatibility. klite does not use segment-based rotation; S3 flush is time-based via --s3-flush-interval. |
message.timestamp.type | string | CreateTime | CreateTime — use the timestamp set by the producer. LogAppendTime — overwrite with the broker’s wall clock time. |
Config details
Section titled “Config details”cleanup.policy
Section titled “cleanup.policy”Controls how old data is removed:
delete(default) — Segments are deleted when they exceedretention.msorretention.bytes.compact— The background compaction process retains only the latest record for each key. Useful for changelog and snapshot topics.compact,delete— Both strategies apply. Data is compacted, and segments older than the retention window are deleted.
compression.type
Section titled “compression.type”producer(default) — klite stores batches exactly as received from the producer, preserving whatever compression the client used.- Explicit values (
gzip,snappy,lz4,zstd,none) — klite re-compresses batches in the specified format before storage. This has a CPU cost.
In practice, producer is almost always the right choice. Set an explicit value only if you need to enforce a specific compression format.
retention.ms
Section titled “retention.ms”# 24 hoursretention.ms=86400000
# 30 daysretention.ms=2592000000
# Infinite (never delete)retention.ms=-1retention.bytes
Section titled “retention.bytes”Per-partition size limit. When a partition exceeds this size, the oldest segments are deleted.
# 1 GB per partitionretention.bytes=1073741824
# Infinite (no size limit, only time-based)retention.bytes=-1message.timestamp.type
Section titled “message.timestamp.type”CreateTime— The producer sets the timestamp. Useful for event time processing.LogAppendTime— The broker overwrites the timestamp with the time the batch was appended. Useful for ingestion time processing.
Viewing topic configs
Section titled “Viewing topic configs”# Using kafka-configs.shkafka-configs.sh --bootstrap-server localhost:9092 \ --describe --entity-type topics --entity-name my-topicConfigs accepted but not enforced
Section titled “Configs accepted but not enforced”The following Kafka topic configs are accepted (stored and returned by DescribeConfigs) but have no effect on klite’s behavior:
| Config | Reason |
|---|---|
min.insync.replicas | Single broker; no ISR concept. Always effectively 1. |
unclean.leader.election.enable | Single broker; no leader election. |
flush.messages | klite manages fsync via its own batching window. |
flush.ms | klite manages fsync via its own batching window. |
index.interval.bytes | klite uses its own indexing strategy. |
segment.ms | WAL rotation is managed internally. |
min.compaction.lag.ms | Accepted, behavior may differ. |
max.compaction.lag.ms | Accepted, behavior may differ. |
min.cleanable.dirty.ratio | Accepted, behavior may differ. |
Next steps
Section titled “Next steps”- Configuration — broker-level configuration
- Supported APIs — API compatibility reference
- Storage — how retention and compaction work internally