Skip to content

dependencies distributor controller performance optimization #5971

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
CharlesQQ opened this issue Dec 24, 2024 · 1 comment · May be fixed by #6194
Open

dependencies distributor controller performance optimization #5971

CharlesQQ opened this issue Dec 24, 2024 · 1 comment · May be fixed by #6194
Assignees
Labels
kind/feature Categorizes issue or PR as related to a new feature.
Milestone

Comments

@CharlesQQ
Copy link
Member

What would you like to be added:
The following code:

bindingList := &workv1alpha2.ResourceBindingList{}
err := d.Client.List(context.TODO(), bindingList, &client.ListOptions{
Namespace: resourceTemplateKey.Namespace,
LabelSelector: labels.Everything()})
if err != nil {
return err
}
for i := range bindingList.Items {
binding := &bindingList.Items[i]
if !binding.DeletionTimestamp.IsZero() {
continue
}
matched := matchesWithBindingDependencies(resourceTemplateKey, binding)
if !matched {
klog.V(4).Infof("No need to sync binding(%s/%s)", binding.Namespace, binding.Name)
continue
}
klog.V(4).Infof("ResourceBinding(%s/%s) is matched for resource(%s/%s)", binding.Namespace, binding.Name, resourceTemplateKey.Namespace, resourceTemplateKey.Name)
d.genericEvent <- event.TypedGenericEvent[*workv1alpha2.ResourceBinding]{Object: binding}
}
return nil

For example, in our production environment, there are 3372 dependent resources and 13572 resourcebinding resources; each dependent resource will be for looped 13572 times to match the resourcebinding object;
According to the log, a matchesWithBindingDependencies action takes approximately 0.000612s; calculated according to --concurrent-dependent-resource-syncs=30, it will take time to complete all executions
0.000612 * 3372 * 13572 /30 /60 =15 minutes

Why is this needed:

As part of performance optimization

@CharlesQQ CharlesQQ added the kind/feature Categorizes issue or PR as related to a new feature. label Dec 24, 2024
@RainbowMango RainbowMango added this to the v1.13 milestone Dec 24, 2024
@RainbowMango RainbowMango modified the milestones: v1.13, v1.14 Apr 28, 2025
@RainbowMango
Copy link
Member

/assign @CharlesQQ
In favor of #6194

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature.
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

2 participants