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...
You can actually get pretty fancy and lightweight with listen / notify as well if desired (use select for a notify instead of endless queries) https://www.psycopg.org/docs/advanced.html#asynchronous-noti...
Redis vs. Kafka vs. RabbitMQ
31–40 of 44 posts
Re: Redis vs. Kafka vs. RabbitMQ
#32Earlier quoted context omitted.
Doesn't confluent offer a JMS client for kafka? So certainly you can use kafka as a queue.
You need to pre-commit to the amount of parallelism you want, and work-stealing or any other out-of-order processing is nearly impossible. Any Kafka client bug tracker is full of people who are confused (or worse) about this. We use Kafka as a queue because we understand it very well, but it has a lot of limitations compared to "purpose-built" queuing services.
In that case, sure, theoretically with JMS you can spawn as many parallel consumers as you want and with kafka you're limited to the number of partitions you've configured your topic with, as you can only have one partition per consumer.
But you get so much more out of kafka with consumer groups and partitions when you do complex message processing that would be a lot harder with traditional queues (if you partition based on the same key).
Re: Redis vs. Kafka vs. RabbitMQ
#33Earlier quoted context omitted.
Can you give a tldr/eli5?
Unlike a queue it is common for events to be: Kept indefinitely for future re-consumption. Partitioned with different consumers seeing different slices of the data.
Are there any stories of this saving someone from a potential disaster? My experience has been that this only causes bugs, such as resending hundreds of thoudands of out-of-date emails.
Re: Redis vs. Kafka vs. RabbitMQ
#34Earlier quoted context omitted.
Because almost everyone refers to Kafka as a queue. And Kafka isn’t a queue.
Doesn't confluent offer a JMS client for kafka? So certainly you can use kafka as a queue.
Re: Redis vs. Kafka vs. RabbitMQ
#35Earlier quoted context omitted.
You need to pre-commit to the amount of parallelism you want, and work-stealing or any other out-of-order processing is nearly impossible. Any Kafka client bug tracker is full of people who are confused (or worse) about this. We use Kafka as a queue because we understand it very well, but it has a lot of limitations compared to "purpose-built" queuing services.
You mean pre-commit to the maximum parallelism by setting the number of partitions or am I missing something? In that case, sure, theoretically with JMS you can spawn as many parallel consumers as you want and with kafka you're limited to the number of partitions you've configured your topic with, as you can only have one partition per consumer. But you get so much more out of kafka with consumer groups and partition…
Yes. Then depending on the data it can be difficult-to-impossible to scale past that. Scaling down, of course you can always start fewer consumers, but unless you have many more partitions than consumers or partitions as a multiple of consumers, the load will be unbalanced.
> But you get so much more out of kafka with consumer groups and partitions when you do complex message processing
Well, what's "complex message processing"? If you mean the stream topology is complex or the operations benefit from key sharding I agree. If you mean that some atomic operation is complex, no, it's irrelevant or even bad e.g. the complexity means you need a DLQ/OOO retries, or load per item is so unpredictable you want to work-steal.
Re: Redis vs. Kafka vs. RabbitMQ
#36The 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.
Re: Redis vs. Kafka vs. RabbitMQ
#37Earlier quoted context omitted.
Unlike a queue it is common for events to be: Kept indefinitely for future re-consumption. Partitioned with different consumers seeing different slices of the data.
Kept indefinitely for future re-consumption. Are there any stories of this saving someone from a potential disaster? My experience has been that this only causes bugs, such as resending hundreds of thoudands of out-of-date emails.
Re: Redis vs. Kafka vs. RabbitMQ
#38Earlier quoted context omitted.
You can actually get pretty fancy and lightweight with listen / notify as well if desired (use select for a notify instead of endless queries) https://www.psycopg.org/docs/advanced.html#asynchronous-noti...
Yes, that too! I'd like to see how different Postgres techniques compare in general.
Re: Redis vs. Kafka vs. RabbitMQ
#39Earlier quoted context omitted.
You mean pre-commit to the maximum parallelism by setting the number of partitions or am I missing something? In that case, sure, theoretically with JMS you can spawn as many parallel consumers as you want and with kafka you're limited to the number of partitions you've configured your topic with, as you can only have one partition per consumer. But you get so much more out of kafka with consumer groups and partition…
> You mean pre-commit to the maximum parallelism by setting the number of partitions? Yes. Then depending on the data it can be difficult-to-impossible to scale past that. Scaling down , of course you can always start fewer consumers, but unless you have many more partitions than consumers or partitions as a multiple of consumers, the load will be unbalanced. > But you get so much more out of kafka with consumer grou…
If you can live with not strictly ordered messages around scale time you just rescale. If you can live with some latency you stop producing, wait until lag is zero, scale, and then start producing again.
Plus if you pick a partition number with nice divisors like 6, 12, 20, 24, 40 or 60 you can have balanced consumption with different number of consumers.
Re: Redis vs. Kafka vs. RabbitMQ
#40Is 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…
Maybe I'm missing something but this setup sounds like a re-creation of Beanstalkd. https://beanstalkd.github.io/