Repository navigation
feat(ipc): async server handlers + server-side per-fork ordering - #24210
Closed
charlielye wants to merge 0 commit into
Closed
charlielye wants to merge 0 commit into
charlielye wants to merge 0 commit into
Conversation
charlielye
force-pushed
the
cl/ipc-wsdb-concurrent-server
branch
from
June 20, 2026 21:02
f407002 to
317a72f
Compare
Contributor
Author
|
Superseded by the restack. The reactor (#24198) and ordering work have been combined into a single machinery commit on #24198, which now targets |
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.
What
Moves request ordering from the client into the database. Previously each TS client serialized its own reads/writes per fork (
WorldStateOpsQueue); a second async client could corrupt state by skipping that contract. This makes the wsdb server own per-fork ordering, built on an async server-handler codegen pattern adopted symmetrically across all four languages.Stacked on #24198 (concurrent reactor).
Codegen — async server handlers (C++, Rust, Zig; TS already async)
The generated server dispatch hands each handler the decoded command plus a
respondcallback, instead of returning a value. A handler may run inline or defer to a thread pool and callrespondwhen ready. The wire protocol is unchanged, so the cross-language interop matrix and golden fixtures are untouched.void handle_x(Ctx&, Cmd&&, Responder<Resp>);make_*_handlerreturnsvoid(span, RawRespond);serve()drives it viarun_reactor.Handlertrait methods takeResponder<Resp>;handle_requestcollects synchronously so the runtime/echo glue is unchanged.Responder(ok/err);handleRequestunchanged.Promise-returning — no change.Each language's echo server updated to the new shape (~6 handlers each).
wsdb — server-side per-fork ordering
Each of the 40 handlers declares its own ordering by calling
schedule_read(reads run concurrently; committed reads bypass ordering) orschedule_write(exclusive on its fork), extracting its fork from the typed command.WsdbSchedulerimplements the read-batch / write-barrier model per fork, with an inline fast path when idle and a dispatch pool distinct from WorldState's intra-op pool. The hand-rolled request classifier is gone — read/write + fork come from the typed handler.Testing
aztec-wsdbbuilds; ipc-runtime reactor/echo gtests green.native_world_state.test.ts(50 tests incl. Concurrent requests, which asserts read-your-writes ordering) green against the async server.parallel_read.benchSHM: ~3.7x read scaling (8.1k → 30.4k reads/s, c=1 → c=16).Client queue removed
With the server owning per-fork ordering, the TS client's per-fork
WorldStateOpsQueueis now redundant and has been deleted:IpcWorldStatesends every op immediately and the server serializes writes / parallelizes reads. With the client queue gone,native_world_state.test.ts's Concurrent requests test now genuinely exercises server-side read/write ordering (and passes), and the TS-consumer no longer pays the queue's per-op overhead.🤖 Generated with Claude Code
https://claude.ai/code/session_01XfznXp9wzGWLU6LC8EHtpi