Information Technology Reference
In-Depth Information
reply to the message sender. Other systems do not have this feature and instead create a
second channel for publishing replies.
There may be one channel, or thousands. Different message bus systems are optimized
for different sizes. Google's PubSub2 system (Publish Subscribe Version 2) can handle
hundreds of channels and tens of thousands of hosts. Google's Thialfi system can handle
2.3 million subscribers ( Adya, Cooper, Myers & Piatek 2011 ).
4.6.2 Message Bus Reliability
Message bus systems usually guarantee that every message will be received. For example,
some message bus systems require subscribers to acknowledge each message received. If
the subscriber crashes, when it returns to service it is guaranteed to receive all the unac-
knowledged messages again; if the acknowledgment did not make it back to the message
bus system, the subscriber may receive a second copy of the message. It is up to the sub-
scriber to detect and skip duplicates.
However, message bus systems do vary in how they handle long subscriber outages.
In some systems, subscribers miss messages when they are down. In others, messages are
stored up for a certain amount of time and are lost only if the subscriber is down for more
than a defined length of time. Some message bus systems might hold things in RAM for
just a few minutes before giving up and queueing messages to disk. When a subscriber
comes back online, it will get the backlog of messages in a flood.
Message bus systems do not guarantee that messages will be received in the same order
as they were sent. Doing so would mean that if one message was being retried, all other
messages would have to wait for that message to succeed. In the meantime, millions of
messages might be delayed.
For this reason, the subscriber must be able to handle messages arriving out of order.
Themessagesusuallyincludetimestamps,whichhelpthesubscriberdetectwhenmessages
do arrive out of order. However, reordering them is difficult, if not impossible. You could
holdmessagesuntilanylateoneshavearrived,buthowwouldyouknowhowlongtowait?
If you waited an hour, a slow-poke message might arrive 61 minutes late. It is best to write
code that does not depend on perfectly ordered messages than to try to reorder them.
Because messages may be missed or lost, usually services have a mechanism that is not
based on the message bus but that enables clients to catch up on anything they missed. For
example, if the message bus is used to keep a database in sync, there may be a way to re-
ceivealistofalldatabasekeysandthedatetheywerelastupdated.Receivingthislistonce
a day enables the subscriber to notice any missing data and request it.
As systems get larger, message bus architectures become more appealing because they
are fast, they are efficient, and they push control and operational responsibility to the
Search WWH ::




Custom Search