1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Fast storage iteration for zlay
`zig build test-index` runs the collection-index ownership, reader, maintenance, backfill and resync tests separately from the full relay suite. Initial observation: 37 tests, one second executing and two seconds compiling on this Mac. The default `zig build test` is unchanged and remains the full gate.
`scripts/zkv/microcosm.py` exercises the actual index-load executable, C allocator, zio reader runtime and scheduled scans. Each case runs 1000 scheduled mutations/s and 100 paginated scans/s for three seconds, with a 64-request owner bound and 16-segment flush threshold. Mixed cases seed 16384 pairs and introduce 10% novel pairs; novel cases seed 4096 and introduce 100% novel pairs. Each mode has two reverse-order trials. Every run drains the owner and checks the entire recovered pair set after reopen.
Both modes use the same candidate binary with 32 reader file handles and background SST writes. `owner-async-prepared` retains whole log collection. `owner-bounded-prepared` examines/deletes at most eight log names per maintenance call. Table collection and the initial log directory listing remain synchronous. Sync calls, checksums, durability and logical mutations are unchanged. This comparison isolates GC scheduling; it does not measure the handle-cache improvement independently.
## Native observations
The [first batch](zkv-load/microcosm-bounded/results.csv) overlapped a separate local file-backed zeldi compatibility check. It includes a bounded-GC novel-workload outlier (26.60 ms write p99 and 76.29 ms scan p99). Those timings are retained, but are unsuitable for attributing a speedup or regression.
The [isolated repeat](zkv-load/microcosm-bounded-isolated/results.csv) ran after the other agent-owned builds and compatibility workloads finished:
| Scenario and mode | Write p99, ms | Scan p99, ms | Largest collection call, ms |
|---|---:|---:|---:|
| Mixed, full log GC | 1.460–2.530 | 1.679–2.690 | 1.254–2.907 |
| Mixed, eight-name steps | 1.471–1.504 | 2.015–2.069 | 0.764–1.375 |
| Novel, full log GC | 2.218–7.111 | 4.699–8.243 | 1.392–5.013 |
| Novel, eight-name steps | 1.773–1.916 | 4.449–4.543 | 0.788–1.841 |
All sixteen runs, including the first batch, verified their complete recovered sets with zero request failures. Mixed timings overlap and do not establish a gain. Novel timings favor the incremental mode in this small repeat, but the full-GC outlier and two-trial scope limit the inference. Largest collection time is not uniformly lower: an initial listing or individual delete may still pause. These are screening results, not sustained capacity or RocksDB parity measurements.
No network or relay traffic is used. Seed data are flushed and scheduled maintenance drained before arrivals, without dropping OS caches. This is still a synthetic single-collection index workload with padded sortable DIDs. The native std.Io filesystem path differs from Linux, and the small dataset does not represent relay scale. The next confirmation should use the matched larger Fly workload and retain collection maxima, maintenance work, end state and final drain.
Core correctness tests cover fence and preceding-segment retention, failed/ambiguous delete retry, partial-sweep abandonment, wrong-owner rejection, a flush interleaved with collection, and committed reader recovery. Integration tests cover a required second sweep after another flush, idle completion alongside pending SST writes, shutdown and reopen. Actual zeldi tests/smoke pass; small actual feed-encoder/allocator checks retain the prior traffic and allocation counts. Default zeldi keeps the eight-handle specialization and synchronous collection API. Full-size zeldi performance qualification remains open.
To run the timing screen serially after building the executable:
```sh
zig build index-load -Dbackend=zio -Doptimize=ReleaseSafe --prefix /tmp/zlay-microcosm
uv run --no-project python scripts/zkv/microcosm.py /tmp/zlay-microcosm/bin/index-load /tmp/zlay-microcosm-results
```
Use a new output directory. Do not overlap timing runs with builds or other disk workloads. Source-file hashes, source differences, binary hash, commands, raw per-case CSV and stderr accompany each saved batch. Source changes after an executable was built require rebuilding it; the runner captures launch source and does not itself prove build-time provenance.