Skip to content

Measure the file-cache floor of the suggested budget on real builds #70

Closed

Description

@sourcehawk

Problem

The suggested budget of a capped measurement keeps a floor for file cache of a quarter of the full peak (CACHE_FLOOR_DIVISOR = 4 in bounded_run.py, from #59). That value is reasoned, not measured. If it is too low, a command that reads many files again and again (a build, a type check, a development server) thrashes under its new, smaller cap and runs much slower. If it is too high, budgets stay above the need and hold slots that other sessions could use.

Approach

Measure two or three real heavy commands that read and write many files, under caps at several multiples of their held peak, and compare wall time with a run at the old budget. Keep the divisor if the runs at the floor are close to the old time. Otherwise change it, and write the measurements in the PR.

Acceptance criteria

  • Measurements of at least two such commands, with the cap, the wall time, and the peak and held lines.
  • CACHE_FLOOR_DIVISOR is kept or changed on that evidence, and the skill's sentence about the floor still matches.

Context

Follow-up of #59 (PR #67).

Activity

  1. sourcehawk commented on Oct 6, 2026

    @sourcehawk
    OwnerAuthor

    Result: keep CACHE_FLOOR_DIVISOR = 4

    I measured six real heavy commands on a 16-processor Linux machine with 27 GiB of memory, under the hard cap, at --cpus 8. Before each timed run, a script dropped the page cache of the source, module, and toolchain files (posix_fadvise DONTNEED), so that each run read its files from the disk. Each Go build that the table calls cold started with an empty GOCACHE. The wall time is the time of the command only, not the wait in the queue. Other agent sessions ran on the machine at the same time (load average 8 to 9), so a difference of about 5 seconds is noise.

    The floor did not bind for any command

    The floor applies only when held is less than a quarter of peak. For each command, held was more than that.

    command peak held peak / 4
    Go build of a large operator, cold 3720M, 4536M 1985M, 1905M 1134M or less
    the same build, warm GOCACHE 2362M 1060M 590M
    the Go test compile of the same module (go test -run '^$' -exec /bin/true ./...), cold 4109M 2230M 1028M
    tsc --noEmit of a Next.js app 2369M 2239M 592M
    the unit tests of this repository 251M 206M 63M

    Row lines of the first measurements:

    bounded-run: row label=build cpus=8 budget=3072M peak=3720M held=1985M exact=yes exit=0
    bounded-run: row label=build-warm cpus=8 budget=1792M peak=2362M held=1060M exact=yes exit=0
    bounded-run: row label=testc cpus=8 budget=3584M peak=4109M held=2230M exact=yes exit=0
    bounded-run: row label=tsc cpus=8 budget=3072M peak=2369M held=2239M exact=yes exit=2
    bounded-run: row label=pytests cpus=8 budget=512M peak=251M held=206M exact=yes exit=0
    

    The type check exits 2 because the app has type errors. It did its full work and reported them.

    Wall time under smaller caps

    Three runs at each cap, in turn:

    command cap wall time
    Go build, cold 4864M (the budget from peak, before #67) 71.2, 73.1, 66.5 s
    3072M (the suggested budget now) 69.6, 70.1, 70.0 s
    2560M 69.0, 73.0, 68.2 s
    2304M 69.2, 70.7, 65.2 s
    1792M 65.6 s (one run, exit 0)
    Go build, warm GOCACHE 3072M 5.3, 5.2 s
    1792M 8.0, 6.9, 7.1 s
    1536M 9.9, 11.4, 11.4 s
    1280M 26.4, 24.3, 20.5 s

    The cold build does not slow down at any cap down to 1792M. The warm build reads the files of its cache again and again, and it slows down when its cap is near held. A budget from a cold measurement (3072M) keeps the warm build at full speed. A budget from a warm measurement (1792M) makes it about 35% slower. A change of the divisor does not change that budget: with a divisor of 2 or more, the floor stays below _with_margin(held).

    The divisor stays at 4. The sentence about the floor in the skill still matches the code, so the skill does not change.

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions