Skip to content

A full clientset is cached per logical cluster #4401

Description

@maxpain

The cluster-aware client cache (staging/src/github.com/kcp-dev/apimachinery/pkg/client/constructor.go) keeps a complete typed clientset per cluster path, and several controllers and admission plugins create one for every workspace. In a heap profile after creating 3,000 empty workspaces, clientCache.Cluster retained ~360 MB (~120 KB per workspace).

Suggestion: pass the cluster path per request instead of caching whole clientsets, or cache only the group clients in use.

Activity

  1. added
    kind/featureCategorizes issue or PR as related to a new feature.
    on Sep 28, 2026
  2. added this to the v0.35 milestone on Sep 28, 2026
  3. self-assigned this
    on Oct 30, 2026
  4. neolit123 commented on Oct 30, 2026

    @neolit123
    Contributor

    pass the cluster path per request instead of caching whole clientsets

    i can give this a shot, it's the nicer option but also the diff will be big...
    /assign

    cache only the group clients in use.

    this should be a smaller change but still ends up with more redundant memory per WS.

  5. neolit123 commented on Oct 30, 2026

    @neolit123
    Contributor

    pass the cluster path per request instead of caching whole clientsets

    i can give this a shot, it's the nicer option but also the diff will be big...

    the change is indeed quite big, but also there is a problem...rate limiting...sharing the same group clients for all LC can be a real problem in a multi shard setup.

  6. neolit123 commented on Oct 30, 2026

    @neolit123
    Contributor

    cache only the group clients in use.

    this should be a smaller change but still ends up with more redundant memory per WS.

  7. moved this from Backlog to Done in kcpon Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/featureCategorizes issue or PR as related to a new feature.

Projects

  • Status
    Done

Relationships

None yet

Development

No branches or pull requests

Issue actions