Back to blog

// OSSeva Blog

Operations

Kafka vs Redis: Streams, Pub/Sub, Queues and When to Use Each

Matt Reynolds8 min read

The short answer

Kafka is a distributed log for keeping and replaying events. Redis is an in-memory data store that can also carry messages. Kafka writes every event to partitioned, replicated topics on disk, keeps it for the retention period you choose, and lets each consumer group read at its own pace and rewind. Redis offers lists, Pub/Sub and streams. Streams come closest to Kafka, with consumer groups, acknowledgements and replay, but a stream is a single key held in memory, it is not partitioned across nodes, and replication is asynchronous. Choose Kafka when the events are a record that several systems read, when you need days of history, or when volumes are sustained and growing. Choose Redis, or Valkey, when you already run it, the messages are small and short-lived, and losing the last moments of data in a failover is acceptable.

Kafka vs Redis at a glance

Apache KafkaRedis (and Valkey)
What it isDistributed, partitioned event logIn-memory data structure server
Messaging optionsTopics with consumer groups; share groups for queue-style useLists, Pub/Sub, streams
Where data livesLog segments on broker disks; optional remote tier on HDFS or S3Memory, with optional RDB snapshots and AOF on disk
RetentionPer topic, by time or size; events stay after they are readStreams keep entries until trimmed with MAXLEN or MINID, bounded by memory
Scaling one stream of dataA topic spreads its partitions across brokersA stream is one key on one node; scale by using more keys
OrderingPer partition, by keyPer stream
ReplicationEach partition replicated across brokersAsynchronous by default
DeliveryAt-least-once by default; exactly-once between Kafka topics with transactionsPub/Sub at-most-once; streams at-most-once or at-least-once
LicenceApache 2.0Redis 8+: RSALv2, SSPLv1 or AGPLv3. Redis 7.2 and earlier, and Valkey: BSD-3-Clause

Kafka vs Redis Streams

Redis Streams are the part of Redis people mean when they compare it with Kafka, and the Redis documentation draws the comparison itself. A stream is an append-only log stored in one key. Consumers read with XREAD, or join a consumer group with XREADGROUP, acknowledge entries with XACK, and anything delivered but not acknowledged stays in a pending entries list until a consumer finishes it or another consumer claims it with XCLAIM or XAUTOCLAIM. That gives at-least-once processing and a way to recover from a crashed consumer.

The differences show up at scale and under failure:

  • Partitioning. The Redis docs say plainly that a single stream is not automatically partitioned across instances. Consumer groups in Redis spread entries to whichever consumer is ready, so two entries about the same customer can be processed out of order. To get Kafka-style ordered partitions you create several stream keys and route to them yourself; the docs describe Kafka partitions as closer to "N different Redis keys". In Redis Cluster each of those keys lives in one hash slot on one node.
  • Retention. Kafka keeps events by time or size on disk, and tiered storage can move older segments to object storage. A Redis stream lives in memory, so you cap it with MAXLEN or MINID and the oldest entries go. Days of history in Redis means days of history in RAM.
  • Durability. Redis persists streams through RDB and AOF like any other key, and its docs say AOF needs a strong fsync policy if message persistence matters. Replication is asynchronous, so an XADD acknowledged by the primary can be missing after a failover; WAIT reduces that risk, but the docs note that Sentinel and Cluster failover is a best-effort choice of the most up-to-date replica. Kafka counts a write as committed only once every in-sync replica of the partition has it, and its documentation gives a replication factor of 3 as a common production setting.
  • Consumers. Both let several independent groups read the same data. Kafka consumers track an offset and can rewind to any point still in retention. Redis consumers can read a stream by ID range, so replay is possible for whatever has not been trimmed.

Kafka vs Redis Pub/Sub

Redis Pub/Sub is not a smaller Kafka; it is a different contract. Redis documents Pub/Sub as at-most-once: a published message goes to the subscribers connected at that moment, and if a subscriber is offline or fails while handling it, "the message is forever lost". Nothing is stored, so there is no replay. That suits live notifications, cache invalidation and chat-style fan-out, where a missed message is replaced by the next one. Sharded Pub/Sub, added in Redis 7.0, keeps messages inside the shard that owns the channel so Pub/Sub can scale with the cluster, but the delivery contract is the same. Kafka's equivalent is a topic that several consumer groups read: every group gets every event, including groups that were offline when it was written.

Kafka vs a Redis queue

