mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #1682] [Bug]: Linux file tier: the automatic read choice picks the file cache where forced unbuffered reads decode 36 % faster (v0.1.41, RAM budget, PCIe 5.0 NVMe) #670
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#670
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 @KarlGrier on GitHub (Oct 9, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/1682
What happened
On this Linux PC the file tier's automatic read choice (
file_tier_unbuffered, the #1194 rule) picks reads through the file cache for the experts outside a--resident-budget-gibcopy. ForcingSTRATA_UNBUFFERED_LOAD=1decodes 36 % faster here on v0.1.41, and was 15 % and 48 % faster on two files on v0.1.40.2.Stock v0.1.41, measured 2026-10-09. Qwen3.8-Flash-Next Q8_0 (unsloth, 119.5 GiB of routed experts, more than this PC's RAM). RTX 5080 alone,
--resident-budget-gib 64.strata generate --stats, greedy, 1,024 tokens after a 136-token math prompt. Model page cache dropped before each run, arms in A B B A order:STRATA_UNBUFFERED_LOAD=1)Mean 11.33 → 15.43 tok/s (+36 %). The rule's line, both A runs:
So the cache has about 20 GiB for 55.5 GiB of experts read from the files. The rule asks it to hold 5 % of them, and 29-30 % of the bytes still came from the drive. During the buffered runs swap in use rose to 5.5-5.6 GiB (2.0 GiB before the first run); during the unbuffered runs it peaked at 3.4 GiB.
v0.1.40.2, 2026-10-07 (a local build whose changes do not touch the file tier; same rule, same method):
STRATA_UNBUFFERED_LOAD=1Forcing the file cache (
STRATA_UNBUFFERED_LOAD=0) changed little or was slower there (+0.8 %, −8.3 %).This looks like the other side of #1194. There the cache won (a 31 GB PC reading from an NTFS volume, and a Tesla P100 box under 20-32 GB cgroups). Here a PCIe 5.0 NVMe drive with 64 I/O threads reads the misses faster than a 20 GiB file cache can serve them. Could the rule take the drive's speed into account, for example by timing a few miss reads both ways at start, or by preferring direct reads when the cache can hold only part of what is read (here about 20 GiB for 55.5 GiB)?
Not tested: other drives, less RAM, the default
STRATA_IO_THREADS(this config sets 64),--mmap-expertswithout a budget, Windows, and files whose experts all fit in RAM (the rule does not act there).Strata version, GPU, OS
v0.1.41 (
fb58e0db) source build, CUDA 13.3 · RTX 5080 16 GB (alone in this placement) · Linux 7.0 (Ubuntu 24.04-based), Ryzen 9 9950X3D, 96 GB DDR5, Samsung 9100 PRO 2 TB (PCIe 5.0 NVMe)Engine log
Flags:
--expert-cache auto --prefill auto:16384 --spec 4 --spec-min-p 0.5 --max-context 131072 --kv int8 --kv-resident 32768 --pcie-frac 0 --ple-inflight 128 --vram-reserve-mib 813 --resident-budget-gib 64; envSTRATA_IO_THREADS=64 CUDA_MODULE_LOADING=LAZY STRATA_GR_V3=1 STRATA_PF_FUSED=1 STRATA_MMVQ_IL=1 STRATA_ADAPT_LAG=2 STRATA_DISJOINT_ADAPT=1 STRATA_IO_STATS=1.Measured and drafted with Claude Code.
@Niko1221 commented on GitHub (Oct 10, 2026):
This is a very useful report, thank you for the A B B A table and the old version run. We checked the code and it matches what you describe: on Linux the file tier reads through the file cache whenever the cache could hold 5 % of the experts it has to read (and at least 1.5 GiB). That rule came from #1194, where the cache clearly won on slower storage (an NTFS volume and a P100 box under a small cgroup, even at 10-17 % room). Your PCIe 5.0 drive with 64 I/O threads is the case where the drive is faster than the cache, and a bigger ratio does not capture that, so a pure ratio change would not be right for both.
What we think is the better direction is what you suggested: time the drive. Roughly, at start, read a few hundred MB of random experts directly and compare with a floor, and pick direct reads only when the drive is fast and the cache covers only part of the read set. We do not want to change the default without measuring both kinds of machine, so it will need interleaved A/B runs on a slow-storage box and a fast one.
Until then
STRATA_UNBUFFERED_LOAD=1is the right setting for your machine, as you found.Two things that would help us set the threshold: (1) the drive's raw numbers, for example
fio --name=r --filename=<the GGUF> --rw=randread --bs=8M --direct=1 --iodepth=32 --numjobs=8 --runtime=20 --time_based --group_reporting(GB/s), and (2) if you can, the same A/B with the defaultSTRATA_IO_THREADSand with 16, since the gain may come partly from the thread count. We cannot promise a change yet; we will post what the A/B shows.@KarlGrier commented on GitHub (Oct 11, 2026):
Thanks for looking into it. Here are both. All runs are on stock v0.1.42 (
61b3fb5d) withSTRATA_ROUTE_TAIL_SKIP=0, on the issue's machine, file and flags. My first try at these runs was cut short by a RAM stability problem on my machine (now fixed), so everything below is from one session after the fix. The RAM now runs at 6000 MT/s instead of the issue's 6200, and the NVIDIA driver is 615.71.09, so compare the arms with each other rather than with the issue's v0.1.41 numbers. (The tail-skip default is only set at serve start-up, so thesestrata generateruns would not have used it anyway.)1. Raw drive numbers. The Q8_0 file is split into six shards, and the routed experts are in shards 4–6, so fio got those three as its file list (
--filename=...-00004-of-00006.gguf:...-00005-of-00006.gguf:...-00006-of-00006.gguf). This is your command, plus--readonly:--ioengine=libaioWith fio's default ioengine (psync),
--iodepth=32has no effect, so runs 1 and 2 keep 8 reads of 8 MiB in flight. The libaio run keeps 8 × 32 in flight.2. The A/B with
STRATA_IO_THREADSunset, 16 and 64. The method is the issue's:strata generate --stats, greedy, 1,024 tokens after the 136-token math prompt,--resident-budget-gib 64, the model's page cache dropped before each run. Each setting got one block in B A A B order. Decode tok/s, one number per run:STRATA_IO_THREADSSTRATA_UNBUFFERED_LOAD=1* The first buffered run at the default was stopped by my own swap limit (+4 GiB) while it page-locked the RAM copy. It was the first big run after a reboot, with swap still empty. Every later buffered run stayed under the limit, so I ran a second block at the default.
Across all 15 runs:
So the gain is there at the default thread count and at 16 too. Compared with the issue (+36 % on v0.1.41 at 64 threads), the buffered arm is faster here (12.1–13.9 against 10.7–12.0 tok/s) and the gain is smaller. Between the two sessions the version, the RAM speed and the swap level all changed, so I can't say which of them made that difference.
3. What
STRATA_IO_THREADSchanges. As far as I can read the code, on LinuxSTRATA_IO_THREADSonly sizesDirectFile's pool (default 16, clamped to 1..64), which the PLE row reader uses. The file tier's unbuffered expert reads go throughio_submiton the calling threads (expert_source.cpp). For them, unset and 16 are the same setting, and 64 only changes the PLE reader. The numbers fit that. The unbuffered means are 16.04 (unset), 15.93 (16) and 16.20 tok/s (64), and two runs at one setting differ by up to 8 %, more than the settings differ from each other. So the thread count doesn't explain the gain in the issue.Measured and drafted with Claude Code.
@Niko1221 commented on GitHub (Oct 13, 2026):
Thanks for the report. To keep the tracker current we are closing issues older than three days: 0.1.44 is out with a long list of fixes, and many older reports are covered by it or by 0.1.43.1.
If this still happens on 0.1.44, please leave a comment here with your engine log (and the version line it prints), and we will reopen it. A new issue that links this one works too.
@vthomasino commented on GitHub (Oct 19, 2026):
Re-tested on 0.2.0-beta on a different machine (CUDA, RTX 5090 Laptop, 62 GB, UD-Q6_K_XL): the automatic choice still picks the file cache where unbuffered reads are about 2x faster at prefill and 3-4x at decode. Numbers and raw logs in #3237.