Skip to content

Build once and distribute, instead of every shard building for itself #14

Description

@sotashimozono

Every shard currently runs julia-buildpkg for itself, so an N-shard run instantiates and precompiles the same project N times. The obvious fix is to build once and hand the result to the children.

The distinction that decides whether this is worth it

Redundant precompilation across shards is concurrent. Eight shards each spending 50 s precompiling costs 400 runner-seconds but only 50 s of wall clock. Building once and distributing serialises that work:

today:      precompile ∥ precompile ∥ …  →  test     =  precompile + max_bin
build-once: build → distribute → test                 =  build + download + max_bin

So on wall clock this is neutral at best and usually slightly worse. On runner-seconds it is a large win — Nx precompile becomes 1x.

Writing this down because it is the kind of claim that otherwise gets argued from intuition each time it comes up. If the goal is a faster PR, this is not the lever. If the goal is cheaper CI, it is a good one.

Where it does buy wall clock

When shards start staggered — see #8 — a late starter that can restore a prebuilt depot is cheap instead of paying full startup. Build-once and work-stealing compose; neither substitutes for the other.

Options

approach effect cost
Prebuild job uploading the depot as an artifact, shards restore it Nx precompile becomes 1x serialises the build; a large artifact transferred N times
julia-actions/cache with an explicit depot input same cache, one location still restores per job
Sysimage via PackageCompiler biggest cut to per-shard startup slow to build, and must match the --check-bounds setting or Julia will not use it (see #10)
Persistent depot on a self-hosted pool already does this why the private repos' fixed cost differs from the hosted ones

Prerequisite

Do not start here. #10 has to establish where the fixed cost actually goes first — there is a live hypothesis there that --check-bounds=yes makes the test step recompile a stack julia-buildpkg already precompiled under different flags. If that holds, it is a larger lever than distributing a build, and cheaper to act on.

TODO

  • Settle Confirm the shared depot cache actually lowered the per-shard fixed cost #10 first: measure a warm steady-state run and find where the per-shard startup actually goes.
  • Only if precompilation is still a significant share: prototype a prebuild job with a depot artifact, behind an input.
  • Report both wall clock and runner-seconds in the comparison. Reporting one without the other is how this decision gets made wrongly.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions