What is Fan-Out Software?

Fan out software.png

Fan-out is a messaging pattern where messages are broadcast in a one-to-many arrangement. A basic example of this pattern can be seen in the functionality of a Publish/Subscribe messaging system, as Pub/Sub implies the ability to route messages from a single sender to multiple receivers. 

What is fan-out messaging used for?

Fan-out is the distribution of messages by a service or message router to multiple users, often simultaneously. In software and online services, the fan-out of a logic gate output signifies the number of gate inputs it can operate. For instance, a single output may be linked to several inputs.

Types of fan-out service patterns

A more complex fan-out messaging pattern based on Pub/Sub might be used by a publisher to push messages to all or some of its channels so that various subscribers in separate channels can receive the same message at the same time. This can be useful when a method of across-the-board notification for a related set of subscribers is needed.

Another configuration that implements fan-out can be found in the Push/Pull messaging pattern where real-time events from a single data source need to be sent out in parallel across multiple endpoints. 

Fan-out message service examples and use cases

Fan-out message routing can be applied to use cases such as replicating monitoring logs from one server to multiple servers, sending notifications to multiple interested parties, or otherwise synchronizing the moving parts of a distributed (or modular) application.

What is the difference between fan-out write and fan-out read?

A good way to understand the differences between fan-out write and fan-out read is to use a service like Twitter as an example. When you post a tweet, Twitter immediately sends it to all the people who follow you. This is called a fan-out write.

On the other hand, a feed service may wait until a user is actively browsing through their feed before finding and displaying posts that are relevant to them, which is known as a fan-out read.