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.
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.
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 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.
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.
This article was originally published on PubNub.com
Our platform helps developers build, deliver, and manage real-time interactivity for web apps, mobile apps, and IoT devices.
The foundation of our platform is the industry's largest and most scalable real-time edge messaging network. With over 15 points-of-presence worldwide supporting 800 million monthly active users, and 99.999% reliability, you'll never have to worry about outages, concurrency limits, or any latency issues caused by traffic spikes.
Check out Live Tour to understand the essential concepts behind every PubNub-powered app in less than 5 minutes
Sign up for a PubNub account for immediate access to PubNub keys for free