Skip to content

scale builder tmpfs with VM memory instead of fixed 3G#207

Draft
sjmiller609 wants to merge 1 commit intomainfrom
hypeship/builder-tmpfs-scale-with-memory
Draft

scale builder tmpfs with VM memory instead of fixed 3G#207
sjmiller609 wants to merge 1 commit intomainfrom
hypeship/builder-tmpfs-scale-with-memory

Conversation

@sjmiller609
Copy link
Copy Markdown
Collaborator

Summary

The builder agent mounts a tmpfs at /var/lib/buildkit for BuildKit's overlay snapshotter, hardcoded to size=3G. That's tight: any base image plus install layer that exceeds ~3GB extracted hits no space left on device mid-build, even when the VM was provisioned with 16GB+ of RAM.

This change scales the tmpfs to 75% of VM memory (read from /proc/meminfo) with a 1GiB floor and a 3G fallback, so callers who pay for a larger builder VM actually get the disk budget they expect.

Test plan

  • go vet ./... and go build ./... in lib/builds/builder_agent (already passing locally)
  • Confirm a 2GB-RAM builder still mounts tmpfs (75% = 1.5G, above the floor)
  • Confirm a 16GB-RAM builder mounts tmpfs at ~12G
  • Run a known-large build (e.g. chromium-vgpu base + pip install vllm) end-to-end on a sized-up builder

The /var/lib/buildkit tmpfs that BuildKit's overlayfs snapshotter writes
into was hardcoded at 3GB. That's enough for small alpine-based images
but too tight for any build whose base image extracts to >3GB on its
own — e.g. GPU-driver bases like onkernel/chromium-headful-vgpu, where
the FROM extraction alone leaves no room for a single apt install.

Size the tmpfs at 75% of the builder VM's MemTotal so callers who
request more memory_mb actually get more snapshot headroom. Keeps the
3G fallback for tiny builders or unreadable /proc/meminfo.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant