Repository navigation
build: migrate to Zig 0.17 with a server, storage and vector performance pass - #100
Merged
Merged
Conversation
… and handle vrabitq_install Suppress .ok/.err replies on one-way replication commands (set, delete, vinsert, vdelete, vbulkinsert, vrabitq_install, and EXEC append_log_witness) where PeerConnection.sendCommand never reads from the stream, while preserving replies for synchronous RPCs (proof_prefix_root, vsearch_local_raw). Also wire .vrabitq_install in handleReplicationConnection to vector_ops.applyVrabitqInstall.
…tore-scoped seq cache
… and StaticStringMap
… and syncRawDelete
Moves deps/meshguard from 45f6489 to 82875f6, the merge of the Zig 0.17 upgrade into meshguard main. The meshguard source, build files and headers are identical between the two; the merge adds the Android libc-file fix, the Apple packaging toolchain pin and pinned workflow actions, none of which affect how wormdb builds meshguard.
Add bench/wire_load_bench.zig and build it with `zig build bench`. It opens N connections, one OS thread each, keeps M requests in flight per connection, and runs read, write, mixed, status and exec-transfer workloads, reporting ops/s and p50/p95/p99 latency. It reuses protocol/wire.zig for framing and core/compat.zig for sockets, so it runs on Linux and Windows. The Bun bench client runs every connection on one event loop and tops out well below the server under pipelined load, which hid server-side changes. This client does not. A transport or framing error stops the run (the stream is out of sync), counts the requests still in flight as failed, and exits with an error. Any failed operation also makes the exit status non-zero, so scripts cannot record a partial run as a clean one. --timeout-ms sets the read and write socket timeouts.
On narrow-atomics targets (wasm32 without atomics) build.zig called
b.addModule("wormdb") twice: once for src/lib.zig and again for the
reduced src/wasm_root.zig. Zig 0.16 silently replaced the first entry.
Zig 0.17 panics on a duplicate name, which broke
`zig build wasm-smoke -Dtarget=wasm32-wasi`.
Create the src/lib.zig module privately on those targets so the public
name goes only to the reduced root. Native targets are unchanged.
Replication streams no longer reply to one-way writes (SET, DEL and the vector commands), because the cluster sender never reads those replies. The cluster-open regression still waited for a SET reply and timed out. Send the SET, then EXEC proof_prefix_root over the same stream. Its reply proves the stream is live, and entry_count=1 proves the SET was applied.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Moves WormDB to Zig 0.17.0. It also adds a performance pass over the server, storage, vector and proof paths, several correctness fixes found along the way, a release workflow, and benchmark tooling.
Zig 0.17
build.zigand CI now use Zig 0.17.0. Std API shims stay centralized insrc/core/compat.zig.deps/meshguardis bumped to its Zig 0.17 release.Fixes
vrabitq_installis handled in replication, with a test.sendWireResponseFramesupports the 64-bit WebSocket length header.Stream.NO_FAST_IOis kept on the socket path.scanPrefixCutno longer reserves memory sized from a client-supplied limit (capped at 1024), with a test.insertLockedignores stale timestamps, and a rawSETof avec:key also refreshes itsbq:key.wormdbmodule is registered once on narrow-atomics targets. Zig 0.17 panics on a duplicateaddModulename, where 0.16 silently replaced it, and that brokezig build wasm-smoke.Behavior change: replication streams don't reply to one-way writes
SET,DEL,VINSERT,VDELETE,VBULKINSERT,VRABITQ_INSTALLandEXEC append_log_witnesson a replication connection no longer get anOK/ERRframe back.EXEC proof_prefix_root,EXEC vsearch_local_raw) still reply. The legacy-replication security regression now uses one of them to check that the stream is live and the write landed.Performance
StaticStringMapforEXEClookup.SET/DELfrom touching the namespace registry for unrelated keys.SET/DELkeep the index in sync.Behavior change: vsearch
efvsearchnow takes an optionalefargument (<N>oref=<N>).max(128, 2 × top_k). It used to be20 × top_k, which is 200 at top_k = 10.efto trade speed back for recall.Tooling
.github/workflows/release.ymladds a multi-platform release. Actions are pinned to commit SHAs. The workflow defaults tocontents: read, and only the publishing job can write.zig build bench: builds thebench/*.zigmicro-benchmarks. It defaults to Debug, so pass-Doptimize=ReleaseFast.bench/wire_load_bench.zig: a native WormWire load generator. It runs N connections on one thread each, with M requests in flight per connection. It reports ops/s and p50/p95/p99, and exits non-zero if any operation failed. The Bun bench client tops out below the server under pipelined load, so it can't measure server changes there.Testing
zig build teston the tree with the meshguard bump: 331/331 pass on Windows and 332/332 on Linux (Ubuntu).-Dtarget=x86_64-linux-gnu -Dcrypto-backend=std) builds.zig fmt --check bench src build.zigis clean.zig build test,zig build -Doptimize=ReleaseSmall,zig build wasm-smoke -Dtarget=wasm32-wasi, andscripts/test-security.ts(22/22).Benchmarks
All runs are A/B against the commit right before this pass (
d054889, the Zig 0.17 migration alone). Builds are ReleaseFast and the server runs on loopback. Base and head alternate order each round, and each head run is compared with the base run next to it. Numbers are median head/base throughput, with rounds won in parentheses.Linux, pipelined (native load generator, 8 connections × 16 in flight, 100k ops, 8 rounds, 0 failed ops):
Durable pipelined writes went from about 50k to about 190k ops/s. A separate 10-round run gave the same picture: 1.5–2.1× on read and transfer, and 3.9× on durable writes.
Single client, one request at a time:
statusis unchanged.