Skip to content

Layout F: a commit's writer holds a run at most - #63

Merged
isTravis merged 2 commits into
mainfrom
layout-f-serial-memory
Oct 20, 2026
Merged

isTravis merged 2 commits into
mainfrom
layout-f-serial-memory

Conversation

@isTravis

Copy link
Copy Markdown
Member

A commit's writer kept every index entry, about 0.33 KB a record, until the commit finished. On staging a 204k-record push (80 MB, the serial path) ran the bulk Worker out of memory on 11 of 14 attempts.

  • The writer writes a self-contained run (closed packs and an index layer) whenever drain finds layoutConfig.writerRunEntries (20,000) held. Not held, each run is named as it's written; held (commit units), the runs are returned for the commit to name together.
  • drain also waits on the writer's pack writes, so packs of large records don't pile up compressing.
  • copyRecords (privacy moves) drains the same way, in place of its own 100k batches.
  • scripts/memory.ts --layout f.

Serial commit (memory.ts --above-mb 100000 --pushes 1 --layout f), peak above start:

records before after
30k 26.6 MB 29.8 MB (heap 6.9)
120k 57 MB (heap 40.7) 28.2 MB (heap 8.8)
400k 32.3 MB (heap 8.5)

What's left is the sink's writes in flight, which pendingBytes bounds.

Protocol tests 254 and server tests 566 (both layouts) pass. A follow-up PR bounds F's other paths (index reads, merges, reclaim, sync).

A commit's index entries were held until it finished, about 0.33 KB a record:
a 204k-record push ran the bulk Worker out of memory on staging. The writer now
writes a self-contained run (closed packs, an index layer) whenever drain finds
writerRunEntries held, named as it goes or, held, returned for the commit to
name. copyRecords drains the same way. memory.ts takes --layout.
Closed packs wrote with no limit: with large records a run's worth could be
compressing at once.
@isTravis
isTravis merged commit 004b82e into main Oct 20, 2026
1 check passed
tefkah added a commit that referenced this pull request Oct 20, 2026
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