Repository navigation
main: overlap Docker daemon startup with builder start - #145
Open
aayushshah15 wants to merge 2 commits into
Open
aayushshah15 wants to merge 2 commits into
aayushshah15 wants to merge 2 commits into
Conversation
The first Docker command in the step waits for the daemon to finish starting. Run it in the background right away and print Docker info after buildx setup and the builder start, so the wait overlaps them. BLACKSMITH_DOCKER_WARMUP=false restores the old order. Also poll for the buildkitd PID every 50ms instead of 300ms. Co-authored-by: Codesmith Staging <codesmith-bot@users.noreply.github.com>
Co-authored-by: Codesmith Staging <codesmith-bot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The setup step waits for the Docker daemon on its critical path. Its first Docker call is
docker versionin the "Docker info" group, and that call blocks until dockerd has finished starting. On our own step-duration-regression run on main (run 39735830544),docker versiontook 0.96 s to print anything. Buildx setup and the Blacksmith builder start then ran another 0.77 s, and neither needs the daemon.This starts that wait in the background as soon as the step begins, and prints the Docker info group once buildx and the builder are set up:
The Docker info group has the same contents and now comes right after "Starting Blacksmith builder" in the log. It's printed in a
finally, so it still appears when the builder start throws (nofallback). The daemon starts at the same point in the step as before; the step just doesn't wait for it before moving on.It also polls for the buildkitd PID every 50 ms instead of 300 ms. The PID usually shows up within a few tens of ms, so one missed
pgrepcosts a full 300 ms today.Estimated impact. Across ~23k setup runs per hour in production (2026-10-21, 12:00-13:00 UTC), "Docker info" averaged 1.14 s, the builder start 1.4 s, and the buildkitd PID wait had p50 0.32 s. Hiding most of the daemon start behind the builder start and trimming the PID wait saves about 0.8-1.1 s per run, or ~5-7 runner-hours per hour: ~0.02-0.025% of all whole-job time (denominator: ~28,500 whole-job hours, same window). These fleet numbers are modeled.
Measured. On the step-duration-regression job, the setup step (from
Run ./to the next step) took 2.12 s, 2.04 s and 2.34 s on the last three scheduled runs on main (39735830544, 39557284551, 39382020583) and 1.13 s on this PR (39875460145). The Docker info group dropped from 1.09 s to 0.15 s, because the daemon was already up by the time it ran. That's one run, so treat it as a sanity check, not a distribution.Edge cases:
docker versionwith no timeout.pgrepcalls in the 10 s timeout instead of ~33, and in practice one or two.BLACKSMITH_DOCKER_WARMUP=falserestores the old order.dist/is rebuilt in this PR.Need help on this PR? Tag
@codesmith-botwith what you need.Before, buildx and the builder start waited ~1.3 s for docker version; after, they ran while dockerd started, Docker info printed after the builder with identical contents, and the step averaged ~0.38 s faster over 5 runs each.
Merge-base
This PR
fe4fcc13Also checked · 4 match
Proof on
fe4fcc13Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is enabled. (Staging)