mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #1194] file_cache_keeps() picks unbuffered (O_DIRECT) expert reads on a 32 GB + 12 GB GPU box with --resident-budget-gib, halving decode; STRATA_UNBUFFERED_LOAD=0 restores it #494
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#494
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 @willthehuman on GitHub (Oct 6, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/1194
Engine: 0.1.40 (locally built, Linux,
arch=compute_89)Config: Q2_0 (
native experts v3pack),--mmap-experts --resident-budget-gib 18 --kv-resident 32768 --conversation-cache-mib 3072 --conversation-cache-slots 4, context 131072,--ple-iodefaultMachine: i7-8700, 31 GB RAM, RTX 4070 SUPER 12 GB, NVMe (models read from an NTFS pack volume)
Symptom
Same benchmark before and after the update — greedy, "Count from 1 to 200, one number per line",
max_tokens 260, fresh engine process each time:What the engine says
The budget itself is granted, so this is not the clamp:
Where the time goes
GET /metricsper 260-token request — the requested volume is the same on both versions, only the cache hits differ:Workaround that restored full speed
STRATA_UNBUFFERED_LOAD=0(systemd drop-in for our service):→ 65.4 / 55.1 / 63.5 t/s at 136–203 MB/s, i.e. 0.1.39-level speed with the 0.1.40 engine and all the new code.
Why the heuristic looks wrong for this case
file_cache_keeps(avail, arena_bytes, read_bytes)compares all file-read bytes (13.6 GiB) against available RAM (6.4 GiB) and concludes the cache is useless. But the file tier is a hot subset: the same experts repeat across tokens (~30 file blobs per token here, with an 82% VRAM hit-rate), and roughly 2–3 GB of page cache was enough to serve them — 0.1.39 had no O_DIRECT tier and was 2× faster on identical hardware, config and prompt.Possible improvements, in the project's measured style:
--resident-budget-gibset, default the file tier to buffered (or re-evaluate after the first requests, from the observed hit pattern) — the budget already guarantees the "all experts in RAM" case is not being attempted.STRATA_UNBUFFERED_LOAD=0for the "resident budget + small page cache" case.--low-ramanswers) for machines like this one (32 GB RAM, 12 GB GPU, mapped+resident).The docs' own #773 note ("forcing unbuffered reads there re-read 163–629 GB from the drive and halved the speed") describes the same failure mode in the no-budget case; this is the with-budget analogue, and the numbers are close (halved speed, ~6× the drive traffic).
@willthehuman commented on GitHub (Oct 6, 2026):
Related history from the tracker (for triage): #577 (0.1.38, same failure class on a 96 GB PC, closed) and #773 / #362 (the unbuffered file tier itself). This is the 0.1.40 case with
--resident-budget-gibset: the heuristic concludes the cache cannot keep the 13.6 GiB of file-read experts, but the hot subset fits andSTRATA_UNBUFFERED_LOAD=0restores 0.1.39-level speed on the same engine.@Niko1221 commented on GitHub (Oct 7, 2026):
Fixed in 0.1.40.2. You were right: the file tier is a hot subset, and 0.1.40 asked the cache to hold all of the experts it reads. Now it reads unbuffered only when the cache cannot hold a twentieth of them (at least 1.5 GiB beside a 1 GiB reserve), and through the cache otherwise. On a Tesla P100 box under a 32 GB cgroup, budget 18 (the same ratio as your 31 GB case), 10 interleaved pairs: decode 12.6 -> 15.2 tok/s on the story prompt and 9.3 -> 13.3 on the code prompt, 10 of 10 pairs faster, with 3 to 7 times less drive traffic. The answers are the same text. On 0.1.40 / 0.1.40.1 your STRATA_UNBUFFERED_LOAD=0 is exactly this.
@willthehuman commented on GitHub (Oct 7, 2026):
Confirmed fixed on the reporting box — 0.1.40.2, Linux, same config (Q2_0, budget 18). The engine now picks the cached path on its own (the
STRATA_UNBUFFERED_LOAD=0workaround is removed here): warmed decode back to 49–63 t/s and per-request drive reads down from ~6.4 GB to ~0.5 GB. Matches the direction of your P100 pairs. Thanks!FYI from the same hardware, same file tier: with a DRAM-less NVMe (Fanxiang S501), the single-stream page-fault path was the ceiling under heavy load (~116 MB/s, decode dropping to ~6 t/s).
STRATA_IO_PREFETCH=1transformed it: cold reads ~890 MB/s and a 98K-token context reload from ~13 min down to ~3.5 min. Might be worth a docs note for DRAM-less drives.@Niko1221 commented on GitHub (Oct 7, 2026):
Thanks for confirming it is fixed on your box. Closing.