# What Is Fan-Out / Fan-In in CI Pipelines?

> Fan-out splits work into many parallel jobs; fan-in collects their results into one. Learn this core pipeline shape and how it speeds up CI.

Source: https://latchkey.dev/learn/ci-cd-concepts/what-is-fan-out-fan-in  
Updated: 2026-06-25

Fan-out splits one stage into many parallel jobs; fan-in waits for all of them and joins the results. Together they let CI go wide for speed, then narrow for a single verdict.

Fan-out/fan-in is the fundamental shape of a parallel pipeline. It is how you cut wall-clock time by spreading work across jobs while still ending with one aggregated, gating result.

## Fan-out

A single point in the pipeline branches into many independent jobs that run concurrently - splitting a test suite into shards, building several targets, or running a matrix. Each branch is isolated and progresses on its own runner.

## Fan-in

After the parallel work, a single job depends on *all* of the fanned-out jobs and runs only once they complete. It aggregates their outputs - merging test reports, combining coverage, or simply acting as the gate that is green only if every branch passed.

```needs: collects the fan-out
jobs:
  test:
    strategy: { matrix: { shard: [1, 2, 3, 4] } }
  report:
    needs: test   # fan-in: waits for all shards
```

## Why use it

- Speed: N parallel shards finish in roughly 1/N of the serial time.
- A single fan-in gate gives one clear pass/fail for the whole stage.
- Aggregation (coverage, reports) happens in one place.

## Pitfalls

Fan-out multiplies billable minutes and can flood a runner pool, causing queueing. The fan-in job is a synchronization point - it is only as fast as the slowest branch, so an unbalanced split (one shard far heavier than the rest) wastes the parallelism. Balance the shards.

## FAQ

### What is What is Fan-Out / Fan-In in CI Pipelines??

Fan-out/fan-in is the fundamental shape of a parallel pipeline. It is how you cut wall-clock time by spreading work across jobs while still ending with one aggregated, gating result.

### Fan-out?

A single point in the pipeline branches into many independent jobs that run concurrently - splitting a test suite into shards, building several targets, or running a matrix. Each branch is isolated and progresses on its own runner.

### Fan-in?

After the parallel work, a single job depends on *all* of the fanned-out jobs and runs only once they complete. It aggregates their outputs - merging test reports, combining coverage, or simply acting as the gate that is green only if every branch passed.

### Pitfalls?

Fan-out multiplies billable minutes and can flood a runner pool, causing queueing. The fan-in job is a synchronization point - it is only as fast as the slowest branch, so an unbalanced split (one shard far heavier than the rest) wastes the parallelism. Balance the shards.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
