Skip to content

agent: share server value across subscription rows of server-keyed queries - #1877

Open
Narasimha-sc wants to merge 1 commit into
masterfrom
nd/share-server-in-subscriptions
Open

Narasimha-sc wants to merge 1 commit into
masterfrom
nd/share-server-in-subscriptions

Conversation

@Narasimha-sc

Copy link
Copy Markdown
Collaborator

Each RcvQueueSub loaded from the database builds its own SMPServer value 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 TransportHost and port :: ServiceName being Strings, a domain name costs 24 bytes per character, so one duplicated server is roughly 800 bytes. activeSubs retains one RcvQueueSub per 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.

This branch has not been deployed

No deployments
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