from Hacker News

Redis vs. Kafka vs. RabbitMQ

by FragrantRiver on 1/26/22, 10:28 AM with 42 comments

  • by detaro on 1/26/22, 11:44 AM

    Seems to be copied from https://otonomo.io/redis-kafka-or-rabbitmq-which-microservic... (where it has a date from 2019)

    This same blog already had a copied submission yesterday, so it seems it regularly does this: https://news.ycombinator.com/item?id=30061113

  • by yawniek on 1/26/22, 11:18 AM

    I dont understand why almost nobody wants to understand the difference between message brokers and a distributed log and its implications.
  • by mindwok on 1/26/22, 11:04 AM

    Expect performance issues when running RabbitMQ with persistence? What kind of issues?

    Also the comment about Redis not being persistent, Redis has lots of persistence options that allow you to choose trade offs between durability and performance, with the most strict setting using an append only log of every query.

    Decent 1000 mile view of these solutions, but some more depth would have been nice.

  • by cebert on 1/26/22, 11:13 AM

    Is anyone else considering using DyanmoDB for event sourcing instead of Kafka? We have a project at work where we store events into an event table. We then had a stream that invokes a distributor lambda. The distributor lambda lookups subscribers to a given event type. For each subscriber for a given event, we place a copy of the event to a SQS queue for the event subscriber. Each subscriber lambda can process events from its own queue. If processing fails, each subscriber will retry processing a configured number of times before moving the failed event to a dead letter queue.

    This approach has been working well for us without the need of Kafka with our serverless apps. I was curious if anyone is doing something similar.

  • by coffeeri on 1/26/22, 11:21 AM

    Especially if you want one-to-many connections, exactly once delivery and push/ pull consumers, it is worth checking out nats [0, 1]. It is very performant. There are clients for Javascript, Python, Rust and Go [2]. (I am not affiliated with them)

    [0] https://nats.io/ [1] https://github.com/nats-io/nats-server [2] https://nats.io/download/#nats-clients

  • by Lio on 1/26/22, 11:16 AM

    I treat Redis a bit like I treat PostgreSQL.

    It's what I use when I don't know what I should use.

    (In fact these days I might even be tempted to start with a simple PostgreSQL based queue and only swap to Redis later if it becomes clear that's what's needed).

    I guess a better approach might be to carefully analyse requirements up front but if those requirements aren't known at the time you start the project it's useful just to get you going.

  • by jpgvm on 1/26/22, 12:23 PM

    This comparison is massively oversimplified and misleading.

    The most important features are normally not message liveliness or throughput (complex routing can definitely be a defining feature however). This is because both are fairly easy to solve for - especially in absence of other constraints.

    Much more important are durability, ordering, partitioning, acknowledgement models, fencing/isolation/failure of both brokers and consumers, etc.

    These are all very nuanced things but ultimately determine which systems can be used for which applications.

    A lot of people with rush to recommend Kafka but it's actually a rather narrow solution, it's distributed log model is definitely the right way to persist and replicate messages but it's fetch and consumer group APIs are essentially hot garbage for anything except strict streaming or other ordered processing cases.

    This would be the major sharp edge of Kafka that people don't understand and end up pidgeon-holed into patching themselves - strict cumulative acknowledgement. This leads to head of line blocking and the only solutions involve tracking acknowledgements yourself either not using consumer groups at all or layering some inefficient solution ontop of it that only updates the offset appropriately and properly skips processed messages when recovering/rebalancing.

    An alternative this article misses is Apache Pulsar which is much better suited for the role of "general purpose messaging system" that can just as easily function as a worker queue where ordering isn't important and supports various models of ordered consumption depending on your requirements.

    I was also going to suggest LogDevice but it appears it's been abandoned/archived sadly.

    Regardless ignore fluff articles like this. Understand the caveats of the Kafka API before going all-in, if your problem fits it's very simple/cost effective solution so it's worth it if the constraints don't bother you and you aren't annoyed by Confluent's stewardship.

    Otherwise I would preference Pulsar, it's the more flexible option that you are unlikely to grow out of. Even as you get big it's natively multi-tenant and geo-replicated etc.

  • by phoe-krk on 1/26/22, 11:15 AM

    Just a fun question: is there a comparison that compares how well a simple PostgreSQL-based queue[0] fares against these specialized solutions?

    [0] https://blog.crunchydata.com/blog/message-queuing-using-nati...

  • by NiekvdMaas on 1/26/22, 11:04 AM

    It's worth noting that there are several projects built on top of Redis pub-sub that add more functionality, such as BullMQ: https://github.com/taskforcesh/bullmq
  • by pards on 1/26/22, 11:30 AM

    Another key feature missing from the list is:

    4. Redelivery

    Are messages redelivered if there's a failure in the consumer? This is critical to many systems using older messaging platforms like MQ.

  • by humpydumpy on 1/26/22, 11:23 AM

    why would you submit a link with tracking parameter?