[rabbitmq-discuss] Massive distributed pub/sub system
kaiduanx at gmail.com
Wed Jan 26 04:24:52 GMT 2011
I am a newbie on AMQP and RabbitMQ, and have a distributed pub/sub
problem to be solved with the following requirements,
1) Any user can subscribe to the interested topic, but only topic
owner can publish message to the group. There is no limit on the
number of subscribers in each group. Potentially it can be huge, for
example, the fans of U2 around the world.
2) User including subscriber and publisher is not always connected to
the system, and not always connected to the same node in the system,
and the message delivery should be guaranteed. When publisher
publishes a message, the system should deliver the message to all
subscribers. If the subscriber is connected to the system, the message
should be delivered immediately. If the subscriber is not connected,
system should hold the message, and the next time the user comes
connected, system will deliver the message to the user. Just imagine
the user can be any mobile user and moves out of cellular coverage.
3) The system should be able to support tens to hundreds of millions
users spreading around the world, so the system will consist hundred
of nodes located in different physical locations.
4) The number of topics/groups in the system is unlimited.
5) As to the latency, it should be in the range of 1 minute if
subscriber is connected.
It looks like RabbitMQ already has functionalities to meet the above
requirement, for example, fan out exchange, and persistent message.
The following is my understanding on how to build the above system
a) Publisher creates an exchange. For example, U2 creates an exchange
noted as "U2" for "U2's next world wide tour" on Node 1.
b) Each subscriber creates a queue in the system. For example, Alice
creates a queue noted as "Alice" on Node 2 and binds to exchange U2;
and Bob creates a queue noted as "Bob" on Node 3 and binds to exchange
"U2" on Node 2.
c) U2 publishes a message, m1 on Node 1 to exchange "U2"; and RabbitMQ
will deliver the message m1 to queue "Alice" on Node 2 and to queue
"Bob" on Node 3.
How we handles the following scenarios?
1) When U2 wants to publish a message, but Node 1 is done.
2) When message m1 is delivered to queue "Alice" on Node 2, Node 2
crashed or the network link between Node 1 (publisher's node) is
disconnected? Will exchange "U2" on Node 1 persist the message?
3) After message m1 is arrived on queue "Alice", but the connection
between Alice and Node 2 is gone, the message will be stored on Node
2, right? Next time, Alice connects to the system, but she is
connected to Node n instead of Node 2, how to handle this?
4) What is the multi-cast technology used in RabbitMQ to deliver the
message to queues located on different locations spreading around
My understanding of AMQP and RabbitMQ is very limited, so please
forgive me if something is wrong or naive. Please share your thought
and experience on this, thanks a lot for helping out.
More information about the rabbitmq-discuss