Skip to content

Let one record stream carry independent callers safely - #23

Merged
liran merged 6 commits into
mainfrom
perf/shared-record-streams
Oct 30, 2026
Merged

liran merged 6 commits into
mainfrom
perf/shared-record-streams

Conversation

@liran

@liran liran commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Results now arrive in completion order, and a record the server cannot admit gets its own NOT_STARTED result instead of ending the stream. Clients can therefore multiplex unrelated single-record calls over a few long-lived streams, without one slow or rejected record holding back or failing the others. Because closing a shared stream would hurt every caller on it, each record can carry its own timeout_micros, and a cancel_index request cancels a single record. A caller that gives up still releases its queued work on the server. Native keeps the RPC deadline and RPC cancellation.

Locally, sharing streams this way halves Weir's CPU per record (MongoDB 70 → 34 µs, Search 80 → 45 µs) and raises throughput 38–50%. Per-call HTTP/2 stream setup and small writes had dominated the server profile. Unknown-field checks also stop allocating on every validated message.

@liran liran self-assigned this Oct 30, 2026
liran added 4 commits October 30, 2026 13:49
A request carrying only store_name and cancel_index cancels an earlier
record without ending the stream, so a stream shared by several callers
can release the work of one caller that stops waiting.

Also state which requests end a stream, that results are at most one
per index, and that record timeouts start when the server reads the
request.
A server reads up to RecordWindow records without results per stream,
whatever its Store queue holds, so a client within the window never
waits to send a cancel request. Also describe cancel requests in the
ExecuteRequest fields, reject cancel_index UINT64_MAX, and test that
every other field stays unset in a cancel request.
@liran
liran merged commit 94f04dd into main Oct 30, 2026
1 check passed
@liran
liran deleted the perf/shared-record-streams branch November 4, 2026 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant