Skip to content

Perf: cpu spikes #7573

Closed
Closed

Description

@zirain

Recently I looks into the cpu usage of control plane.

Image

main-pprof.gz

There serval methods we need to looks into deep:

  1. resources.GetEndpointSlicesForBackend
  2. resources.GetService
  3. (*gatewayAPIReconciler).processBackendRefs

I think #7535 will help on (1) and (2).
But we need find a way to optimize the cost of list endpointslices by service.

cc @envoyproxy/gateway-maintainers

Activity

  1. zirain commented on Dec 9, 2025

    @zirain
    MemberAuthor
    Image

    List endpoint for service cost much where there're lots of services.

  2. github-actions commented on Jan 8, 2026

    @github-actions
    Contributor

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

  3. kkk777-7 commented on Jun 13, 2026

    @kkk777-7
    Member

    currently, also List endpoint process is heavy in processBackendRefs.
    I experimented large scale environment. (Service: 2000, EndpointSlice: 4000)

    Image
             0     0%     0%     70.73s 82.23%  sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[go.shape.struct { k8s.io/apimachinery/pkg/types.NamespacedName }]).Reconcile
         0.02s 0.023% 0.023%     69.38s 80.66%  github.com/envoyproxy/gateway/internal/provider/kubernetes.(*gatewayAPIReconciler).processBackendRefs
         0.01s 0.012% 0.035%     63.40s 73.70%  sigs.k8s.io/controller-runtime/pkg/client.(*client).List
         0.01s 0.012% 0.047%     63.33s 73.62%  sigs.k8s.io/controller-runtime/pkg/cache.(*delegatingByGVKCache).List
             0     0% 0.047%     63.29s 73.58%  sigs.k8s.io/controller-runtime/pkg/cache.(*informerCache).List
         8.27s  9.61%  9.66%     63.15s 73.41%  sigs.k8s.io/controller-runtime/pkg/cache/internal.(*CacheReader).List
             0     0%  9.66%     28.91s 33.61%  k8s.io/client-go/tools/cache.(*cache).ByIndex
         2.45s  2.85% 12.51%     28.91s 33.61%  k8s.io/client-go/tools/cache.(*threadSafeMap).ByIndex
         0.14s  0.16% 12.67%     19.13s 22.24%  k8s.io/apimachinery/pkg/labels.internalSelector.Matches
         1.14s  1.33% 14.00%     18.99s 22.08%  k8s.io/apimachinery/pkg/labels.(*Requirement).Matches
    
  4. kkk777-7 commented on Jun 13, 2026

    @kkk777-7
    Member

    I'll plan to handle this issue.

  5. self-assigned this
    on Jun 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions