Both are publish/subscribe messaging systems. The difference is model, control, and ops.
Kafka
- You (or your platform team) run a cluster of brokers (or a managed Kafka like MSK / Confluent Cloud).
- Core abstraction: durable partitioned log with offsets.
- Consumers pull and control pace; can replay by resetting offsets.
- Strong story for ordering per key/partition, exactly-once streams, Connect, Streams.
- More knobs: partitions, ISR, retention, consumer groups, rebalances.
Cloud Pub/Sub (Google-style)
- Fully managed service: less cluster babysitting.
- Abstraction: topics + subscriptions.
- Often push or pull delivery; acks are at message/subscription level rather than "log offset" thinking.
- Excellent for serverless / GCP-native apps.
- Replay and ordering exist, but the mental model differs from Kafka's partition log.
Kafka: append to log → consumers track offsets Pub/Sub: publish message → subscription delivers → ack
When interviews want contrast
| Concern | Lean Kafka | Lean Pub/Sub | |---|---|---| | Replay / log semantics | Natural | Possible, different UX | | Self-managed control | High | Low (managed) | | Ecosystem (Connect, Streams) | Rich | Cloud-native integrations | | Multi-cloud / on-prem | Strong | Cloud-tied |
Interview tip: "Both are pub/sub. Kafka is a partitioned commit log with offset-based consumers; cloud Pub/Sub is a managed topic/subscription service with less ops and a different delivery model."