Live data from Hacker News

RabbitMQ 4.0

github.com

41–50 of 120 posts

Re: RabbitMQ 4.0

#41
post #3

I've regarded RabbitMQ as a secret weapon in plain sight for years. The killer reason people don't use it more is it "doesn't scale" to truly enormous sizes, but for anyone with less than a million users it's great. Too many people end up with their own half rolled pubsub via things like grpc, and they'd be far better off using this, particularly in the early stages of development.

This is how I feel about NATS: https://nats.io/ It's an infinitely more friendly version of Kafka, pub/sub, etc that is extremely lightweight. Yet every environment trends towards Kafka because it was "chosen" by the big corps.

Big corps choose these bloated and complex tools because this way they can justify charging their customers premium and also that their customers won't be able to service such software on their own.

It's nothing to do with these apps being superior in any way - often it is the opposite - like reasonable faults and glitches can add more hours to bill the customers for "fixing".

Re: RabbitMQ 4.0

#42

Earlier quoted context omitted.

Have used both extensively: NATS, especially in its most elementary form, is braindead simple, stateless, and ootb functional. If I only want a message broker/pubsub, I pick that. If I know on day 1 that I need queues or persistence, I would probably pick Rabbit over NATS’ offering (Jetstream).

Would you use NATS over Redis PubSub or Postgres Notify/Listen? Postgres's option I'm wary of for reasons I've discussed here before but Redis PubSub seems fairly simple to use and likewise not as uber-scalable as Kafka and other more heavyweight message broker systems.

Not the parent, but I would. We've been using NATS for about five years at my company, and we recently adopted JetStream, and have been really impressed with it.

NATS, especially with JetStream now, is a Swiss Army knife of messaging. It can do RPC, Kafka-type batch streaming, low-latency realtime notifications, large-scale network transfer, offline sync, work queues, mirroring, weighted routing, partitioning... it's incredibly flexible. The simple but powerful primitive you have around subject routing/mapping/transforms, stream placement, replication, offline lead nodes etc. are just fantastic. It's super reliable. It scales from tiny apps to huge ones. The CLI and API tooling around streams and consumers is also fantastic.

Everything just feels well-designed and sensible. The new key/value store and blob store (both built on top of JetStream as client-side abstractions) are also super neat, and we've started using this functionality.

Re: RabbitMQ 4.0

#43
post #17

For what reason should we move from SNS/SQS to RabbitMQ? Our SaaS processes ~20 events/second.

That's like $0.50/day in aws costs. Absolutely no reason to switch if it's working.

When you said that number, I had a completely different reaction. 20 messages per second is absolutely nothing, $0.50 per day for that is dreadful. A $5 per month ($0.16 per day) VPS can deliver many thousands of messages per second.

Re: RabbitMQ 4.0

#44

Earlier quoted context omitted.

NATS can do traffic shaping https://docs.nats.io/nats-concepts/subject_mapping#for-traff...

Oh cool, I didn't know it could! Regardless, advanced routing is still something that RabbitMQ has that isn't in NATS. It's not useful for every system, but it is a differentiator. I usually reach for NATS + Jetstream these days, with its object and KV systems it's a really great "all-in-one" for basic stuff.

Nats also has some basic routing options. Which of RabbitMQ's options would give it the edge when deciding between the two?

Re: RabbitMQ 4.0

#45
post #7

Earlier quoted context omitted.

This is how I feel about NATS: https://nats.io/ It's an infinitely more friendly version of Kafka, pub/sub, etc that is extremely lightweight. Yet every environment trends towards Kafka because it was "chosen" by the big corps.

So how about NATS compared to RabbitMQ? If building from scratch, what would drive a design or team towards NATS?

Two different models. The metaphor I like to use is that RabbitMQ is a postal system, while NATS is a switchboard.

RabbitMQ is a "classical" message broker. It routes messages between queues. Messages are treated like little letters that fly everywhere. They're filed in different places, and consumers come by and pick them up.

Core NATS isn't really a message broker, but more of a network transport. There are no queues as such, but rather topologies of routes where messages are matched from producers and consumers through a "subject". You don't "create a queue"; you announce interest in a subject (which is a kind of path that can contain wildcards, e.g. "ORDERS.us.nike"), and NATS routes stuff according to the interests. So there's nothing on disk; and if a consumer isn't there to receive a message, the message is gone. Thus you can send messages back and forth, both point-to-point or one-to-many. NATS itself isn't reliable, but you can build reliable systems on NATS.

A common example of the lightweight, ephemeral nature of NATS is the request-reply pattern. You send out a message and you tag it with a unique reply address, the "inbox subject". The subject is just a random string (it may be called "INBOX.8pi87kjwi"). The recipient replies by sending its reply to that inbox. The inbox isn't something that exists; it's just a subject temporarily being routed on. So the sender sends a message and waits for the reply. NATS encourages you to use these ephemeral subjects as much as possible, and there can be millions of them. You can do RPC between apps, and that's a popular use of NATS.

