-
Notifications
You must be signed in to change notification settings - Fork 1k
Open
Labels
kind/featureCategorizes issue or PR as related to a new feature.Categorizes issue or PR as related to a new feature.
Milestone
Description
What would you like to be added:
The following code:
karmada/pkg/dependenciesdistributor/dependencies_distributor.go
Lines 173 to 197 in c9ca6ac
| 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
Metadata
Metadata
Assignees
Labels
kind/featureCategorizes issue or PR as related to a new feature.Categorizes issue or PR as related to a new feature.
Type
Projects
Status
No status