mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #4104] [Engine] --ple-io ram faults the 26.8 GiB PLE table in with a per-page userspace toucher: 310 s (~90 MB/s) where one MADV_POPULATE_READ runs at the drive's 979 MB/s #1795
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#1795
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @chenyb999-zhcn on GitHub (Oct 25, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4104
Area
[Engine]
Desktop app, Terminal or source?
Source (START-HERE.bat, setup.sh or a build)
What happened
A cold
--servestart with--ple-io ramspends 310.3 s faulting the 26.8 GiB PLE n-gram table into the page cache before it mlocks it (215 s when a previous run left some of it cached) — ~90 MB/s — while the drive underneath it (NVMe) reads the same file range sequentially at 881 MB/s: the raw media time is ~31 s. The startup script drops caches first, so every start pays this cold.The fault-in in
PleTable::open(src/kernels/ngram.cpp, POSIX branch of the--ple-io ramsetup) does three things:madvise(MADV_WILLNEED)over the whole 26.8 GiB range — the kernel readahead window is capped far below that, so the advise mostly asks for nothing;mlock()afterwards, which walks the same page tables a second time.Measured on this machine with a standalone ctypes probe against the real shard (engine stopped,
drop_cachesbefore each cold pass), on the 26.8 GiB table:madvise(MADV_POPULATE_READ)(Linux 5.14+)MADV_POPULATE_READsplit over 16 threads by 64 MiB piecesmlock()alone after the pages are faultedTwo findings worth stating before any fix: the kernel-side batched populate exists (since 5.14) and runs at full device speed with one thread, because the single advise keeps the reads sequential; chunking the same advise across threads collapses it to random read-ahead (225.6 s), so the parallel shape only ever pays when the bytes are already in RAM.
mlockitself is never the problem (≤0.8 s) and does not need parallelising.Expected behaviour:
--ple-io ramfaults the table in at the speed of the device it is reading from, instead of at userspace-page-fault speed.I have this patched (single whole-range
MADV_POPULATE_READ, falling back to the current WILLNEED + touch pool where the advise answers ENOSYS/EINVAL, plus a split timing line): the startup line goes fromto
The PR is ready to open from
chenyb999-zhcn:engine-ple-populateonce this is filed — say the word if a different shape is wanted.Side note while in there: the comments in
tools/iq_pack.pyandgenerate.cppsay the PLE table lives in shard 1; on this pack it is in shard 2 (file offset 682,453,280).Smallest steps or command that reproduce it
sync && echo 3 > /proc/sys/vm/drop_cachesstrata generate --serve ... --ple-io ramand read thePLE table locked in RAM in X sline. Compare withdd if=<shard gguf> bs=1M skip=<PLE offset MiB> count=27000 iflag=direct | pv >/dev/nullon the same file.Reproduction status
Reproduced locally
Strata version
Strata 0.2.5 · engine 0.1.49.1 (patch validated on engine 0.1.50)
Graphics card, memory and system
2x Tesla V100-PCIE 32 GB · 96 GB RAM · Ubuntu 26.04.1 LTS (kernel 7.0.0-38-generic) · ZhiTai Ti600 1 TB NVMe
Model, size and settings
Qwen3.8-Flash-Next UD-Q4_K_XL · 131K context ·
--ple-io ram--layer-split auto· pictures onLogs
@Niko1221 commented on GitHub (Nov 5, 2026):
Thanks for taking the time to report this.
Strata has changed a lot since this was opened, and 0.2.11 is out now, so many older reports no longer apply. We're closing issues older than a week that have had no new reports in the last week. Closed here does not mean rejected.
To reopen it takes about two minutes:
/reopen. A check runs and either reopens the issue or lists what is still missing.The rules are in CONTRIBUTING.md.