Repository navigation
perf(rpc): reuse admitted connections and add a persistent workbench-session mode (2/7) - #545
Merged
Merged
Conversation
Clients keep a bounded per-endpoint pool of admitted connections shared by transport clones, skipping the TCP connect and protocol handshake per RPC. A pooled connection that fails before any response byte was closed by the server; the request is resent once on a fresh connection and the endpoint's other idle connections are dropped. Quiet probing and a 10 s age bound keep reuse well inside the server's 30 s idle timeout. The accept loop polls the listener instead of sleeping up to 10 ms. Signed-off-by: wchwawa <wch19961116@gmail.com>
nokv workbench-session executes newline-delimited Workbench tool calls over one admitted client, answering each with one flushed JSON line that carries the request id. Agent harnesses that call many tools no longer pay a process start, route lookup, provider admission and connection setup per call. Each call keeps its own tool boundary; the session is not a transaction and ids only correlate responses. Signed-off-by: wchwawa <wch19961116@gmail.com>
17 of 24 tasks
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.
Related Issue
Relates to #543
Part 2 of 7 of the stack for #543. Stacked on #544 (
perf/stack-1-write-pipeline); review only the commits below.Summary
main's single-write frames and TCP_NODELAY (fix(transport): send each RPC frame in one write and set TCP_NODELAY #533): the request frame comes fromlength_prefixed_frame, andexchange_framenow reports whether a failure came before or after the first response byte.nokv workbench-sessionexecutes newline-delimited Workbench tool calls over one admitted client and answers each with one JSON line carrying the request id. Each call keeps its own tool boundary; the session is not a transaction.Commits:
1e1bcdcb9cperf(rpc): reuse admitted connections and wake accept on demand932dc9321efeat(cli): add a persistent workbench-session modeScope
object-store, agent interface, or docs change is mixed in.
maintenance task this PR resolves.
Change Size And Review
current-head pusher approved the exact current head commit. Not applicable: under 5,000 lines.
not being used to justify mixed package or lifecycle boundaries.
Code Contract (Code Changes Only)
docs/development/code_contract.md.New generic helper modules are domain-neutral and tested.
errors.rsand carry stable error kinds when crossing package boundaries (the only new error type,ExchangeError, is private to the transport module and becomes aTransportErrorbefore leaving it).lifetime, snapshot/commit/event retention, GC epochs, and fail-closed
recovery boundaries. Not applicable: no metadata change.
RootId -> LogicalShardIdaffinity, one active writer per shard, owner-epoch fencing, and explicit
shard-local atomicity; no split root or cross-shard transaction is implied. Not applicable: no placement or routing change.
nokv-agent, routing and workflows innokv-client, and the concretebackend plus native full CLI wiring in
nokv. (the session mode lives in thenokvCLI and reuses the existing Workbench facade and schemas)direct Python SDK second, and the Rust SDK third, and does not present the
deprecated
nokv mcpsidecar as a supported NoKV surface. (docs/workbench-contract.mddocuments the session mode as current behaviour)Claims and Evidence
planned capabilities. (
docs/workbench-contract.mddocuments the session mode as current behaviour)authentication or authorization (no security claims).
run count, and raw-evidence location.
A
workbench_statinside an admittedworkbench-sessiontakes about 0.1 ms, against a full process start, route lookup, provider admission, and connection setup per CLI call (fixed_cost.pyin the evidence gist reproduces this; the raw output and repetition count of those single-shot timings were not retained). Connection reuse has no separate end-to-end number; the stack-level harness results are in #543.Topology for every number: one laptop (Apple M3 Pro, 36 GiB, macOS, APFS, F_FULLFSYNC), one NoKV owner, RustFS in Docker, etcd or a local control directory, fresh storage per trial. The method, run counts, and harness are in the evidence gist.
Validation
rust.ymlpins:cargo clippy --workspace --all-targets -- -D warningsand the feature clippy runs fromrust.yml(nokv-meta/nokv-benchwithmetadata-read-stats,nokv-meta-holtwithread-stats,nokv-serverandnokv-benchwithrestore-crash-test-support) are clean.49949ddea8(perf/stack-7-time-ordered-ids): 1,209 passed, 0 failed, 13 ignored. They were not rerun on this head.rust.yml, DCO, and change governance run only for PRs intomain, so this PR gets CI once the PR below merges and GitHub retargets it.Contributor Sign-off
Signed-off-bytrailer.