agent: share server value across subscription rows of server-keyed queries - #1877
Open
Narasimha-sc wants to merge 1 commit into
Open
Narasimha-sc wants to merge 1 commit into
Narasimha-sc wants to merge 1 commit into
Conversation
Narasimha-sc
requested review from
epoberezkin and
spaced4ndy
as code owners
September 22, 2026 14:58
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.
Each
RcvQueueSubloaded from the database builds its ownSMPServervalue from the row's host, port and key hash columns. The two queries that load subscriptions for one specific server already receive that server as an argument and filter on it, so every row rebuilds a value identical to the one the caller is holding.With
host :: NonEmpty TransportHostandport :: ServiceNamebeingStrings, a domain name costs 24 bytes per character, so one duplicated server is roughly 800 bytes.activeSubsretains oneRcvQueueSubper subscribed queue for the lifetime of the session, and a client with many queues has only a handful of distinct servers.Measured on a client with ~200k subscriptions on one profile, this is ~170 MB of duplication for that profile alone, and it is rebuilt on every resubscribe.
This passes the server the caller already has instead of the one rebuilt per row. The rows are selected by that exact host, port and key hash, so the shared value equals the one each row would construct; only the sharing changes, not the data.
getRcvQueueSubsByConnIds_spans servers and is left alone.