skip to content

Using a Build Scan, how would you identify a serial bottleneck — a task or chain that prevents the build from parallelizing — and what does the critical path tell you?

level: seniorimportance: should knowfreq 40%

answer

  1. idle lanes + one busy lane
  2. critical path = longest dependency chain
  3. lower bound on wall-clock
  4. more workers won't beat it
  5. split module / make cacheable

basics

~20 s

On the Timeline, look for a long stretch where one task runs while other worker lanes sit idle — that's a serial bottleneck. The critical path is the longest dependency chain; shortening it shortens the whole build.

solid answer

~50 s

A **serial bottleneck** appears on the Timeline as a region where one (or few) lanes are busy while the rest are **idle** — the build can't fan out because everything downstream depends on that task. You spot it by scanning for tall single-lane bars surrounded by whitespace on other lanes. The **critical path** is the longest dependency-respecting chain of tasks from build start to finish; its total duration is a *lower bound* on wall-clock time no matter how many workers you add. Develocity surfaces critical-path information; even without it you can reconstruct it by following the Timeline's dependency-ordered tasks that have no idle gaps. The optimization implications: adding `--max-workers` won't help a critical-path-bound build — you must instead shorten the longest task on the path (make it cacheable, split it), or restructure module dependencies so the chain breaks into parallelizable branches.

go deeper

for a junior

Recognize that idle lanes next to one busy lane mean the build isn't parallelizing.

for a middle

Identify the serial chain on the Timeline and know that dependencies force ordering.

for a senior

Reason about the critical path as a lower bound, pick the highest-leverage task, and choose between caching, splitting, and dependency restructuring.

for a principal

Set module-decomposition and dependency-hygiene standards so critical paths stay short across the codebase, tracked via Develocity.

## Parallelism vs the critical path Gradle runs independent tasks concurrently across worker threads (with `org.gradle.parallel=true`). But tasks linked by dependencies must run **in order**. The longest such ordered chain is the **critical path**: its summed duration is the *minimum possible* wall-clock time. Throwing more CPUs at the build cannot beat the critical path — only changing what's *on* it can. ## Spotting a serial bottleneck on the Timeline The Timeline draws tasks across worker **lanes**. Two visual signatures of a bottleneck: 1. **A lone busy lane** — one long bar runs while every other lane is blank. Everything is waiting on it. 2. **A staircase** — a sequence of bars each starting right when the previous ends, all on one lane, with no overlap. That's a serial chain, likely the critical path. A healthy parallel build instead shows **dense, overlapping bars** filling most lanes for most of the wall-clock window. ## What the critical path tells you - It identifies the **highest-leverage** task to optimize: shaving 10s off a task *on* the path shortens the build by ~10s; shaving 10s off an *off-path* task that already overlaps saves nothing. - It tells you when **more workers won't help** — if your build is critical-path-bound, `--max-workers=16` is wasted. ## Fixes - **Shorten the longest path task**: make it `@CacheableTask` so it's `FROM-CACHE`, split a monolithic module, or speed the task itself. - **Break the chain**: reduce unnecessary inter-module dependencies so a long linear chain becomes parallel branches. - **Re-check parallelism settings** only after confirming the build *isn't* critical-path-bound (otherwise it's noise). ```text Lane 0: :core:compile ███████ :core:jar ██ :app:compile ████ :app:test ████████ Lane 1: (idle) (idle) Lane 2: (idle) (idle) ^ single busy lane + idle lanes = serial bottleneck; the chain above is the critical path ```

  • Why won't increasing --max-workers help a build dominated by its critical path?
    The critical path is an ordered dependency chain that must run sequentially; extra workers have nothing independent to do while the chain runs, so wall-clock stays bounded by the chain's length.
  • How does making a critical-path task FROM-CACHE help more than caching an off-path task?
    Time saved on the critical path directly shortens total wall-clock; an off-path task already overlapped, so caching it removes work that wasn't extending the build anyway.
  • What Timeline signature distinguishes a well-parallelized build from a serial one?
    Well-parallelized builds show dense overlapping bars across most lanes; serial builds show one busy lane with idle whitespace on the rest.

The critical path is the longest line at airport security: opening more checkpoints (workers) helps only if people can split across them. If everyone must pass one slow checkpoint in sequence, you must speed up that checkpoint.

  • Recommending more workers/CPUs for a build that is critical-path-bound.
  • Optimizing an off-critical-path task because it 'looks slow' even though it already overlaps other work.
  • Confusing total task time with wall-clock time when reasoning about bottlenecks.

context