Prompt
What do I need to think about if I'm choosing between Kafka, Kinesis, and Pub/Sub for real-time event data?
Latest observation
When choosing between Kafka, Kinesis, and Google Pub/Sub for real-time event data, the main question is less “which is best?” and more “which tradeoffs match my team, cloud, scale, and operating model?”
Here are the big things to think about:
1) Cloud lock-in and portability
- Kafka: most portable. You can run it anywhere: on-prem, any cloud, hybrid.
- Kinesis: AWS-native. Best if you’re already deep in AWS.
- Pub/Sub: GCP-native. Best if you’re already deep in Google Cloud.
If you want to avoid being tied to one cloud provider, Kafka is usually the safest choice.
2) Operational overhead
- Kafka: highest operational burden if self-managed. You need to handle brokers, partitions, scaling, upgrades, monitoring, retention, failures, etc.
- Managed Kafka options (Confluent Cloud, MSK, Aiven, etc.) reduce this.
- Kinesis: low ops. AWS manages most of it.
- Pub/Sub: very low ops. Fully managed and simple to use.
If your team wants minimal infrastructure management, Pub/Sub and Kinesis are easier than Kafka.
3) Throughput, scaling, and ordering
- Kafka:
- Very strong throughput.
- Ordering is guaranteed within a partition.
- You control partitions and can scale by adding more.
- Kinesis:
- Scales via shards or on-demand mode.
- Ordering is guaranteed within a shard.
- Can require shard planning/tuning.
- Pub/Sub:
- Very scalable and flexible.
- Ordering is available, but only if you use ordering keys and accept the constraints.
- Good for broad fan-out and elastic workloads.
If you need very high throughput with fine-grained control, Kafka is often strongest. If you want elastic managed scaling, Pub/Sub is attractive.
4) Delivery semantics and guarantees
All three are commonly used for “at least once” delivery patterns.
- Kafka:
- Strong ecosystem for exactly-once processing, but it depends on your client setup and downstream processing.
- Kinesis:
- At-least-once; duplicates can happen.
- Pub/Sub:
- At-least-once by default; duplicates can happen.
- Exactly-once delivery is available in some GCP Pub/Sub configurations/features, but you still need to design carefully.
In practice, you should assume duplicates and make consumers idempotent unless you have a very specific setup.
5) Consumer model and fan-out
- Kafka:
- Great when multiple consumer groups need the same data independently.
- Replay is a first-class concept.
- Kinesis:
- Supports multiple consumers, but the experience is generally less flexible than Kafka.
- Pub/Sub:
- Very good for fan-out and decoupling many consumers from publishers.
If you have many downstream systems that need the same events, Kafka and Pub/Sub are especially strong.
6) Replay and retention
- Kafka:
- Excellent for replaying streams. Retention is configurable, and replay is built in.
- Kinesis:
- Retention exists, but it’s more limited than Kafka in typical setups.
- Pub/Sub:
- Retention is available, but Pub/Sub is more message-queue-like than log-centric compared with Kafka.
If your use case needs “reprocess the last 7 days of events” or analytics backfills, Kafka is often the easiest fit.
7) Ecosystem and integrations
- Kafka:
- Largest ecosystem by far.
- Lots of connectors, stream processing tools, CDC tools, and community support.
- Kinesis:
- Good AWS integrations, but smaller ecosystem outside AWS.
- Pub/Sub:
- Strong integration with GCP services like Dataflow, BigQuery, Cloud Functions, Cloud Run.
Choose based on where your data pipelines already live.
8) Cost model
Cost depends heavily on your traffic pattern.
- Kafka:
- Can be cost-effective at scale, but operational cost can be high.
- Managed Kafka can be expensive.
- Kinesis:
- Simple pricing model, but shard-based costs can grow if you overprovision.
- Pub/Sub:
- Often cost-effective for bursty workloads and low ops overhead.
- Pricing is usually easier to reason about than Kafka infrastructure.
If you expect spiky traffic, managed serverless systems can be easier to budget around, but you should model real message volume, payload size, and retention.
9) Latency requirements
- All three can support low-latency eventing.
- Kafka often performs very well for steady high-throughput low-latency pipelines.
- Kinesis and Pub/Sub are also suitable for real-time use cases, but exact latency will depend on configuration, batching, consumer behavior, and region/network setup.
If you need consistently very low latency and high throughput with tight control, Kafka is often a strong candidate.
10) Security, compliance, and enterprise controls
Think about:
- encryption at rest/in transit
- IAM and access controls
- private networking
- audit logs
- tenant isolation
- compliance requirements
All three support enterprise security, but your org’s existing cloud security model often makes one easier than the others.
11) Team skillset
This is a big one.
- If your team already knows Kafka, using it may be the fastest path despite operational complexity.
- If your team is mostly on AWS, Kinesis reduces friction.
- If you are on GCP, Pub/Sub is usually the simplest.
The “best” system is often the one your team can operate and troubleshoot confidently.
A simple rule of thumb
Choose Kafka if:
- you want portability across clouds/on-prem
- you need strong replay and log semantics
- you have multiple downstream consumers and complex streaming needs
- you want the richest ecosystem
- you can handle operational complexity or use a managed Kafka service
Choose Kinesis if:
- you are primarily on AWS
- you want managed real-time streams with minimal ops
- your architecture fits AWS-native services well
- you’re okay with a more AWS-specific streaming model
Choose Pub/Sub if:
- you are primarily on GCP
- you want very low ops and easy scaling
- you need simple global-ish event distribution/fan-out
- you’re integrating with Dataflow/BigQuery/Cloud Run/Cloud Functions
Questions to ask before deciding
- What cloud are we already committed to?
- Do we need portability or hybrid deployment?
- Do we need replay/backfill over long retention windows?
- How many consumers will read the same events?
- How much operational burden can we take on?
- What’s our peak throughput and message size?
- Do we need strict ordering, and at what granularity?
- How important are managed integrations with our analytics stack?
- What’s our tolerance for duplicates and idempotency handling?
- Do we have Kafka expertise already?
If you want, I can also give you a comparison table or help you choose based on your specific workload, like “high-volume event tracking,” “CDC pipeline,” or “real-time analytics.”