Batch vs Stream Processing • Kappa Architecture PatternHard⏱️ ~4 min
Kappa Architecture Failure Modes and Edge Cases
Reprocessing Throughput Limits
The most common Kappa failure is underestimating replay time. If your stream processor can only handle 1.5x real time throughput and you need to reprocess 90 days of data, the math is brutal: 90 days at 1.5x speed takes 60 days. During this period, you are running double infrastructure (old and new pipelines), doubling costs and operational risk.
This gets worse if your event log retention is shorter than the reprocessing window. Suppose product asks to recompute 90 days of metrics but your Kafka topic only retains 30 days. Kappa alone cannot do this. You need external cold storage (S3, GCS) or a separate batch system, which erodes Kappa's simplicity advantage. Designing for Kappa means setting retention policies based on your longest expected reprocessing window, not just operational replay needs.
Unbounded State Growth
Many Kappa pipelines maintain per key state: user profiles, session windows, aggregation counters. In a system with 500 million active users and high churn, state can grow to terabytes. Without proper Time To Live (TTL) policies, compaction, and eviction, jobs blow memory or disk limits, causing frequent restarts.
This interacts badly with reprocessing. If your job has 5 terabytes of state and needs to restore from a snapshot, recovery can take hours. Add a long changelog replay on top, and you are looking at half a day of downtime. Production systems mitigate this with incremental snapshots, state partitioning across instances, and RocksDB style compaction, but these add complexity.
Protecting Live Workloads During Replay
Replaying months of data at high throughput can starve real time jobs of cluster resources. Production systems isolate replay jobs on separate clusters or use resource quotas and priority queues. Some teams run replay during off peak hours or throttle replay rate dynamically based on real time job lag.
Without these protections, a poorly tuned reprocessing job can degrade live service latency from 500 milliseconds to 5 seconds, violating Service Level Agreements (SLAs) and impacting users. This is why operational discipline around Kappa reprocessing is as important as the architecture itself.
Replay Time Example
AT 1.5X SPEED
60 days
→
AT 10X SPEED
9 days
⚠️ Common Pitfall: Forgetting to set TTLs on stateful operators. A session window without expiration accumulates abandoned sessions indefinitely, causing out of memory errors after weeks or months.
Event Quality and Schema Drift
Because the event log is the source of truth, bad events propagate everywhere. A misconfigured producer emitting malformed JSON or violating schema constraints causes widespread consumer failures, backlog growth, and silent data corruption in derived views.
Schema evolution is subtle. If a producer adds a required field and consumers are not updated, they crash. If a consumer expects a field that old events lack, it must handle missing data gracefully. Kappa makes these problems more central because there is no separate batch layer to "fix" data later. Teams solve this with schema registries (Confluent Schema Registry, AWS Glue) that enforce compatibility rules and version schemas explicitly.
Exactly Once Semantics and Idempotency
Many stream processors default to at least once delivery. In Kappa, reprocessing uses the same code path, so bugs in deduplication logic can cause double counting when replaying history. If downstream stores do not support idempotent writes (upserts with a unique key), recomputing 30 days of revenue can accidentally double charge totals.
Interviewers probe this: how do you guarantee that replaying the log does not change historical reports? The answer involves transaction IDs, idempotent writes to serving stores, and comparing checksums or row counts between old and new views before switching traffic. Systems like Flink provide exactly once guarantees using two phase commit, but this requires compatible sinks and adds latency.
"The hardest Kappa failure mode is discovering after a 2 week replay that your reprocessed data differs from the original due to non deterministic logic or missing idempotency."
💡 Key Takeaways
✓Replay speed matters: at 1.5x real time, 90 days takes 60 days; at 10x takes 9 days, directly impacting reprocessing feasibility and cost
✓Unbounded state without TTL or compaction can grow to terabytes, causing out of memory errors and hour long recovery times when restoring snapshots
✓Bad events or schema drift propagate everywhere since event log is source of truth; requires schema registries and compatibility enforcement
✓Exactly once semantics during replay require idempotent writes and transaction IDs; otherwise reprocessing can double count or corrupt historical data
📌 Examples
1Job with 5 TB state and no compaction: snapshot restore takes 6 hours, making frequent restarts during debugging impractical.
2Producer emits malformed JSON due to bug, causing 50 downstream consumers to crash and backlog to grow to millions of unprocessed events over 2 hours.
3Replay job without resource isolation starves live traffic, degrading p99 latency from 500ms to 5 seconds and violating SLAs.