Skip to content

perf(endpoints): only allocate endpoint metadata when populated - #2

Closed
christianscott wants to merge 1 commit into
mainfrom
ep-mem/metadata
Closed

perf(endpoints): only allocate endpoint metadata when populated#2
christianscott wants to merge 1 commit into
mainfrom
ep-mem/metadata

Conversation

@christianscott

Copy link
Copy Markdown

Description

CreateLBEndpoint allocated a Metadata proto and FilterMetadata map for every endpoint, only to nil them out when Istio auto-mTLS was off or the pod was not Istio-managed. Since this runs once per endpoint per backend and endpoint IR dominates control-plane heap at scale (~60-67% of in-use heap in production profiles), return nil directly in the no-op cases.

No wire-format change: metadata was already nil after the empty-map check in those cases.

Part 1 of a stack (split out of a larger endpoint-memory PR):

Change Type

/kind cleanup

Changelog

Reduced control-plane memory by avoiding per-endpoint Metadata proto allocation when Istio auto-mTLS metadata is not applicable.

Additional Notes

Covered by a new unit test verifying metadata is nil unless auto-mTLS is enabled and the pod carries the Istio TLS mode label.

CreateLBEndpoint allocated a Metadata proto and FilterMetadata map for
every endpoint, only to nil them out when Istio auto-mTLS was off or the
pod was not Istio-managed. Since this runs once per endpoint per backend
and endpoint IR dominates control-plane heap at scale, return nil
directly in the no-op cases.

No wire-format change: the metadata was already nil after the empty
check in those cases.

Signed-off-by: Christian Scott <christian@modal.com>
@christianscott

Copy link
Copy Markdown
Author

Reopened against upstream: kgateway-dev/kgateway

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