Skip to content

Layout F: reads in fewer round trips - #66

Merged
isTravis merged 1 commit into
mainfrom
layout-f-read-speed
Oct 21, 2026
Merged

isTravis merged 1 commit into
mainfrom
layout-f-read-speed

Conversation

@isTravis

@isTravis isTravis commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

#65 bounded F's reads at a cost in storage round trips (layout-f-pr.md "Watch for", items 1–3). That cost showed on staging. An fsck of f-test-b, a 204k-record F version, ran 381 s of wall time on 19 s of CPU and was then canceled. Today's layout's fsck of the same records took a few minutes.

  • Index reads first drop layers whose min/max miss the keys, using the manifest with no reads. They then take 16 layers at a time (was 4), so a collection's usual ~10 runs is one round.
  • A leaf's index pages: 8 in flight (was one ahead).
  • Pack reads: up to 64 blocks a request (was 16).
  • Whole-leaf readers (bodyLineStream, fsck, sync, copyRecords) take up to 4 MB of records a lookup (leafChunks) instead of 256 records. A leaf of small records is one index lookup instead of four.

Memory stays bounded by these constants. The 400k memory gate (memory.ts --layout f --records 400000 --small-every 2000 --read-ms 1 --max-mb 60) passes: a whole-version read peaks at 16.7 MB (12.0 before), layout.maintain at 54.3 MB, and every job is under 60 MB.

Protocol 258 and server 566 (both layouts) pass.

Deploy: both Workers, no migration. Then rerun fsck on qa-review-2/f-test-b.

#65 bounded F's reads at a cost in round trips, which showed on staging: an
fsck of a 204k-record F version ran past six minutes (its job was canceled)
where today's layout's took a few.

- An index read skips layers whose keys miss its own (from the manifest, no
  reads), then takes 16 at a time: a collection's usual ~10 runs in one round.
- A leaf's index pages: 8 in flight, not one ahead.
- Pack reads take up to 64 blocks a request (16).
- Readers of a whole leaf (bodyLineStream, fsck, sync, copyRecords) take a few
  MB of records a lookup (leafChunks), not 256 records: a leaf of small
  records is one lookup.
@isTravis
isTravis merged commit 489ca57 into main Oct 21, 2026
1 check passed
@isTravis
isTravis deleted the layout-f-read-speed branch October 21, 2026 02:26
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