Created: November 25, 2026
Redpanda vs. Kafka: How to Test State Rebuild Before Switching Brokers

Consumer lag reaches zero. The API responds normally. Yet a replacement consumer restores a deleted account because its local state and replay history disagree. A broker migration can pass connectivity checks while leaving this recovery path unproven.
For a Data Platform Lead evaluating Redpanda, the useful comparison is whether an existing stateful consumer can reconstruct the business state its owner expects. This article proposes one controlled test: replay a compacted topic on both brokers and reconcile three keys at a fixed checkpoint. You will leave with an expected-state matrix, a recovery boundary, and explicit conditions for approving or stopping the switch.
Key takeaways
- Define a logical checkpoint and expected key values before testing. Save each broker’s corresponding partition position separately.
- Compare the running consumer with a new consumer rebuilding an empty store. Neither equal offsets nor equal row counts proves equivalent state.
- Agree on a completion deadline and tombstone availability window. A stale snapshot needs its own recovery test.
- Stop the switch when a deleted key returns, recovery exceeds the deadline, or the downstream owner cannot accept the evidence. Approve one consumer and configuration at a time.
Compare the brokers for a compacted workload
A Redpanda vs Kafka evaluation should start with the consumer’s state contract. This example assumes keyed replacement values: an update replaces the stored status, and a null value deletes the key. A consumer that calculates totals from every transition needs a different history contract. Identify the downstream store, its owner, and the replacement/delete rules before comparing broker settings; otherwise the test has no authoritative expected result.
Kafka’s 4.2 design documentation describes compaction within a partition: retained records keep their order, while superseded records can disappear. Redpanda’s compaction documentation likewise describes background cleanup and warns that duplicate keys can remain. Consequently, different physical records can still reconstruct identical logical state.
Compare these requirements explicitly:
| Requirement | Kafka baseline | Redpanda candidate |
|---|---|---|
| Keys and ordering | Preserve serialized keys and partition routing | Verify identical key bytes and routing assumptions |
| Cleanup policy | Record effective topic configuration | Verify compact; distinguish compact,delete |
| Deletion visibility | Record delete.retention.ms | Verify topic delete.retention.ms and cluster tombstone_retention_ms |
| Recovery | Rebuild and reconcile the destination | Run the same consumer code and assertions |
Pin actual broker/client versions, serializers, isolation settings, and storage mode. Redpanda’s current documentation distinguishes Tiered Storage v1 and v2 tombstone behavior, including v2 availability from v26.2. Do not apply one configuration recipe across those modes.
AutoMQ’s compatibility guide covers broader ecosystem acceptance; Lucio Durán’s comparison addresses architecture and measurement. This article isolates state reconstruction. For a change in streaming model, use Mad Devs’ Kinesis vs. Kafka comparison.
Run one state rebuild test on both brokers
Use an isolated topic and destination stores. The following is a proposed teaching scenario, not a reported Mad Devs experiment. Its expected results are acceptance assertions, not measured outcomes.
Establish the contract. Create a compact-only topic on each broker with one partition. Keep the application build, schema, and key serialization identical. Define the business invariant: at checkpoint Q, A is paused, B does not exist, and C is active. “Absent” means no stored key, not a row whose status is null.
Publish the fixture. Start an incremental consumer on each broker with an empty store before sending these records in order. Wait for acknowledgments and assign stable application event IDs:
- E1: A → active.
- E2: A → paused.
- E3: B → active.
- E4: B → tombstone, with a genuine null record value.
- E5: C → active.
Do not encode deletion as the string "null" or a JSON object containing a null status. If using multiple partitions later, preserve each key’s routing and capture a boundary for every partition; this fixture deliberately avoids that complexity.
Freeze the boundary. Stop publishing after E5. Define Q as completion of these five acknowledged writes. Save the corresponding next-read position for each broker’s partition. Those positions locate Q locally; matching their numeric values is not an acceptance assertion. Wait until the incremental consumers have applied all available records through Q and their destination writes are durable.
Build clean state. Start a separate consumer identity on each broker, explicitly seeking to the earliest available position. Give it a genuinely empty destination, with no restored snapshot or shared local cache. Apply replacement and deletion semantics until the consumer position reaches the saved next-read position for Q; do not stop merely because one poll returns no records. Keep its state and checkpoints separate from the running consumer.
Compare the entire destination keyset, not just its row count: only A and C should remain. The expected matrix at Q is fully specified:
| Broker and consumer mode | A | B | C |
|---|---|---|---|
| Kafka, incremental | paused | absent | active |
| Kafka, clean rebuild | paused | absent | active |
| Redpanda, incremental | paused | absent | active |
| Redpanda, clean rebuild | paused | absent | active |
Exercise cleanup and timing. Repeat clean reconstruction after observing compaction on closed segments. Do not require exactly three physical records or force both logs into identical layouts. A clean reader can correctly leave B absent when both its earlier value and tombstone have been removed; it must not retain an earlier B value while missing the deletion.
Agree on a read-completion window before running. Kafka documents tombstone visibility for a full scan completed within delete.retention.ms; Redpanda also ties complete tombstone reads to its retention settings. Record elapsed time, effective configuration, and observed cleanup evidence alongside each state comparison. A five-record fixture verifies semantics; representative-volume recovery testing follows.
Use the result to make a switch decision
Treat a correct matrix as the first gate. Next, measure whether a production-sized rebuild can finish within the downstream owner’s recovery deadline. Include destination writes, retries, reconciliation, and restart time. Agree on a retention margin covering the required outage and recovery interval; a passing tiny fixture cannot establish that margin.
Restart both consumer modes with their persisted stores and checkpoints. Interrupt processing between a destination write and checkpoint persistence, then confirm that replay converges without extra business effects. Reconcile values and key absence again. Mad Devs’ data synchronization guidance provides related context for ownership, retries, and consistency.
Test a stale snapshot separately. Suppose it contains B as active before E4. Restore that snapshot and resume from its saved position after the deletion marker has become unavailable. Reading C cannot remove the stale B. If the saved position is no longer available, handle the out-of-range error explicitly; silently resetting to earliest with the stale store can also leave B behind. An empty rebuild passing does not validate this path. Require a tested maximum snapshot age and replay window, an authoritative reconciliation process, or a clean rebuild fallback before accepting snapshot recovery.
Ksolves describes a Kafka-to-Redpanda migration for an unnamed healthcare customer, including consumer-group and data checks. The case does not identify an exact execution date. Its reported outcomes belong to that project and are not expected Mad Devs results or evidence that this fixture passes.
Record a decision for this consumer:
- Proceed to a limited pilot: both modes match Q, restart converges, and recovery fits the agreed window.
- Investigate: configuration, cleanup evidence, or snapshot recovery remains unresolved.
- Stop the switch: B reappears, A is wrong, C is missing, or recovery breaches the deadline.
Require downstream-owner acceptance of the configuration and evidence, plus a rehearsed rollback boundary, before production cutover.
Conclusion
The practical Kafka vs Redpanda decision is whether one consumer can recover its accepted business state under the configuration you intend to run. A healthy API and low lag remain useful signals, but the acceptance artifact is a reconciled destination at Q, supported by restart and recovery-window evidence.
Mad Devs’ public Newo.ai case documents related Kafka and ClickHouse work; it does not establish a Redpanda migration or attribute that project to this article’s author. For your next step, scope a pilot around one critical topic: define its business invariant, build the control dataset, compare both consumer modes, and make an explicit move-or-hold decision before expanding to another workload.
