Skip to content

perf: directory read-ahead (bulk ReadMany) - #23

Merged
zcsizmadia merged 1 commit into
mainfrom
perf-read-ahead
Aug 28, 2026
Merged

zcsizmadia merged 1 commit into
mainfrom
perf-read-ahead

Conversation

@zcsizmadia

Copy link
Copy Markdown
Collaborator

Bulk ReadMany + directory read-ahead: one round-trip per directory instead of per file. Verified on Direction A (3000 files cold 574 ms). Direction B remains transport-bound (hv-sockets next). See bench/RESULTS.md.

Adds a bulk-read path so a sequential reader pays ~one round-trip per directory
instead of one per file:

- protocol: ReadManyRequest/ReadManyResponse (several files' whole contents, or a
  not-found marker each, in one frame).
- server: send_read_many reads the requested files, bounded to one frame.
- client: on a read miss, RemoteRoot synchronously bulk-fetches the target plus
  its uncached small siblings (one ReadMany) and caches them all; a background
  prefetcher fills the tail of large directories. read_many() is public for
  callers/tests.

Verified end-to-end on Direction A (Windows->WSL, fast transport): 3000 files
read cold in 574 ms (warm 366 ms) vs 2856 ms over \\wsl.localhost. The same path
is correct for Direction B, but that direction is bottlenecked by the WSL->Windows
localhost-forwarding relay latency (seconds/round-trip) — the Hyper-V socket
transport is the fix (see bench/RESULTS.md).

Tests: ReadManyBulkFetch and PrefetchWarmsSiblings. 98/98 Windows, 97/97 Linux,
zero warnings.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@zcsizmadia
zcsizmadia merged commit 4e8d423 into main Aug 28, 2026
3 checks passed
@zcsizmadia
zcsizmadia deleted the perf-read-ahead branch August 28, 2026 16:33
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