agent: index connections with active subscriptions instead of folding all subscriptions per batch - #1884
Open
Narasimha-sc wants to merge 2 commits into
Open
agent: index connections with active subscriptions instead of folding all subscriptions per batch#1884Narasimha-sc wants to merge 2 commits into
Narasimha-sc wants to merge 2 commits into
Conversation
… all subscriptions per batch (cherry picked from commit bae057286d9675bae9a8cf1999f319b25517eda5)
Narasimha-sc
requested review from
epoberezkin and
spaced4ndy
as code owners
September 26, 2026 14:34
This branch has not been deployed
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.
Resubscribing a session rebuilds a
Set ConnIdcovering all of that session's active subscriptions, once per batch, just to answer "was this connection already subscribed" for at mostsubsBatchSizeconnections.Since
activeSubsgrows as the resubscription proceeds, resubscribing N queues in one session costs on the order of N²/2700 traversals and allocates a set of up to N elements per batch — tens of MB of short-lived allocation per session, repeated on every network change, which under the non-moving collector shows up as resident memory rather than only CPU.SessSubsnow keepsactiveConns :: TMap ConnId Intin sync withactiveSubs(counted, since a connection can hold several queues), maintained at each of the five mutation sites. Behaviour is unchanged. Plan inplans/2026-09-26-index-active-sub-conns.md.