roadmap BUILT

138. Close the read gap: a 4 KiB request must stop moving 128 KiB

All four steps are built and measured, and together they make sequential read throughput 70.9x faster than milestone 38 (filesystem throughput)'s baseline. That figure was measured head to head, not by multiplying separately-measured ratios. Step 1 (2026-08-18) set the record level to 1: a 4 KiB read is 5.13x faster and a write 3.01x. Step 3 (2026-08-19) was taken before step 2 because step 1's residual said to: a request carries 64 KiB, a sequential write is 8.02x and a read 5.67x. Step 4 (2026-08-19) made the blk contract carry 16 blocks, for 1.16x to 1.55x. Step 2 (2026-08-19), last and largest, put a 64-block cache over the tree walk: 22.2x on a repeated inline read and 1.37x to 1.64x on the throughput phases. See notes/benchmarks.md, notes/fs-server.md and vendor/README.md divergence 5.

Minted 2026-08-18 by calef, on milestone 38's measurement: "Against buffered Linux we are three orders of magnitude behind on reads. We need a milestone to optimize and close the gap."

In brief, every 4 KiB file request moved 128 KiB, in both directions. A read fetched a whole RedoxFS record (32 blocks). A write read the record, changed 4 KiB and wrote a new copy, because the store is copy-on-write. This milestone closes that, and only that.

The working behind this page is in four appendices, listed in their README:

The measurement this exists to move

From milestone 38, all medians, ns per 4 KiB, at a matched virtualization tier:

nife ext4 O_DIRECT ext4 buffered raw virtio
sequential read 1,509,270 91,694 547 53,296
sequential write 2,566,304 63,688 2,068 42,104

The architecture is not the problem

That is the finding that makes this milestone tractable. The confined-server tax is about 1 us per request against a 1.5 to 3.4 ms operation: 0.07% of the measurement. The confined userspace block server is at parity with Linux's block layer (39.0 us per 4 KiB against 39 to 53 us for Linux's own raw virtio reads on the same device). Every nife figure is 39.0 us times a small integer plus a fixed walk, and nothing was fitted. The 32x is most of the remaining gap, and it belongs to the vendored store's record size, not to the microkernel.

The options, and how they were priced

The block first named three fixes. A multi-page transfer on the file contract is a wire change. A record level matched to the transfer unit changes what the store does. Replacing the store was raised by calef on 2026-08-18. Both of the first two are things two programs agree on, so the gate read DECISION until they were priced against each other.

The record-level sweep (PR #338) priced them on milestone 38's harness. It fit every read to cost = 208 us + 39.0 us x 2^level. A one-block record buys 5.6x on reads and 3.0 to 3.8x on writes, not 32x, because the record is one of two terms. The multi-page transfer is worth 16x and both together 28x. The sweep also showed that lowering the record level is a fork of the vendored crate after all.

PR #348 then counted the 208 us fixed term. It is five single-block reads per request, the same five blocks every time, at a 99.6% repeat rate: 94% of the term. That is the absence of a cache, not a property of RedoxFS. Every store that maps an id to a node would fetch the same path, so replacing RedoxFS buys a rewrite that needs the identical cache. That ruled out option 3. The full account, with the code reading and the original question, is in options.md.

Decided 2026-08-18: all of them, then measure again

calef: "it seems like we do them all. And then we measure and we figure out other optimization options. Because disk performance is pretty critical to many real workloads."

The sweep and the count had priced the options, so the decision needed no per-step gate. The ordering is set by what each step unblocks rather than by size. Each step's model was checked against a measurement before the next was taken.

what measured effect
1 option 2, the record level Done 2026-08-18. 4 KiB read 2.68 -> 13.76 MiB/s, write 1.63 -> 4.90. Shipped at level 1, which keeps lz4 and halves the space cost for 8.7% of the read speed. The created and largest readable levels are now separate constants, so nothing stored at levels 0 to 5 becomes unreadable
3 option 1, multi-page transfer on the file contract Done 2026-08-19. Modeled 75 MiB/s; measured 80.30 on a read and 42.77 on a write, 5.67x and 8.02x. The wire change is one constant: the length field was always 40 bits and the shared page bounded a transfer. This is the customer path
4 the block contract, one request per 4 KiB Done 2026-08-19. The blk channel carries 16 blocks, 1.16x to 1.55x. Steps 1 and 3 already shrank each record to 2 blocks, and step 4 cannot batch across the records one 64 KiB request spans
2 the metadata cache, the five blocks Done 2026-08-19. A 64-slot write-through cache over the tree walk, 22.2x on a repeated inline read, 1.37x to 1.64x on the throughput phases

The table's model was calibrated against the sweep (it reproduces the measured 837 us per 64 KiB as 832). It was not a prediction anybody should spend four milestones on without checking at each step.

What each step found

The details are in record-and-transfer.md and batching-and-cache.md. The findings a reader needs:

The question underneath

calef asked it the same day: does this architecture have a disk-read liability that cannot be overcome? The block layer is at parity, and the extra address-space crossing is not measurable against the device round trip. What remains is a residual of about 13 us per request, the IPC round trip plus the server's own work, which no step touched. It caps a cached 4 KiB read at roughly 300 MiB/s, against 7,141 MiB/s for ext4 buffered.

So against uncached Linux this design reaches parity, and against the page cache it does not, for a structural reason. The way past it is capability-shaped: grant the client frames it can read directly, as mmap over a page cache does. That is milestone 337 (the capability-shaped way past one IPC round trip). A data cache stayed out of scope; step 2 is a metadata cache inside one server, which raises no coherency question between processes. The full argument is in frontier.md.

Why it matters

It is on the customer path. Milestone 55 (Time Machine)'s target is judged against these numbers, and at 4 KiB they are not comfortable. §34 (RedoxFS as the primary filesystem)'s claim can now be argued from measurements rather than asserted, and this is the measurement that most weakens it.

BUGS

Follow-on

Index row

Minted by calef on 2026-08-18 from milestone 38's measurement. Every 4 KiB file request moved 128 KiB in both directions, and that single term was the whole remaining gap: the confined-server tax is 0.07% of the measurement and the block server is already at parity with Linux's block layer. calef decided to take all four steps in order, measuring at each. All four are built and measured: a smaller record (5.13x/3.01x), a 64 KiB file transfer (5.67x/8.02x on top). A 16-block blk transfer (1.16x to 1.55x more, far below the naive 16x, because the first two steps already shrank what one blk request can batch). And a 64-slot metadata cache over the tree walk the third step's own residual pointed at (22.2x on a repeated inline read, 1.37x to 1.64x on the throughput phases). Combined against milestone 38's original baseline, measured head to head: 70.9x on sequential read throughput. The 13 us IPC-round-trip floor survives every step untouched and is named as the frontier past this milestone, not a wall inside it