JetStream is a subsystem built on core NATS, and is what you get when the designer of NATS thinks he can outsmart the designers of Kafka. JetStream is basically a database. Each stream is a persistent sequential array of messages, similar to Kafka topics or a RabbitMQ queue. A stream can be replicated as well as mirrored; one stream can route into another, so you can have networks of streams feeding into bigger rivers. Unlike core NATS, but similar to RabbitMQ, streams and their consumers have to be created and destroyed, as they are persistent, replicated objects that survive restarts.

Similar to Kafka, streams are just indexed arrays; you can use it for ephemeral events, or you can store long histories of stuff. Consumers can go back in time and "seek" through the stream. Streams are indexed by subject, so you can mix lots of types of data in a single stream (as opposed to multiple streams) and simply filter by subject; NATS is very efficient at using the index to filter. Like RabbitMQ but unlike Kafka, streams don't need to be consumed in order; you can nack (!) messages, or set an ack timeout, causing redelivery if acks aren't sent in time. In other words, JetStream can work like Kafka (where you always read by position) or like RabbitMQ (where messages are skipped once acked, but retried once nacked). JetStream has deduplication and idempotency, which allows you to build "exactly once" delivery, which is awesome.

Similar to how someone built a database on top Kafka (KSQL), the NATS team has built a key-value store on JetStream, as well as a blob store. They work the same way, through message ID deduplication. A stream is basically a bunch of database rows, with the message ID acting as primary key. So the stream acts as a primitive to build new, novel things on top of.

I think it's fair to say that RabbitMQ gives you opinionated tools to do certain things, whereas NATS and JetStream are a hybrid "multi model" system that can be used for more purposes. For example, you can embed NATS in your app and use it as a really lightweight RPC mechanism. You can use JetStream as a classic "work queue" where each worker gets a single copy of each message and has to ack/nack so the queue moves forward. You can use JetStream as a log of all actions taken in a system, with retention going back years. (NATS/JS is actually awesome for logging.) And so on.

We use NATS for different use cases at my company. In one use case, clients connect to an API to follow live, low-latency change events. For each such client connection, we register a NATS subject; then tons of processes will see this subject (and its settings, such as filters) and will all start send changes to that one subject. There's no single "controller"; it's all based on point-to-point and one-to-many communication.

(Full disclosure: I'm not familiar with newer RabbitMQ versions or the streaming stuff they've added, so it's possible that RabbitMQ has caught up here in some ways.)

Re: RabbitMQ 4.0

#47

Earlier quoted context omitted.

That's like $0.50/day in aws costs. Absolutely no reason to switch if it's working.

When you said that number, I had a completely different reaction. 20 messages per second is absolutely nothing, $0.50 per day for that is dreadful. A $5 per month ($0.16 per day) VPS can deliver many thousands of messages per second.

$10/month difference is, to use your phrasing, absolutely nothing. It's not worth anyone's time to make that switch unless it's some toy app paid for out of pocket.

Re: RabbitMQ 4.0

#48
post #7

Earlier quoted context omitted.

So how about NATS compared to RabbitMQ? If building from scratch, what would drive a design or team towards NATS?

Two different models. The metaphor I like to use is that RabbitMQ is a postal system, while NATS is a switchboard. RabbitMQ is a "classical" message broker. It routes messages between queues. Messages are treated like little letters that fly everywhere. They're filed in different places, and consumers come by and pick them up. Core NATS isn't really a message broker, but more of a network transport. There are no queu…

Thank you, kind internet stranger. That was an awesome dive into the matter!

Re: RabbitMQ 4.0

#49
post #47

Earlier quoted context omitted.

When you said that number, I had a completely different reaction. 20 messages per second is absolutely nothing, $0.50 per day for that is dreadful. A $5 per month ($0.16 per day) VPS can deliver many thousands of messages per second.

$10/month difference is, to use your phrasing, absolutely nothing. It's not worth anyone's time to make that switch unless it's some toy app paid for out of pocket.

[deleted]

Re: RabbitMQ 4.0

#50

Earlier quoted context omitted.

The real reason people don't use it is because they don't know about it or understand it. Then they apply the "it doesn't scale" retroactively. You have to read a lot of docs or you WILL hold RabbitMQ wrong.

I agree, but there are a lot of footguns with RMQ. A great example of one is that you'll slow down your cluster by adding more RMQ servers (something that's bit us in the past). Which is a forgivable mistake as most people would expect that more cores == faster RMQ. (For RMQ, that doesn't work because Durable messages need to be replicated to the other nodes in the cluster. More nodes == more replication) The ideal R…

That was true, but the more recent Quorum queues provide more traditional scalability tradeoffs (you can set a ceiling on the number of synchronous replication hops that a published, replicated message goes through): https://www.rabbitmq.com/docs/quorum-queues
Post reply on HN