Apache Kafka Streaming (50 Qs)•Part 3: Advanced Internals, Scale & Production Architecture (Senior / Lead)
Kafka Streams vs Apache Flink vs Spark Streaming: Architecture, state management (RocksDB), and stream-table duality.
senior LevelMost AskedState ManagementSystem DesignApache Kafka
In Simple Words:
- Kafka Streams: A lightweight client Java library that runs directly inside your application microservice. No separate cluster needed. Uses embedded RocksDB for stateful aggregations (joins, windowing). Best for event-driven microservices.
- Apache Flink: True event-driven, distributed stream processing cluster with native support for complex event processing, out-of-order watermarks, and massive multi-terabyte state snapshots (Savepoints).
- Spark Streaming (Micro-Batching): Batches streaming data into discrete mini-intervals (e.g. 500ms). Best for unifying large-scale batch ETL with streaming analytics.
- Stream-Table Duality: A
KStreamrepresents an append-only changelog stream; aKTablerepresents the current materialized view state. You can convert between them bidirectionally.