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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# zlay-on-zkv audit decision
These historical latency measurements used `std.process.Init.gpa`, which is
SafeAllocator in this Zig 0.17 ReleaseSafe build, rather than production zlay's
explicit `c_allocator`. Both engines' Zig wrappers used it, while RocksDB's
internal C++ allocations followed its own allocator path. Treat the timings as
harness-specific diagnostics until the allocator-parity rerun is analyzed; they
are not a production-matched latency result. Raw observations are retained.
The stopping conclusion below is superseded. The active goal is to iterate on
zkv, using these measurements to guide engine changes and validating them against
both zlay and zeldi. The measurements remain evidence about the tested pilot;
they do not establish a fundamental mismatch. The first engine experiment is
range-scoped compaction on `codex/bounded-compaction` in `zkv-compaction`.
**No-go for migrating zlay with this implementation. Keep production on
RocksDB and stop capacity sweeps with the present maintenance design.** The
pilot demonstrates a workable API integration, a smaller/faster build and
finite correctness/recovery coverage. It does not demonstrate equivalent
foreground latency. Fixing that gap now points at engine maintenance design,
not another batching-window adjustment. No core zkv change is justified without
separate evidence of a strict improvement for zeldi.
This is the audit's requested stop decision, not a claim that every possible
zkv-backed relay design is unsuitable or that production migration gates passed.
## What explains the gap
| Finding | Classification | Evidence and consequence |
|---|---|---|
| The first adapter held one mutex through scans and maintenance | Pilot integration flaw | Independent Db readers and refresh remove that shared reader/writer mutex. A fresh-read test holds the writer lock; concurrent maintenance tests verify complete fresh pages. |
| Threaded reader Io could block a zio executor | Runtime wiring flaw | The one-executor probe delayed an unrelated timer about 202 ms with Threaded Io versus 10 ms with zio. The adapter now accepts separate reader and writer Io. |
| Single novel pairs publish small durable files | Engine/local-store design and workload interaction | The earlier syscall investigation located substantial time in conditional file publication. Grouping and duplicate elision reduce this work, but alter neither durable acknowledgement semantics nor the file publication mechanism. |
| Flushing after 256 segments makes small tables | Adapter policy interacting with engine compaction | The paired experiment flushed about 3.18 MB over 106 cycles. Raising the cap reduces compaction time from about 19 s to 3.8–4.0 s per 60-second trace. |
| A whole-level merge still runs synchronously before waiting writers resume | Remaining design limitation | Larger flushes retain 2.6–2.7 s ack p99 and about 3 s maximum maintenance interruption. A background thread holding the same writer lock would preserve this stall. |
RocksDB/Pebble prior art separates expensive immutable merge work from short
state-publication synchronization and retains read state while it is in use.
zkv already offers independent readers, so a new shared-memory reader API was
not necessary to fix the first prototype. Its mutable writer still cannot be
used concurrently merely by deleting a lock. The
[reader design and primary sources](zkv-reader-design.md) cover RocksDB,
Pebble, SlateDB, SILK and cLSM, and explain refresh/collection ownership.
## Measured performance and cost
The matched 30-second million-pair test received 5,000 membership requests/sec,
10% novel, with 100 verified pages/sec. Synced RocksDB ack p99 was 5.44 ms;
zkv was 769–782 ms including scheduled flush, compaction and collection. Default
RocksDB was faster still, but does not provide the same per-call sync contract.
See the [qualification](zkv-million-pair-qualification.md).
The [paired 60-second flush-policy experiment](zkv-flush-policy.md) includes
planned-arrival queueing, producer blocking, drain, maintenance phases,
ack p99.9/max and reopen time. All four trials completed and verified 1,030,000
pairs after reopening. The larger cap reduces total maintenance to about 5 s
from 20.4 s but does not fix the acknowledgement tail. Scan p99 improves from
about 4.2 ms to 1.6–1.7 ms. The chart shows both trial orders.
The [sequential offline build measurement](zkv-build-footprint.md) found 91.6 s
for zkv versus 213.1 s for RocksDB with fresh compiler caches, and strip-enabled
relay ELFs of 4.00 MB versus 14.97 MB. Unchanged rebuilds took 0.20–0.25 s.
These are single-host samples; file and loadable sizes are not runtime RSS.
The synthetic 10% novelty is a qualification workload, not a measurement of
production novelty. The archived frame corpus supplies real operation shapes,
but its sparse timestamps and empty-index/replay passes cannot establish a
steady-state production new-pair rate. These results do not prove that every
low-novelty relay workload would fail. They do disprove equivalent latency for
the tested workload and leave no basis for a production capacity claim.
## Correctness and operational evidence
| Requirement | Current evidence |
|---|---|
| Committed visibility and reader/GC behavior | Real DirStore contract tests exclude staged data and force a collected-file miss. Refresh and retry from the original cursor returns a complete page. Concurrent flush/compact/collect tests verify acknowledged pairs and sorted pages. |
| Bounded admission and owned request lifetime | Actual owner limits outstanding work, parks callers until completion, drains accepted work on close and propagates backend errors. Heap-owned caller inputs are exercised by the runtime probe. |
| Live/backfill/resync ordering | One mutation owner serializes these paths; mixed-operation tests drain and reopen. Resync tests cover additions, destructive changes, stale tokens and malformed/wrong-DID snapshots. describeRepo's unversioned source-age limitation remains explicit. |
| Failure propagation | A real filesystem obstacle makes maintenance fail through the owner; later writes and checked reads fail rather than acknowledge success. Live indexing now returns errors to the pooled receipt/inline caller. Receipt tests prevent cursor advancement across a failed frame. |
| Shutdown and recovery | Drain-and-reopen tests cover graceful owner shutdown. All nine [concurrent-owner SIGKILL cases](zkv-owner-recovery.md) recover every recorded acknowledgement and preserve whole page requests in both index directions. This is process-crash coverage, not power-loss proof. |
| Compilation | Unit tests, fmt checks, the zio build and the ReleaseSafe x86_64-linux-gnu build run; new commits were checked with rebase execution of tests and the production-target build. |
| Production and zeldi isolation | Production checkout remains at f3346e9 with no tracked changes; core zkv remains at eca4fd1 with no tracked changes. No deployment or zeldi change was made. |
| Remote lifecycle | The qualification, policy and recovery manifests record completed suites and verified deletion of each disposable Fly app and volume. Load was generated inside those VMs, not on the laptop network or heavypad. |
## What stops here and what would reopen the decision
Full-relay scale testing is deliberately not started after the index latency
gate fails. No claim is made about validation, event-log persistence, Postgres,
networking, long-running backlog equilibrium, power-loss recovery, tombstone
burst capacity, or production cutover correctness. In particular, the isolated
index/receipt tests are not an end-to-end persisted Postgres cursor test. Those
remain prerequisites for a future **go** decision, not passing results hidden
behind the index benchmark.
The prioritized [asks for zlay and zkv](zkv-zlay-asks.md) specify the next decision
points: an explicit service/backlog budget, bounded maintenance interruption,
observable compaction debt and bytes, refresh under publication/GC, and complete
failure/cutover qualification. Every potential engine change must separately
preserve zeldi's semantics and improve its actual workload before implementation.
There is no recommendation to weaken durability, acknowledge before persistence,
disable maintenance, or turn zkv into RocksDB solely to rescue this pilot.
The isolated worktree is retained for review and reproducibility. Keeping it is
not a rollout plan. The sensible current use remains RocksDB for zlay and zkv
for workloads that benefit from its existing object-store publication model.