Skip to content

memory: CA and client certificate bytes are duplicated per destination and per IR snapshot #10069

Description

@zhaohuabing

Description

On a gateway where many backends validate upstream connections against the same CA, the envoy-gateway control plane holds several GB of duplicated certificate bytes.

This is the control-plane counterpart to #9489, which covers the same deployment shape on the Envoy side.

Evidence

Heap profile from a gateway, 7.45 GB live:

ir.Xds.DeepCopy                              4867 MB  65%
  └─ ... → DestinationSetting.TLS
       └─ TLSCACertificate.DeepCopyInto      3552 MB  48%   151,549 live copies
       TLSCertificate.DeepCopyInto           1197 MB  16%   306,399 live copies

Why it grows

Two multipliers stack:

  • Each DestinationSetting gets its own copy of the CA bundle. The profile retains 7,708 bundles (~180 MB) for what is a handful of distinct CAs.
  • The watchable map deep-copies the whole ir.Xds once per store and once per subscriber, and a slow subscriber's append-only snapshot.Updates backlog retains every generation. That is about 20 live copies of each bundle in this profile.

The bytes are immutable in practice: the translator aliases them straight out of the Secret, and the xDS translator only reads them into protobuf InlineBytes. The copy() in the generated deep-copy functions buys nothing.

Activity

  1. self-assigned this
    on Sep 22, 2026
  2. added theissue type on Sep 22, 2026
  3. github-actions commented on Oct 22, 2026

    @github-actions
    Contributor

    This issue has been automatically marked as stale because it has not had activity in the last 30 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions