Brokerless messaging

There are several advantages to the broker-based model:

  • There is clear segregation between connected services. The only address a producer needs to know is that of the Broker.
  • Producer and consumer lifetimes don't have to overlap. A Producer can send a message to a broker, die, and then much later a Consumer can come up and read the message.

There are, however, some drawbacks:

  • The Broker can become a bottleneck, where all messages need to squeeze through. This can affect performance.
  • There is no network I/O which is absolutely necessary.

For example, in a typical EDA architecture with a broker with four processors, we'll get a communication pattern such as this:

With a central broker, it cannot get more efficient than this. However, if the processors were allowed to talk to each other, we could have had much more efficient communication and lower end-to-end latency:

We can still retain some of the benefits of the brokered architecture (such as the isolation level) with the efficiency of the peer-to-peer architecture, if we let the Broker just act as a directory service, rather then a message forwarder.

NSQ is a messaging platform (incidentally written in Go), and it's described in the following section.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset