Video in progress
For stream processing, how do you choose between a plain consumer, Kafka Streams and Flink?
Plain consumer / Kafka Streams / Flink — Deploy: the service itself / the service itself (a library) / a separate cluster / operator; State: yours (DB) / local RocksDB + changelog topic / large state with checkpoints; Sources: Kafka / Kafka only / Kafka, CDC, files, DB...; Exactly-once: manual / exactly_once_v2 /…
📖 Answer
| Plain consumer | Kafka Streams | Flink | |
|---|---|---|---|
| Deploy | the service itself | the service itself (a library) | a separate cluster / operator |
| State | yours (DB) | local RocksDB + changelog topic | large state with checkpoints |
| Sources | Kafka | Kafka only | Kafka, CDC, files, DB... |
| Exactly-once | manual | exactly_once_v2 |
checkpoint + transactional sink |
| Load on the team | low | medium | high |
How I think about it:
- "Read each event, write to the DB, respond": a plain consumer. That's 80% of this kind of work.
- "The number of transactions per card in the last 5 minutes", joining two topics by key, state as a
KTable: Kafka Streams. It lives inside a Java service, it's easy with Spring Boot, and the operational load is minimal. But moving state to another instance (restore) takes a long time with a big state; standby replicas soften that. - Terabytes of state, complex event-time windows, serious handling of late data, sources outside Kafka, streams that analysts write in SQL: Flink.
The organizational factor is strong here too: who runs the Flink cluster? If there's no platform team, starting with Kafka Streams is safer. One drawback of Kafka Streams is that it works only with Kafka, and changing the topology (adding a new operator) can change the internal topic names and lose the state; so you need to give operators explicit names (Named.as(...)).
Sign up to mark studied questions and save your progress.