The synchronized fan-in pattern combines multiple input channels into one output channel, just like the classic fan-in pattern. However, unlike the basic fan-in, each sender waits for an acknowledgment (wait chan) before sending the next message, ensuring a level of control, synchronization, and safety in message processing.
This distinction enables a wide range of real-world applications where rate limiting, state consistency, or acknowledgment is crucial.
In financial systems (e.g., banks, trading), you ingest transaction records in parallel.
- Why this pattern? Ensures each transaction is confirmed before the next is accepted, preserving auditability and consistency.
- Difference: Regular fan-in may allow duplicate or unordered inputs. This pattern guarantees safe sequential processing.
Multiple concurrent streams (video/audio/subtitles) must be aligned and synchronized before rendering.
- Why this pattern? Each segment waits until acknowledged to maintain stream sync.
- Difference: Regular fan-in has no guarantee that frames are consumed before the next arrives. Synchronized fan-in ensures decoding and timing control.
Parallel workers generate predictions; results are aggregated centrally.
- Why this pattern? Workers wait until the central aggregator finishes using a result, avoiding overload.
- Difference: Regular fan-in might flood the aggregator. This version enforces result-level throttling.
Player inputs (e.g., moves, attacks) arrive continuously.
- Why this pattern? Server acknowledges valid events before accepting new ones, preventing exploits or out-of-order processing.
- Difference: Regular fan-in accepts all inputs. This approach enforces input pacing and fairness.
Messages from multiple users are routed to a server and then broadcast.
- Why this pattern? The server confirms delivery before new messages are processed, avoiding race conditions.
- Difference: In regular fan-in, messages could be dropped or misordered. Synchronized fan-in maintains delivery integrity.
Replicated systems must apply writes in strict order.
- Why this pattern? Source waits for replica acknowledgment before sending more.
- Difference: Regular fan-in cannot enforce replication order. This enforces strict consistency.
Sensors (temperature, voltage, etc.) send values to a controller.
- Why this pattern? Controller acknowledges each reading before more are allowed, managing processing load and timing.
- Difference: Basic fan-in can overwhelm the controller. This keeps device-controller communication controlled and predictable.
Multiple sources trigger notifications; central sender processes them.
- Why this pattern? Sender confirms message was sent (or throttled) before next input.
- Difference: Regular fan-in may exceed rate limits. This supports throttling and guaranteed delivery.
Hundreds of sensors push real-time data into a central analytics engine.
- Why this pattern? The engine only lets new data in when it's ready, ensuring completeness.
- Difference: Regular fan-in accepts firehose data. This version offers backpressure.
Concurrent services log messages to a collector.
- Why this pattern? Logger controls log write rate, ensuring file or DB isn’t overwhelmed.
- Difference: In regular fan-in, high-velocity logs can get dropped. This ensures controlled logging.
Each stage of a processing pipeline receives items and must complete its step before new work arrives.
- Why this pattern? Prevents queue buildup and enforces processing discipline.
- Difference: Regular fan-in streams data unbounded. This provides per-step flow control.
Services feed requests into a shared outbound HTTP client.
- Why this pattern? Outbound requests are rate-limited and synchronized.
- Difference: Basic fan-in could cause burst traffic. This offers controlled, sequential flow.
Users submit live comments that are moderated before being published.
- Why this pattern? Each comment must be reviewed before the next is accepted.
- Difference: Regular fan-in ignores moderation timing. This enforces sequential moderation.
Events from many sources are collected and need to be verified for audit trail.
- Why this pattern? Auditor confirms integrity and logs before allowing the next.
- Difference: Fan-in alone can't enforce audit guarantees. This ensures each event is securely recorded.
Workers pull tasks from a dispatcher; dispatcher must verify each job is running before giving another.
- Why this pattern? Prevents task duplication or overload.
- Difference: Fan-in can't manage pull timing. This ensures the dispatcher remains in control.
Use this pattern when you need:
- Flow control / backpressure
- Acknowledgment before continuing
- Guaranteed order or fairness
- Controlled throughput under concurrency
This pattern is particularly suited to real-time systems, distributed coordination, and controlled pipelines — where timing, reliability, and acknowledgment matter just as much as concurrency.