Skip to content

docs(pod5): record that MADV_WILLNEED does not help the cold read - #220

Open
jayhesselberth wants to merge 1 commit into
worktree-basecall-readahead-depthfrom
worktree-pod5-prefetch
Open

jayhesselberth wants to merge 1 commit into
worktree-basecall-readahead-depthfrom
worktree-pod5-prefetch

Conversation

@jayhesselberth

Copy link
Copy Markdown
Member

Stacked on #219 (which is stacked on #218). Comment-only — no functional change, and the experimental knob is not kept.

Why this was worth trying

MADV_SEQUENTIAL is already applied at mmap time, and its comment describes exactly the failure mode we measured. But it only widens the readahead window — the leading edge is still a synchronous fault, which is what a cold demux basecall stalls on: the encoder sits idle 52–66% of samples waiting 88–152 s on the reader. MADV_WILLNEED is qualitatively different — it queues the I/O and returns, so pages can be resident before they are touched.

It does not help.

Measurement

Both arms came from one binary (env-gated) so no build difference could leak in. Cold 2x2 over two gpu nodes, each run reading a file that node had never touched (page cache is per node), throughput normalised by file size since the files differ in size by up to 1.7x:

node prefetch off prefetch on
compgpu03 76.2 MiB/s 76.1 MiB/s −0.1%
compgpu01 40.5 MiB/s 45.0 MiB/s +11%
compgpu01 53.9 MiB/s 35.7 MiB/s −34%

On compgpu03 it is exactly neutral, and for a good reason — there the reader is already ahead of the encoder (it waits 49–60 s on it), so the run is encoder-bound and no I/O change can help. On compgpu01 the two replicate pairs disagree in direction, against a same-setting run-to-run spread of 40.5–53.9 MiB/s.

Had I stopped at the first pair I would have shipped a "+11%" that the second pair contradicts.

What actually dominates

The node, not the advice. compgpu01 ran at roughly half compgpu03's throughput for identical work at every setting — the same 2.2x node spread that showed up in #219's depth sweep. The tightness of the compgpu03 pair (76.1 vs 76.2 MiB/s) says the harness resolves small effects fine; the noise is real filesystem behaviour on that node.

So for cold runs, the lever is which node the job lands on, not more code in the reader. Worth knowing before anyone spends more time optimising this read path.

161 pod5 tests pass; clippy and fmt clean.

@jayhesselberth
jayhesselberth force-pushed the worktree-pod5-prefetch branch from 068e855 to b15c472 Compare August 15, 2026 19:41
`MADV_SEQUENTIAL` only widens the readahead window; the leading edge stays
a synchronous fault, which is what a cold `demux basecall` stalls on — the
encoder sits idle 52-66% of samples waiting 88-152 s on the reader. Adding
`MADV_WILLNEED` over the whole signal table is the obvious next step, so
this records that it was tried and measured rather than leaving the next
person to rediscover it.

Both arms came from one binary (env-gated) to keep a build difference out
of it. Cold 2x2 over two gpu nodes, each run reading a file that node had
never touched, throughput normalised by file size:

| node | prefetch off | prefetch on | |
|---|---|---|---|
| compgpu03 | 76.2 MiB/s | 76.1 MiB/s | -0.1% |
| compgpu01 | 40.5 MiB/s | 45.0 MiB/s | +11% |
| compgpu01 | 53.9 MiB/s | 35.7 MiB/s | -34% |

On compgpu03 it is exactly neutral, and for a good reason: there the
reader is already ahead (it waits 49-60 s on the encoder), so no I/O
change can help. On compgpu01 the two replicate pairs disagree in
direction against a same-setting spread of 40.5-53.9 MiB/s.

The dominant variable is the node, not the advice — compgpu01 ran at half
compgpu03's throughput for identical work at every setting. The tightness
of the compgpu03 pair (76.1 vs 76.2) says the harness resolves small
effects fine; the noise is real filesystem behaviour.

No functional change; the experimental knob is not kept.

This branch has not been deployed

No deployments
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