This guide was written originally for dFlow~IQ. Authoritative sources were used to verify technical facts and are credited in the references section. Source wording is not reproduced.
Start with the workload contract
Document event meaning, owners, key, schema, ordering requirement, expected rate, record-size distribution, replay window, failure tolerance and data classification before creating a topic.
Decide whether the stream represents immutable history, current keyed state, commands or transient transport. That decision drives cleanup policy and key design.
Size partitions from measured constraints
Partition count limits conventional group parallelism and divides ordering domains. Estimate the count from tested per-partition throughput and required active consumers, then check key skew and broker capacity.
Kafka can increase but not reduce partition count in place. Existing records are not redistributed, and default key mapping may change for future records. Treat expansion as an ordering-affecting operation.
throughput partitions = ceil(peak throughput / tested throughput per partition)
required partitions = max(throughput partitions, required active consumers)Design replication and minimum ISR together
Replication factor controls assigned copies. Minimum ISR sets the healthy-replica threshold for producers using acks=all. With replication factor 3 and minimum ISR 2, one replica may leave ISR while durable writes continue; another loss stops those writes.
Lowering minimum ISR during an incident restores availability by accepting weaker durability. Make that trade-off explicit rather than treating it as a harmless fix.
Set retention from replay and capacity
Delete retention removes eligible log segments by age or per-partition size. It is asynchronous and segment based, so it is not a precise deletion timer. Set it from the longest acceptable consumer outage, recovery needs and storage budget.
Increasing retention preserves future data for longer but cannot restore data already removed. Reducing it can make old segments eligible for irreversible deletion shortly after the change.
retained broker bytes × replication factor
partition imbalance and operational headroomChoose delete, compact or both
Compaction is eventual. Several values for one key can coexist until cleaning occurs. A keyed null value is a tombstone that announces deletion; it must remain long enough for rebuilding consumers to observe it.
| Policy | Best suited to |
|---|---|
| delete | Bounded event history and replay |
| compact | Latest keyed state |
| compact,delete | Latest state with bounded historical lifetime |
Align message-size limits end to end
Topic max.message.bytes limits accepted record batches after compression, not simply a JSON document's character count. Producer request, consumer fetch and replica-fetch limits must all support the intended maximum.
Large records increase memory pressure, latency and retry cost. Prefer object storage plus a validated reference for large binary objects when the business consistency model permits it.
Use a safe change checklist
- Confirm cluster, topic and environment; capture current metadata and overrides.
- Identify producer and consumer owners and record peak rate, size percentiles, lag and partition skew.
- State the intended behaviour, risk and measurable success criteria.
- Test on a representative non-production topic when feasible.
- Apply one behavioural change at a time through the approved admin path.
- Monitor ISR, produce errors, latency, disk use and consumer lag.
- Re-describe effective configuration and verify all replicas return to ISR.
- Produce and consume an approved canary, then retain the before-and-after evidence.
Investigate and verify with dFlow~IQ
- Open the exact workspace and inspect the topic's partition and configuration details.
- Browse a bounded sample to assess key distribution, payload size and partition placement.
- Use precise offsets around the incident or deployment instead of Latest alone.
- Correlate record evidence with broker and consumer metrics from your monitoring platform.
- Apply approved administrative changes outside dFlow~IQ where required.
- Refresh the topic and verify the effective settings.
- Use a uniquely keyed canary or bounded test to verify resulting behaviour.
dFlow~IQ can delete a topic. The action is broker-side and irreversible; use it only with explicit approval and verified environment identity.
References
References support factual claims in this original guide. They are not required reading.
- Apache Kafka: Introduction Used to verify Kafka's record, topic, partition, producer, consumer and replication model.
- Apache Kafka: Design Used to verify log storage, delivery semantics, replication and compaction behaviour.
- Apache Kafka: Topic Configuration Used to verify cleanup, retention, message-size and minimum ISR settings.
- Apache Kafka: Basic Operations Used to verify partition alteration and topic administration behaviour.