Hacker News new | ask | show | jobs
by fbomb 3940 days ago
How does performance compare to 0mq?
2 comments

This is covered on the other page they link to:

http://bravenewgeek.com/dissecting-message-queues/

"ZeroMQ is capable of sending over 5,000,000 messages per second but is only able to receive about 600,000/second. In contrast, nanomsg sends shy of 3,000,000/second but can receive almost 2,000,000."

So.. nanomsg is 10x faster. Why would one use nats?

>"So.. nanomsg is 10x faster. Why would one use nats?"

The article comparing the performance of all those messaging systems conveniently "groups" them into two groups. Brokerless, and brokered. Putting Nats into the latter, despite it not sharing any of the main things that we are used to with a brokered system. I.e. Transactions and persistance.

So, it's safe to say that in that context and those properties, there is no reason to use NATS over nanomsg.

Not a fair comparison. ZeroMQ is a socket library. NATS is a message broker.
A pretty fair comparison, I think.

NATS requires a broker, ZeroMQ doesn't (though it generally supports a "forwarding device", which -- in the absence of transactional semantics as it is in NATS -- is mostly indistinguishable from a broker).

From the user's perspective, ZeroMQ provides a superset of the functionality, and a superset of the topologies. Why would you say the comparison is unfair?

A latency/throughput benchmark comparing the two is effectively comparing the latency/throughput of a socket from A to B. The same benchmark for NATS would be a socket from A to NATS and NATS to B. Obviously the latency of going over the wire once is going to be lower than going over the wire twice.

A proper comparison would need to include the forwarding device for ZeroMQ.

Not at all. It is an internal implementation detail that, in almost all relevant topologies, ZeroMQ can do with just one socket connection but NATS needs two. Furthermore, in LAN pub/sub topologies, ZeroMQ can do with just one copy of the message on the outgoing wire + the occasional retransmit (letting the switch handle the broadcast/multicast) whereas NATS requires a copy for every subscriber.

> Obviously the latency of going over the wire once is going to be lower than going over the wire twice.

Latencywise, and all things being optimal, yes. But not all things are optimal.

Throughputwise, and all things being optimal, there shouldn't be any difference. But there is a huge one on both receive and transmit.

NATS and ZeroMQ are obviously not equivalent, but I maintain that this is an apples-to-apples proper and useful comparison, even without the forwarding device.