mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #2040] [Linux, SATA SSD] --ple-io boot auto-switch to mmap degrades PLE prefill ~7x: the 15K rows/s "direct is healthy" threshold is calibrated for NVMe, so it trips on ordinary SATA SSDs where direct is actually the faster mode #814
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#814
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 @lanceyang093-blip on GitHub (Oct 12, 2026).
<html>Original GitHub issue: https://github.com/Niko1221/Strata/issues/2040
Environment. Ubuntu, SATA SSD (Lenovo SL750 240 GB,
/sys/block/sda/queue/rotational= 0), RTX 3070 Mobile16 GB, 61 GB RAM, engine 0.1.43 (git build), IQ3_S GSQ-RCO, PLE table 28.8 GB (320,001,536 rows × 90 B),--prefill auto:32768,--ple-row-cache 2097152, experts in a pinned RAM arena (~47 GiB), KV int8 resident.Symptom. On 0.1.43, a fresh 77.8K-token prompt prefill runs at 76–154 tok/s across 4 cold runs. Identical config on 0.1.41 (binary swapped, everything else the same): 902.8 tok/s, verified after
drop_caches+ fresh process (cold page cache, cold row cache). A 6–9× version-level regression that survives controlling every cache.Boot log (0.1.43):
Disk measurement (O_DIRECT 4 KiB reads on the PLE file, 16-thread pread = the engine's own DirectFile pattern):
mode | throughput | IOPS -- | -- | -- rand 4 KiB, 1 thread | 13.6 MB/s | 3.3K rand 4 KiB, 16 threads (direct pattern) | 41.3 MB/s | 10.1K direct, 0.1.41 production prefill | ~59 MB/s | ~14.4K direct, 0.1.43 boot probe (logged) | ~35 MB/s | ~8.6K mmap, 0.1.43 production prefill | ~8.6 MB/s | ~2.1KRoot cause.
directon Linux is a pool of 16 threads each doing blockingO_DIRECT pread(thread count = queue depth,src/platform/direct_file.cpp). That is the right regime for a SATA SSD: 16 outstanding reads hide NAND latency, and this disk sustains ~10–14K IOPS (41–59 MB/s) in that mode.constexpr double kSlowRowsPerS = 15000.0; // ~60 MB/s of 4 KiB pages; a healthy NVMe is >100k. The threshold is calibrated for NVMe. An ordinary SATA SSD tops out around 10–14K random 4 KiB rows/s — below the 15K bar — even though direct is its fastest I/O mode. So on essentially any SATA SSD the probe concludes "direct is slow" and switches to mmap.Workaround (verified). Pinning
--ple-io directin the config on the same 0.1.43 binary:883.6 tok/s cold — at 0.1.41 parity.
Suggestion. In the boot probe, measure both modes (a short direct window and a short mmap window on the same random-row pattern) and pick the faster one, rather than comparing direct's absolute rate against an NVMe-calibrated constant. That would also be correct for the DRAM-less-NVMe / Windows cases (#1629 #1425 #1984), where mmap genuinely wins, without regressing the common SATA-SSD case where direct wins. A secondary fix: make the log line honest about why it switched (measured direct vs measured mmap) so the decision is auditable.
Related.
- #1984 — auto-selected mmap wedging the engine on Windows (same auto-selection, worse symptom; pinning direct fixed it there too).
- #1629 / #1425 — the DRAM-less NVMe / Windows direct-slow reports that motivated the auto-switch.
- #1910 — a separate, milder (35–55%) 0.1.42 prefill regression on NVMe; different mechanism.
</html>@wszhoho commented on GitHub (Oct 12, 2026):
Very useful.!! thank you buddy!!!
@Niko1221 commented on GitHub (Oct 12, 2026):
Thank you, wszhoho: the O_DIRECT table of your own disk, the production-prefill numbers for both modes and the workaround made this quick to fix.
You are right: the 15,000 rows/s bar was set on NVMe drives, and a SATA SSD tops out at 10-14K rows/s with direct's 16 reads in flight, so the probe called the fastest mode slow and the switch to mmap made your prompts about 7x slower (884 vs 76-154 tok/s on the 77.8K prompt). In 0.1.43.1 (out now) the slow-direct check only warns, on every platform: it never switches by itself.
--ple-io mmapand--ple-io ramstill choose the other modes, andSTRATA_PLE_AUTO_MMAP=1brings back the 0.1.42/0.1.43 switch for a drive where direct really is slow (DRAM-less NVMe on Windows, #1629/#1425). The warning text says that mmap is not always the faster mode.We did not take the other suggestion (measuring both modes at boot and choosing): a short mapped window on a cold table does not tell how a whole prompt will behave once the page cache has to hold 28 GB, which is what stalled prompts for #1984. If you can, please confirm on 0.1.43.1 that your first long prompt is back to about 880 tok/s without the pin in your config.
@wszhoho commented on GitHub (Oct 13, 2026):
Confirmed on 0.1.43.1, without the pin in the config.
Setup: 2x RTX 2080 Ti (sm_75, driver 595.84), Xeon E5-2678v3 (AVX2, no AVX-512), 62 GB RAM, SATA SSD. Model is IQ3_XXS (Qwen3.8-Flash-Next GSQ-RCO). I built 0.1.43.1 from source at commit
0cf3d510, then removed--ple-io directfrom the config and restarted the service.Cold long prompt (56,114 tokens, first request after each startup):
prompt 56114 tokens = 0 reused + 56114 read in 31844 ms (1762.1 tok/s)prompt 56114 tokens = 0 reused + 56114 read in 31875 ms (1760.4 tok/s)The startup line is now
PLE direct read probe: 26211 rows/s (fine), and the engine stayed on direct: no switch to mmap happened, and the first long prompt is fast again.Two caveats so the number is not over-read:
Thanks for the quick fix - the warning-only behaviour is exactly what this drive needed.
@lanceyang093-blip commented on GitHub (Oct 13, 2026):
Confirmed on 0.1.43.1, with the pin removed from the config.
Same deployment: IQ3_S, 28.8 GB PLE table on a Lenovo SL750 240 GB SATA SSD; --ple-io direct removed from strata-*.json, service restarted. The startup log now carries the new warn-only text and keeps direct:
WARNING: --ple-io direct measures slow here (8543 rows/s, about 35 MB/s of random 4 KiB reads): ... --ple-io mmap was 40-100x faster on some DRAM-less NVMe drives but 7x slower on a SATA SSD (#2040), so it is not chosen for you ... (kept direct)Real workload, not synthetic: I sent a genuine 77.6K-token conversation document from scratch — fully cold, zero cache reuse — and the serve log says:
prompt 77639 tokens = 0 reused + 77639 read in 83769 ms (926.8 tok/s)So the first long prompt is back at ~927 tok/s (~14.8K rows/s, 84 s) .
Thanks for the quick fix!