[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

Closed
opened 2026-11-04 01:44:57 +07:00 by bsakaguchi · 4 comments
Owner

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-gib copy. Forcing STRATA_UNBUFFERED_LOAD=1 decodes 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:

arm the engine's choice decode tok/s ms per verify round file tier: MB read per round / ms reading per round share of those bytes not in the page cache
A through the file cache (the rule) 11.97 204.7 595 / 284 29 %
B unbuffered (STRATA_UNBUFFERED_LOAD=1) 15.26 156.0 599 / 96 –
B unbuffered 15.61 153.7 618 / 95 –
A through the file cache 10.69 222.6 594 / 329 30 %

Mean 11.33 → 15.43 tok/s (+36 %). The rule's line, both A runs:

strata generate: the file tier reads through the file cache (84.2 GiB available, 64.0 GiB of it still to be taken by the RAM copy, 55.5 GiB of experts read from the files: the file cache can keep the ones that come back)
strata generate: the file tier reads through the file cache (re-checked with the RAM copy built (64.00 GiB): 20.2 GiB available, 0.0 GiB of it still to be taken by the RAM copy, 55.5 GiB of experts read from the files: the file cache can keep the ones that come back)

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):

file routed experts through the file cache (rule) STRATA_UNBUFFERED_LOAD=1
Q8_0 (as above) 119.5 GiB 10.69 tok/s 15.79 tok/s +47.7 %
a local file: UD-Q5_K_XL's routed experts with IQ3_S's other tensors 91.6 GiB 30.71 tok/s 35.38 tok/s +15.2 %

Forcing 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-experts without 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; env STRATA_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.

strata generate: expert cache 1589 slots, 7.73 GiB of VRAM
FileExpertSource: RAM budget 64.00 GiB: 13158 of the 111.80 GiB of experts the GPU cache does not hold, by profile rank; the rest are read from the files

Measured and drafted with Claude Code.

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-gib` copy. Forcing `STRATA_UNBUFFERED_LOAD=1` decodes 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: | arm | the engine's choice | decode tok/s | ms per verify round | file tier: MB read per round / ms reading per round | share of those bytes not in the page cache | |---|---|---|---|---|---| | A | through the file cache (the rule) | 11.97 | 204.7 | 595 / 284 | 29 % | | B | unbuffered (`STRATA_UNBUFFERED_LOAD=1`) | 15.26 | 156.0 | 599 / 96 | – | | B | unbuffered | 15.61 | 153.7 | 618 / 95 | – | | A | through the file cache | 10.69 | 222.6 | 594 / 329 | 30 % | Mean 11.33 → 15.43 tok/s (**+36 %**). The rule's line, both A runs: ``` strata generate: the file tier reads through the file cache (84.2 GiB available, 64.0 GiB of it still to be taken by the RAM copy, 55.5 GiB of experts read from the files: the file cache can keep the ones that come back) strata generate: the file tier reads through the file cache (re-checked with the RAM copy built (64.00 GiB): 20.2 GiB available, 0.0 GiB of it still to be taken by the RAM copy, 55.5 GiB of experts read from the files: the file cache can keep the ones that come back) ``` 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): | file | routed experts | through the file cache (rule) | `STRATA_UNBUFFERED_LOAD=1` | | |---|---|---|---|---| | Q8_0 (as above) | 119.5 GiB | 10.69 tok/s | 15.79 tok/s | +47.7 % | | a local file: UD-Q5_K_XL's routed experts with IQ3_S's other tensors | 91.6 GiB | 30.71 tok/s | 35.38 tok/s | +15.2 % | Forcing 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-experts` without 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`; env `STRATA_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`. ``` strata generate: expert cache 1589 slots, 7.73 GiB of VRAM FileExpertSource: RAM budget 64.00 GiB: 13158 of the 111.80 GiB of experts the GPU cache does not hold, by profile rank; the rest are read from the files ``` Measured and drafted with Claude Code.
Author
Owner

@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=1 is 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 default STRATA_IO_THREADS and 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.

<!-- gh-comment-id:6099682178 --> @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=1` is 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 default `STRATA_IO_THREADS` and 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.
Author
Owner

