Skip to content
🎓 Take the Quiz
.md

Parallel Queues

Not all changes conflict with each other. A frontend CSS change and a backend API change can often be tested and merged independently. Parallel queues (sometimes called “partitions” or “scopes”) allow this:

Single queue: all PRs wait in one line, even if they don’t conflict.

Frontend

Backend

Docs

Frontend

main

Parallel queues: independent scopes merge simultaneously.

Frontend

Frontend

main

Backend

Docs

With parallel queues:

  • PRs in the same scope are tested against each other (strict ordering)
  • PRs in different scopes can merge independently (parallel)
  • You define scopes based on your codebase (by directory, by team, by project)

This dramatically increases throughput for large monorepos where most changes don’t interact.

Consider a monorepo with three teams: Frontend, Backend, and Platform.

Without parallel queues, all 30 daily PRs wait in a single queue. With a 20-minute CI pipeline, a serial queue processes ~24 PRs per 8-hour day. At 30 PRs/day, the queue falls behind.

With parallel queues scoped by directory:

ScopePRs/dayQueue capacityStatus
src/frontend/1224/dayComfortable
src/backend/1524/dayComfortable
src/platform/324/dayNearly empty

Each scope operates independently. Combined throughput is 72 PRs/day — 3x the single-queue capacity. Teams merge at their own pace without blocking each other.

Common approaches to defining parallel queues:

  • By directory — group by file paths (src/frontend/, src/backend/, docs/)
  • By team — each team owns their scope and merge pace
  • By build target — particularly useful with monorepo build tools like Bazel, Rush, Nx, Turborepo, or Pants that understand dependency graphs

What happens when a PR touches multiple scopes?

StrategyBehavior
UnionPR joins all affected queues, must pass all
Primary scopePR joins only its primary/largest scope
Global queueCross-scope PRs go to a single global queue
  1. Higher throughput - independent changes don’t block each other
  2. Faster merges - smaller queues = shorter wait times
  3. Team autonomy - teams control their own merge pace
  4. Fault isolation - one team’s failures don’t affect others

Good scope boundaries share three characteristics:

  1. Low coupling — changes rarely cross scope boundaries. If 30% of PRs touch multiple scopes, the boundaries are too fine-grained.
  2. Independent testing — each scope has its own test suite that can validate changes without running unrelated tests.
  3. Clear ownership — teams know which scope their changes belong to, reducing ambiguity.

Start with coarse scopes (2-3 partitions) and refine over time. Overly granular scopes create overhead and make cross-scope changes painful.

  • Scope definitions need maintenance as codebase evolves
  • Cross-cutting changes may still create bottlenecks
  • Requires clear code ownership boundaries

See also: Monorepos for a deep dive on parallel queues in practice.