[rabbitmq-discuss] Clustering and ordering, please explain
david at rabbitmq.com
Thu Sep 16 10:51:18 BST 2010
rabbit at subscribed.udmvt.ru writes:
> As far as I understand, queues are not replicated between nodes,
Correct, the contents of a queue are stored on only one node.
> But what about exchanges? They are replicated and "exists" on every
> node, right?
But note that exchanges do not buffer any messages. Queues also exist
on every node in the following sense: You can connect to any node, and
consume from any queue. It's just that the messages in the queue only
reside on one node. Exchanges do not hold messages, but only route
them, so the same issue of replication of stored messages does not
> So, I'm imagined such situation:
> suppose we have N boxes, each running rabbitmq cluster node.
> Every box also executes some application instance, that connects to it's own
> rabbitmq node, creates it's personal queue and binds it to one globally
> known fanout exchange. Application instances publish their messages to
> the exchange and receive the global message flow from personal queues.
> So, if one box gets down, the rest continues without interruption, no one
> notices that, right?
> But the question is: what if two boxes, A and B, each have published a
> message to the same exchange at the same moment in time, is it true,
> that there is no ordering guaranties when that messages gets delivered
> to queues across nodes? Is it true, that different queues may deliver
> two messages in different order, despite they had been published on
> the same exchange?
AMQP does not guarantee the order of messages in this case anyway, so
even without clustering, it would be ok for rabbit to route the messages
to queues bound to the same exchange in different orders.
The ordering guarantees of AMQP 0-9-1 are covered in section 4.7 of the
specification PDF (available at
[...] Specifically, contents flowing through a single path within the
server will remain ordered. For contents of a given priority flowing
through a single path, we define a content processing path as
consisting of one incoming channel, one exchange, one queue, and one
outgoing channel. [...]
So if you have two queues, you are dealing with two different content
processing paths, and the order that messages arrive in the two queues
does not have to be consistent.
The relaxed nature of this ordering guarantee may surprise people. It
Staff Engineer, RabbitMQ
SpringSource, a division of VMware
More information about the rabbitmq-discuss