@KarlGrier commented on GitHub (Oct 11, 2026):

Thanks for looking into it. Here are both. All runs are on stock v0.1.42 (61b3fb5d) with STRATA_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 these strata generate runs 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:

run ioengine bandwidth
1 psync (fio's default) 10,104 MB/s (9,636 MiB/s), 1,204 IOPS
2 psync (fio's default) 8,976 MB/s (8,560 MiB/s), 1,070 IOPS
3: the same with --ioengine=libaio libaio 7,848 MB/s (7,485 MiB/s), 935 IOPS

With fio's default ioengine (psync), --iodepth=32 has 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_THREADS unset, 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_THREADS through the file cache (the rule's choice) STRATA_UNBUFFERED_LOAD=1 unbuffered vs the rule (means)
unset (default), two blocks 12.08 / 12.64 / 13.91 * 16.57 / 15.30 / 15.68 / 16.61 +24.6 %
16 12.99 / 12.34 16.37 / 15.49 +25.8 %
64 (the issue's setting) 13.28 / 12.81 16.64 / 15.76 +24.2 %

* 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:

arm ms per verify round file tier: MB read per round / ms reading per round share of those bytes not in the page cache MemAvailable, lowest swap in use, highest
through the file cache 176–207 543–669 / 202–295 23–25 % 18.5–18.9 GiB 4.3–4.4 GiB
unbuffered 149–163 598–675 / 91–102 – 15.4–17.2 GiB 0.0–2.3 GiB

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_THREADS changes. As far as I can read the code, on Linux STRATA_IO_THREADS only sizes DirectFile's pool (default 16, clamped to 1..64), which the PLE row reader uses. The file tier's unbuffered expert reads go through io_submit on 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.

<!-- gh-comment-id:6106416336 --> @KarlGrier commented on GitHub (Oct 11, 2026): Thanks for looking into it. Here are both. All runs are on stock v0.1.42 (`61b3fb5d`) with `STRATA_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 these `strata generate` runs 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`: | run | ioengine | bandwidth | |---|---|---| | 1 | psync (fio's default) | 10,104 MB/s (9,636 MiB/s), 1,204 IOPS | | 2 | psync (fio's default) | 8,976 MB/s (8,560 MiB/s), 1,070 IOPS | | 3: the same with `--ioengine=libaio` | libaio | 7,848 MB/s (7,485 MiB/s), 935 IOPS | With fio's default ioengine (psync), `--iodepth=32` has 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_THREADS` unset, 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_THREADS` | through the file cache (the rule's choice) | `STRATA_UNBUFFERED_LOAD=1` | unbuffered vs the rule (means) | |---|---|---|---| | unset (default), two blocks | 12.08 / 12.64 / 13.91 * | 16.57 / 15.30 / 15.68 / 16.61 | +24.6 % | | 16 | 12.99 / 12.34 | 16.37 / 15.49 | +25.8 % | | 64 (the issue's setting) | 13.28 / 12.81 | 16.64 / 15.76 | +24.2 % | \* 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: | arm | ms per verify round | file tier: MB read per round / ms reading per round | share of those bytes not in the page cache | MemAvailable, lowest | swap in use, highest | |---|---|---|---|---|---| | through the file cache | 176–207 | 543–669 / 202–295 | 23–25 % | 18.5–18.9 GiB | 4.3–4.4 GiB | | unbuffered | 149–163 | 598–675 / 91–102 | – | 15.4–17.2 GiB | 0.0–2.3 GiB | 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_THREADS` changes.** As far as I can read the code, on Linux `STRATA_IO_THREADS` only sizes `DirectFile`'s pool (default 16, clamped to 1..64), which the PLE row reader uses. The file tier's unbuffered expert reads go through `io_submit` on 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.
Author
Owner

@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.

<!-- gh-comment-id:6156180481 --> @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](https://github.com/Niko1221/Strata/releases/tag/v0.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.
Author
Owner

@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.

<!-- gh-comment-id:6275726516 --> @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.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#670
No description provided.