Live data from Hacker News

NSQ – A realtime distributed messaging platform

nsq.io

31–40 of 64 posts

Re: NSQ – A realtime distributed messaging platform

#31

Having played with NSQ off and on for the past few months, and having gone deeper with it over the past week or so in preparation for rolling out a production service, here are a few things that have really impressed me, in no particular order: It's super easy to run. A few command line params, if that, and I've got a local nsqd running that I can develop and test against. Great for those offline coding sessions on B…

Thanks!

This is something that I've always tried to stress when talking about NSQ...

The "message queue" is the most boring and uninteresting aspect of the system.

It's the combination of out-of-the-box tooling and conceptually simple primitives that really differentiate it from other systems.

Re: NSQ – A realtime distributed messaging platform

#32
post #9

NATS is a simpler, faster alternative: http://nats.io/

I was under the impression NATS had no persistence and no "message transaction state" (no message acknowledgements), being more of a super fast pub-sub message bus than a distributed queue.

Re: NSQ – A realtime distributed messaging platform

#34
post #20

Earlier quoted context omitted.

Can one use NSQ as a replacement for Kafka?

Kafka offers persistence, which seems extremely rare in distributable queue. (Is it even available outside of Kafka?) On that note, what is everyone using these queues for that they can ignore durability?

Rabbit offers persistence.

Re: NSQ – A realtime distributed messaging platform

#35
It looks like there isn't any kind of user-definable shard/partition key available within the topics - a message within a topic could go to any client subscribing to a channel for that topic? Is that correct?

That's obviously fine for AWS Lambda-style single event processing (maps, filters, sinks), but isn't that going to make multiple event processing (reduces, sorts) really difficult? It rules out using in-process memory or local KV storage for maintaining the necessary state across the aggregation window - you're only left with pounding some remote database, not a great strategy as per http://radar.oreilly.com/2014/07/why-local-state-is-a-fundam...

Re: NSQ – A realtime distributed messaging platform

#36

I don't think I had heard about NSQ till now; how is it better than, say, a pub-sub queue on a beefy Redis server? (Or a cluster of servers, if you wish). Nothing beats Redis' simplicity, AFAICT.

Redis pub/sub is ephemeral. If you aren't connected and listening, you missed it.

Re: NSQ – A realtime distributed messaging platform

#37

It looks like there isn't any kind of user-definable shard/partition key available within the topics - a message within a topic could go to any client subscribing to a channel for that topic? Is that correct? That's obviously fine for AWS Lambda-style single event processing (maps, filters, sinks), but isn't that going to make multiple event processing (reduces, sorts) really difficult? It rules out using in-process…

For the applications I've dealt with, it's an upside that a workers distributed across a number of servers can process messages from producers distributed across a number of servers, with no user-defined partitioning. Kafka, I think, requires you to define partitions to have multiple workers consume a stream. In the NSQ case, if you need more throughput, just spin it up.

Somewhat on a tangent, one of the goals of the design was to avoid any servers in the middle of the "workers" (consumers) and producers, and making it such that any consuming or producing server dieing or experiencing a network partition doesn't slow down any producers or consumers who can still reach each other.

You're right, this isn't really focused on replacing map-reduce thing like some other message streaming systems are. For one, I can't imagine a "sorting" step using nsq. It's still used for somewhat hefty data-processing tasks, in multiple stages. Each stage has as many servers spun up as needed, consuming messages directly from the previous stage, and publishing to nsqd on localhost. They might consume and acknowledge multiple messages to produce one new message.

For reduced inter-server hops before hitting the database, you can run workers on the same host as producers. So you might have a X hosts producing messages (and running their own nsqd locally, of course), and have Y consumers on each host, configured to consume messages from localhost instead of using nsqlookupd to find all sources, and those consumers would make direct requests to the appropriate database host. With this setup you can still use nsqadmin to monitor the queue levels on all producer hosts, and you can still be archiving messages to disk on some other remote hosts.

Re: NSQ – A realtime distributed messaging platform

#38
post #24

I've noticed that a lot of message queuing systems have an "delivery at least once" property. What exactly does the possibility that a message could be delivered more than once buy you?

The thing is, "exactly once" isn't really possible, with a generic message queuing system. Let me explain briefly one way you need to think about distributed systems:

The network could cut at any moment during a transaction.

If message consumers don't send acknowledgements, and the queue considers the message sent as soon as it has been successfully written to the network connection, then it might never really be delivered and processed. You can't be sure if it really got to the destination before the network cut out, or something crashed. This is "at most once" - it may have been processed once, or not at all.

If message consumers acknowledge messages after they've finished processing them, and the queue waits for that, then the acknowledgement might be the thing that is lost. The queue sends the message to a different consumer if it doesn't get an acknowledgement before a timeout, but the message might have been processed already, and the consumer crashed or the network partitioned just before the acknowledgement. This is "at least once".

You could consider a final scheme - consumers acknowledge receiving the message, before they process it. The process could crash just after the acknowledgement, or the ack could be lost without it knowing. So this isn't "at least once" or "at most once", it's "no idea".

Or maybe they even wait for an ack that the server got the ack, before processing. The process could still crash after sending its ack or after receiving the other ack, this is still just "at most once".

"At most once" is usually not useful. Usually you want "at least once", and then logic specific to your data to resolve "more than once" in an acceptable way.

Re: NSQ – A realtime distributed messaging platform

#39
post #18
post #17

I'm glad these new projects are coming on, and this one seems to be very forthright about its limitations, but I'm just putting this in the bucket with all of the other messaging systems that provide a minimum feature set. I haven't seen much on the market recently that offers things like (first-class) persistence, guaranteed ordering, guaranteed delivery, or any of the other more complex distribution patterns. That'…

I would assume its the ease of making the systems highly available and/or scalable. Scaling ActiveMQ can be a pain once you exceed the capacity of a single broker, and the standard HA setup requires shared file systems with non-broken file locks which are fairly complicated to get in cloud environments.

+1 agree with that (although you can use the DB based persistent store).

The other obvious problem with AMQ is that it supports XA transactions which means people are tempted to use it, which in turn leads to much pain and suffering for all concerned..

Re: NSQ – A realtime distributed messaging platform

#40
post #20

Earlier quoted context omitted.

Can one use NSQ as a replacement for Kafka?

Kafka offers persistence, which seems extremely rare in distributable queue. (Is it even available outside of Kafka?) On that note, what is everyone using these queues for that they can ignore durability?

The standard JMS spec supports durable queues and topics. Generally a nightmare to manage though - trying to track down a unconsumed message on a clustered durable topic with lots of subscribers is like trying to find a needle in a stack of needles.
Post reply on HN