A Redis list is the classic lightweight queue: producers LPUSH, workers pop. A plain RPOP or BRPOP loses the message if the worker crashes after taking it, and the Redis documentation's reliable-queue pattern moves each item into a processing list with LMOVE or BLMOVE so it can be recovered. Retries, dead-lettering and visibility timeouts are your code's job; frameworks such as Celery build them on top. Kafka was not a work queue by design, because consumer groups assign whole partitions to consumers, but Kafka 4.2 made share groups production-ready: consumers in a share group take individual records, acknowledge them one by one and have failed records redelivered. If you are choosing a broker mainly for task queues, also read our RabbitMQ vs Redis comparison.

Kafka vs Redis performance

Most published comparisons measure something that does not match your workload, so treat them with care. The designs explain the general shape. Redis serves every operation from memory, which keeps per-operation latency low for small messages, but the amount of data a stream can hold is bounded by RAM and one stream is served by one node. Kafka batches writes to an append-only log, serves reads from the operating system's page cache and sends data to consumers without copying it through the application, so a topic read by several consumer groups costs little more than one read by a single group, and throughput scales by adding partitions and brokers. For high sustained volume with long retention, the design favours Kafka. For small, short-lived messages beside a Redis you already run, the design favours Redis. Measure with your own message sizes and durability settings.

Using Kafka and Redis together

The two are often complementary rather than rivals. A common pattern keeps Kafka as the system of record for events and uses Redis as the fast read side: a consumer applies events from Kafka to Redis keys that applications query. Another uses Redis Pub/Sub or streams for short-lived signals inside one service while anything other teams depend on goes through Kafka.

Which should you choose, Kafka or Redis?

  • Choose Kafka when several teams or systems consume the same events, when you need replay over days or longer, when volume is high and sustained, or when the data feeds stream processing, change data capture or a data platform.
  • Choose Redis Streams when you already run Redis, the volume fits comfortably in memory, consumers are within one application or team, and an occasional gap after a failover is tolerable or can be rebuilt.
  • Choose Redis Pub/Sub for live fan-out where only connected clients need the message and nothing has to be kept.
  • Choose a Redis list for a simple job queue, ideally through a framework that already handles retries.

Licensing

Kafka is Apache 2.0. Redis 7.2 and earlier are BSD-3-Clause; Redis 7.4 moved to RSALv2 or SSPLv1, and Redis 8 added AGPLv3 as a third option. Valkey continues the BSD licence from the Redis 7.2 code base, streams included. If the licence matters to you, see Valkey vs Redis and the Redis licence change.

Where OSSeva fits

OSSeva supports both, so you can run each where it fits. OSSeva for Redis ships patched builds of Redis 6.2 and 7.0, which no longer get upstream fixes, and covers Redis 7.2 and Valkey 7.2 and 8.x; see Redis extended support. OSSeva for Apache Kafka ships patched builds from 2.8 through 3.9 and covers 4.x in KRaft mode; see Kafka and ZooKeeper extended support. You keep the binaries you run today and change who supports them, under one contract priced per cluster. Book a discovery call for a quote.

Frequently asked questions

What is the difference between Kafka and Redis?

Kafka is a distributed log that stores events on disk in partitioned, replicated topics and lets consumers replay them. Redis is an in-memory data store; it can move messages through lists, Pub/Sub and streams, but its main job is fast access to data in memory.

Kafka vs Redis Streams: which should I use?

Use Redis Streams when you already run Redis, the data fits in memory and the consumers sit inside one application. Use Kafka when you need partitioned scale-out, long retention on disk, several independent consumer groups or strong durability across failovers. Redis's own documentation notes that a single stream is not partitioned across instances.

Kafka vs Redis Pub/Sub: what is the difference?

Redis Pub/Sub delivers to connected subscribers only, at most once, and keeps nothing, so an offline subscriber misses the message for good. Kafka stores every event for the retention period, so a consumer group that was offline catches up when it returns.

Kafka vs Redis queue: which is better for background jobs?

For simple job queues a Redis list, used with the LMOVE reliable-queue pattern or through a framework such as Celery, is usually enough. Kafka's share groups, production-ready since 4.2, add per-record acknowledgement, but a full log is a lot of machinery for a job queue. RabbitMQ is the other common choice.

Can Redis replace Kafka?

For small, short-lived event streams inside one application, yes. For event data that many systems consume, that must survive failovers without gaps, or that you need to keep for days, Redis is not a replacement: memory limits retention, a stream does not partition across nodes and replication is asynchronous.

Is Redis faster than Kafka?

For a single small message, Redis usually responds sooner because it works in memory. For sustained high volume with many consumers and long retention, Kafka is built for throughput. "Faster" depends on which of those you need, so test your own workload.

Tags

KafkaRedisValkeyComparisonStreamingMessaging

Ready to get your open source under control?

Talk to an OSSeva engineer about CVE coverage, compliance, and migration support for your stack.