Kafka vs Pulsar vs Redpanda vs Kinesis: Trade-offs
Difficulty: Staff | Asked at: Architecture interviews, Cloud companies
âšī¸Interview Context
This question tests your ability to evaluate system trade-offs. Interviewers want to see you can objectively compare technologies and recommend solutions based on specific requirements.
The Question
Compare Apache Kafka with Apache Pulsar, Redpanda, and Amazon Kinesis. What are the architectural differences? When would you choose each alternative over Kafka?
Architecture Comparison
Every system in this comparison solves the same problem, which is durable ordered logs at scale, and each one draws the boundary between storage and coordination differently. Kafka puts the log at the centre and makes brokers stateful, so partition replicas live on specific brokers and the controller only tracks which broker owns what. Pulsar separates the two: brokers are stateless because segments live in BookKeeper, which lets storage expand independently of the serving layer and makes some failures trivial to absorb. Redpanda keeps Kafka's storage model but removes the JVM and the zoo of side processes, replacing them with a single C++ binary and a thread-per-core scheduler. Kinesis hides all of that behind a managed API with fixed shard limits, trading control for operations you never have to staff. Those structural choices are what produce the operational differences in the sections below, so evaluate them before comparing benchmark numbers.
Apache Kafka
Kafka uses a broker-based architecture where each broker stores partition logs on local disk. Metadata managed by ZooKeeper or KRaft.
kafka_architecture = {
'storage': 'Local disk (append-only log)',
'metadata': 'ZooKeeper or KRaft',
'protocol': 'Custom binary (Kafka protocol)',
'scaling': 'Add brokers, rebalance partitions',
'state': 'Brokers are stateful'
}
Apache Pulsar
Pulsar separates compute (brokers) from storage (BookKeeper). Brokers are stateless; Bookies handle persistence.
pulsar_architecture = {
'storage': 'Apache BookKeeper (segment-based)',
'metadata': 'ZooKeeper',
'protocol': 'Custom binary (Pulsar protocol)',
'scaling': 'Add brokers independently of bookies',
'state': 'Brokers stateless, Bookies stateful'
}
Redpanda
Redpanda is C++ reimplementation with Raft consensus built-in. No ZooKeeper dependency. Kafka API compatible.
redpanda_architecture = {
'storage': 'Local disk (Raft-replicated)',
'metadata': 'Raft consensus (no ZK)',
'protocol': 'Kafka API compatible',
'scaling': 'Add nodes, Raft handles replication',
'state': 'Nodes stateful with Raft groups'
}
Amazon Kinesis
Kinesis is a fully managed service. AWS handles all infrastructure. shard-based scaling.
kinesis_architecture = {
'storage': 'Managed (AWS internal)',
'metadata': 'Managed (AWS internal)',
'protocol': 'AWS SDK',
'scaling': 'Add/remove shards',
'state': 'Fully managed, no state visible'
}
Architecture Matrix
| Feature | Kafka | Pulsar | Redpanda | Kinesis |
|---|---|---|---|---|
| Compute/Storage | Coupled | Decoupled | Coupled | Managed |
| Metadata | ZK/KRaft | ZooKeeper | Raft | AWS |
| Protocol | Kafka | Pulsar | Kafka-compatible | AWS SDK |
| Language | Java | Java | C++ | N/A |
| License | Apache 2.0 | Apache 2.0 | BSL | Proprietary |
âšī¸Key Architectural Difference
The fundamental difference is compute-storage coupling. Kafka couples them, making scaling simpler but less flexible. Pulsar decouples them, enabling independent scaling but adding complexity.
Feature Comparison
Feature lists are where these comparisons usually go wrong, because a capability is only an advantage if you actually need it. Multi-tenancy with per-namespace quotas matters enormously in a platform team serving fifty consumers and means nothing to a single application cluster. Tiered storage changes the economics of retaining years of history and changes nothing if you retain thirty days. Protocol compatibility decides whether your existing producers keep working untouched, which is the single biggest factor in migration effort. Read the matrix below with your own workload in front of you: the better fit for a real-time bidding pipeline and the better fit for a regulated archive are rarely the same system.
Messaging Models
messaging_models = {
'Kafka': {
'topics': 'Log-based',
'partitions': 'Ordered within partition',
'consumer_groups': 'Supported',
'exactly_once': 'Yes (transactions)',
'retention': 'Time or size based'
},
'Pulsar': {
'topics': 'Log-based with subscriptions',
'partitions': 'Key-shared, Failover, Exclusive, Shared',
'consumer_groups': 'Supported',
'exactly_once': 'Yes (transactions)',
'retention': 'Time, size, or backlog based'
},
'Redpanda': {
'topics': 'Log-based (Kafka-compatible)',
'partitions': 'Ordered within partition',
'consumer_groups': 'Supported',
'exactly_once': 'Yes (transactions)',
'retention': 'Time or size based'
},
'Kinesis': {
'topics': 'Streams with shards',
'partitions': 'Ordered within shard',
'consumer_groups': 'Supported (enhanced fan-out)',
'exactly_once': 'No (at-least-once)',
'retention': '24 hours to 365 days'
}
}
Performance Comparison
def compare_performance():
"""
Compare throughput and latency characteristics.
Based on benchmarks and production experience.
"""
benchmarks = {
'Kafka': {
'throughput': 'Millions msgs/sec',
'latency_p99': '5-15ms',
'batch_optimized': True,
'best_for': 'High throughput streaming'
},
'Pulsar': {
'throughput': 'Millions msgs/sec',
'latency_p99': '5-25ms',
'batch_optimized': True,
'best_for': 'Multi-tenancy, geo-replication'
},
'Redpanda': {
'throughput': 'Millions msgs/sec',
'latency_p99': '1-5ms',
'batch_optimized': True,
'best_for': 'Low latency, Kafka migration'
},
'Kinesis': {
'throughput': 'Per-shard limits',
'latency_p99': '50-200ms',
'batch_optimized': False,
'best_for': 'AWS-native, managed simplicity'
}
}
return benchmarks
# Redpanda achieves lower latency due to C++ implementation
# and zero-copy architecture
â ī¸Benchmark Caveat
Performance benchmarks are highly workload-dependent. Always benchmark with YOUR specific workload before choosing a technology. Synthetic benchmarks may not reflect real-world performance.
Trade-off Analysis
Decide by constraints rather than by preference, and start with the constraints that cannot move. If a regulator or a customer contract fixes your cloud, Kinesis enters and leaves the conversation at that point. If you must run on your own hardware, the managed options disappear. If your team has run Kafka for years and the operational burden is already absorbed, the switching cost of a platform with a different failure model is a real expense even when the new system is objectively simpler. What follows is therefore a set of conditional recommendations: each names the situation in which it holds, so you can match your constraints to the one that applies instead of looking for a single winner.
When to Choose Kafka
kafka_strengths = {
'ecosystem': 'Largest ecosystem (Connect, Streams, Schema Registry)',
'community': 'Largest community and documentation',
'maturity': 'Most battle-tested in production',
'tooling': 'Best tooling (Confluent, MSK, etc.)',
'flexibility': 'Maximum configuration options',
'cost': 'Open source, no vendor lock-in'
}
kafka_weaknesses = {
'complexity': 'Requires expertise to operate',
'java': 'JVM overhead and GC pauses',
'scaling': 'Partition rebalancing can be slow',
'metadata': 'ZooKeeper dependency (KRaft fixes this)'
}
# Best when:
# - You need the largest ecosystem
# - Team has Kafka expertise
# - Maximum flexibility is required
# - Cost is a primary concern
When to Choose Pulsar
pulsar_strengths = {
'multi_tenancy': 'Native multi-tenancy support',
'geo_replication': 'Built-in geo-replication',
'tiered_storage': 'Native tiered storage',
'schema_evolution': 'Built-in schema registry',
'streaming_sql': 'Built-in streaming SQL (Pulsar SQL)'
}
pulsar_weaknesses = {
'complexity': 'More components (BookKeeper, ZK)',
'community': 'Smaller community than Kafka',
'ecosystem': 'Smaller ecosystem',
'operations': 'Harder to operate'
}
# Best when:
# - Multi-tenancy is required
# - Geo-replication is critical
# - You need built-in tiered storage
# - Team can handle additional complexity
When to Choose Redpanda
redpanda_strengths = {
'performance': 'Lower latency (C++ implementation)',
'simplicity': 'No ZooKeeper dependency',
'compatibility': 'Kafka API compatible',
'operations': 'Simpler operations',
'resource_efficiency': 'Better resource utilization'
}
redpanda_weaknesses = {
'ecosystem': 'Smaller ecosystem',
'maturity': 'Less battle-tested',
'commercial': 'Some features require license',
'community': 'Smaller community'
}
# Best when:
# - Low latency is critical
# - Migrating from Kafka (compatibility)
# - Simpler operations desired
# - Resource efficiency matters
When to Choose Kinesis
kinesis_strengths = {
'managed': 'Fully managed, no operations',
'aws_integration': 'Native AWS service integration',
'security': 'AWS security features built-in',
'compliance': 'AWS compliance certifications',
'simplicity': 'Simplest to get started'
}
kinesis_weaknesses = {
'limits': 'Per-shard throughput limits',
'vendor_lock': 'AWS vendor lock-in',
'cost': 'Can be expensive at scale',
'features': 'Fewer features than Kafka'
}
# Best when:
# - AWS-native architecture
# - Small team, limited operations capacity
# - Quick time to market
# - Compliance requirements met by AWS
âšī¸Decision Framework
- Start with requirements: What features do you actually need?
- Evaluate team expertise: What does your team know?
- Consider operations: Who will operate the system?
- Calculate TCO: Including operations, training, and infrastructure
- Prototype: Build a proof of concept with your workload
Migration Considerations
Migration cost is dominated by two things: how much of the protocol your clients already speak, and how many offset or shard semantics differ in ways your application depends on. A drop-in compatible target lets you move one topic at a time, keep both clusters running side by side, and cut over consumers individually, so risk stays small and reversible. A system with a different API means changing producers and consumers together, which forces a maintenance window and makes rollback a code deployment rather than a configuration change. In every case, plan the offset mapping explicitly: which source offset becomes which destination offset, what happens to in-flight records during the switch, and how you prove no data was skipped. Migrations fail on that detail far more often than on throughput.
Kafka to Redpanda
# Redpanda is Kafka API compatible
# Migration is straightforward
migration_steps = [
"1. Set up Redpanda cluster",
"2. Mirror topics using MirrorMaker 2",
"3. Validate data integrity",
"4. Switch consumers to Redpanda",
"5. Switch producers to Redpanda",
"6. Decommission Kafka cluster"
]
# Redpanda can coexist with Kafka during migration
# No application code changes required
Kafka to Pulsar
# Pulsar has Kafka-compatible layer
# Migration requires more planning
migration_steps = [
"1. Set up Pulsar cluster with BookKeeper",
"2. Use Pulsar Kafka adapter for compatibility",
"3. Migrate topics one by one",
"4. Update consumer groups",
"5. Validate and switch traffic",
"6. Remove Kafka dependency"
]
# More complex due to different architecture
# Consider if Pulsar features justify migration cost
Kinesis to Kafka
# Requires significant application changes
# Different API and semantics
migration_steps = [
"1. Set up MSK or self-managed Kafka cluster",
"2. Redesign applications for Kafka API",
"3. Implement data migration",
"4. Run parallel during transition",
"5. Validate and cut over",
"6. Remove Kinesis dependencies"
]
# Most complex migration due to API differences
# Usually only done when leaving AWS or needing features Kinesis lacks
â ī¸Migration Risk
Migration between different streaming platforms is high-risk. Always:
- Run in parallel during migration
- Validate data integrity thoroughly
- Have rollback plan
- Start with non-critical workloads
Cost Analysis
Total cost of ownership for a messaging platform is mostly people and machines in roughly that order, and the license line item is rarely the deciding factor. The dominant machine cost is replication: every record written three times across brokers, plus the same record again if it is mirrored to another cluster, so a doubling of retention doubles the disk bill regardless of which system you picked. The dominant people cost is incident response and upgrade work, where a system with fewer moving parts and no separate coordination service pulls decisively ahead. Managed services convert the second cost into a bill, which is attractive when the team is small and unattractive when the volume makes that bill exceed an engineer's salary. Compare options using your own retention, throughput and headcount rather than published per-gigabyte prices alone.
Total Cost of Ownership
def calculate_tco(
platform,
messages_per_day,
average_message_size,
retention_days,
cluster_size
):
"""
Calculate Total Cost of Ownership for streaming platforms.
"""
# Calculate storage needs
daily_storage_gb = (messages_per_day * average_message_size) / (1024**3)
total_storage_gb = daily_storage_gb * retention_days
costs = {
'Kafka': {
'infrastructure': cluster_size * 500, # $500/server/month
'operations': 0.5, # 0.5 FTE
'storage': total_storage_gb * 0.10, # $0.10/GB/month
'training': 5000 # Initial training
},
'Pulsar': {
'infrastructure': cluster_size * 600, # More nodes needed
'operations': 0.75, # More complex to operate
'storage': total_storage_gb * 0.10,
'training': 8000 # More training needed
},
'Redpanda': {
'infrastructure': cluster_size * 450, # Better efficiency
'operations': 0.4, # Simpler operations
'storage': total_storage_gb * 0.10,
'training': 4000 # Kafka-compatible
},
'Kinesis': {
'infrastructure': messages_per_day * 0.015, # Per-million cost
'operations': 0.1, # Fully managed
'storage': total_storage_gb * 0.23, # Higher storage cost
'training': 2000
}
}
monthly = costs[platform]
total_monthly = (
monthly['infrastructure'] +
monthly['operations'] * 8000 + # $8000/FTE
monthly['storage']
)
return {
'monthly_cost': total_monthly,
'annual_cost': total_monthly * 12,
'breakdown': monthly
}
# Example comparison
for platform in ['Kafka', 'Pulsar', 'Redpanda', 'Kinesis']:
cost = calculate_tco(
platform=platform,
messages_per_day=100000000,
average_message_size=500,
retention_days=7,
cluster_size=6
)
print(f"{platform}: ${cost['annual_cost']:,.0f}/year")
âšī¸Cost Insight
Kafka is often cheapest at scale due to operational efficiency. Kinesis is cheapest at small scale due to zero operations cost. Pulsar costs more due to additional components. Redpanda offers best price-performance ratio.
Recommendation Matrix
| Requirement | Recommended |
|---|---|
| Largest ecosystem | Kafka |
| Multi-tenancy | Pulsar |
| Lowest latency | Redpanda |
| AWS-native | Kinesis |
| Simplest operations | Kinesis |
| Geo-replication | Pulsar |
| Kafka migration | Redpanda |
| Cost at scale | Kafka |
| Small team | Kinesis or Redpanda |
â ī¸Key Insight
There is no universally best streaming platform. The right choice depends on your specific requirements, team expertise, and operational capacity. Always evaluate based on your use case, not generic benchmarks.
Common Mistakes
Choosing a platform from a benchmark table without matching it to your retention and team size
Fix: Anchor the decision on constraints that cannot move first, such as cloud lock-in, protocol compatibility and available operations staff
Migrating off Kafka for features you will not use while ignoring offset semantics
Fix: Stay put unless a specific capability pays for the switch, and plan the source-to-destination offset mapping before anything else
Comparing options on license or per-gigabyte price alone
Fix: Model replication amplification, retention growth and on-call effort, which usually dominate the line items people quote
Key Takeaways
- Storage and coordination boundaries explain the operational differences: Kafka is broker-stateful, Pulsar separates serving from storage, Redpanda simplifies the runtime, Kinesis hides everything behind a managed API
- Feature advantages only count when the capability is one you actually need, so weigh multi-tenancy and tiered storage against your real workload
- Migration effort is set by protocol compatibility and offset semantics, not by throughput targets
- Total cost of ownership is dominated by replication and operations staff, with licensing rarely deciding the outcome