admin: stream /state as the walk produces it - #633
Merged
afrind merged 1 commit intoAug 26, 2026
Merged
Conversation
akash-a-n
approved these changes
Aug 25, 2026
akash-a-n
left a comment
Contributor
There was a problem hiding this comment.
@akash-a-n reviewed 16 files and all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on afrind).
/state serialized the whole document before sending a byte, so a relay with a large namespace tree or cache held the entire response in memory, and the client waited for the last service to be walked before seeing the first. The walk now writes into an AsyncPipe that the admin EVB drains into a chunked response. Producer and consumer run concurrently: the producer migrates across relay executors, while the consumer stays on the admin EVB where sendBody is thread-safe and parks on the EgressGate whenever the transaction cannot write. A slow client therefore leaves the unsent bytes in the pipe rather than relocating them into proxygen's egress queue, where nothing would account for them. The walk itself never stalls: it is synchronous and never yields its executor, so the consumer cannot push back on it. StreamBudget bounds what that can cost instead, capping what may pile up in the pipe and failing the response past it. Headers wait for the first chunk, so a walk that throws before producing output is still reported as a 500 rather than an aborted 200. Both visitors gain alive(), checked at section boundaries, so a client that hangs up stops the walk rather than formatting the rest for nobody. StateStreamTest covers the visitors and chunk boundaries, StateResponseTest the consumer, budget and gate, and test_admin_state.sh the framing end to end. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
afrind
force-pushed
the
admin/stream-state-as-walk-produces-it
branch
from
August 26, 2026 16:18
4a3ac9e to
bf0c68e
Compare
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.
/state serialized the whole document before sending a byte, so a relay with a large namespace tree or cache held the entire response in memory, and the client waited for the last service to be walked before seeing the first.
The walk now writes into an AsyncPipe that the admin EVB drains into a chunked response. Producer and consumer run concurrently: the producer migrates across relay executors, while the consumer stays on the admin EVB where sendBody is thread-safe and parks on the EgressGate whenever the transaction cannot write. A slow client therefore leaves the unsent bytes in the pipe rather than relocating them into proxygen's egress queue, where nothing would account for them. The walk itself never stalls: it is synchronous and never yields its executor, so the consumer cannot push back on it. StreamBudget bounds what that can cost instead, capping what may pile up in the pipe and failing the response past it. Headers wait for the first chunk, so a walk that throws before producing output is still reported as a 500 rather than an aborted 200.
Both visitors gain alive(), checked at section boundaries, so a client that hangs up stops the walk rather than formatting the rest for nobody.
StateStreamTest covers the visitors and chunk boundaries, StateResponseTest the consumer, budget and gate, and test_admin_state.sh the framing end to end.
This change is