-
Notifications
You must be signed in to change notification settings - Fork 19
feat: (re-)enable parallel processing in the work applier #234
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
feat: (re-)enable parallel processing in the work applier #234
Conversation
Signed-off-by: michaelawyu <chenyu1@microsoft.com>
Signed-off-by: michaelawyu <chenyu1@microsoft.com>
|
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Signed-off-by: michaelawyu <chenyu1@microsoft.com>
--------- Signed-off-by: Zhiying Lin <zhiyingl456@gmail.com> Signed-off-by: michaelawyu <chenyu1@microsoft.com>
Signed-off-by: michaelawyu <chenyu1@microsoft.com>
Signed-off-by: Zhiying Lin <zhiyingl456@gmail.com> Signed-off-by: michaelawyu <chenyu1@microsoft.com>
…sync (kubefleet-dev#231) * Minor fixes Signed-off-by: michaelawyu <chenyu1@microsoft.com> * Minor fixes Signed-off-by: michaelawyu <chenyu1@microsoft.com> * Revert the timeout change in kubefleet-dev#99 Signed-off-by: michaelawyu <chenyu1@microsoft.com> * Use eventually block Signed-off-by: michaelawyu <chenyu1@microsoft.com> * Experimental Signed-off-by: michaelawyu <chenyu1@microsoft.com> * Revert experimental changes Signed-off-by: michaelawyu <chenyu1@microsoft.com> --------- Signed-off-by: michaelawyu <chenyu1@microsoft.com>
Signed-off-by: michaelawyu <chenyu1@microsoft.com>
Signed-off-by: Wantong Jiang <wantjian@microsoft.com> Signed-off-by: michaelawyu <chenyu1@microsoft.com>
|
Note: to control PR size and avoid conflicts with other on-going changes in the work applier, only unit tests are added to this RP. Additional integration tests and E2E tests will be added later. |
| // Note (chenyu1): the waves below are based on the Helm resource installation | ||
| // order (see also the Helm source code). Similar objects are grouped together | ||
| // to achieve best performance. | ||
| defaultWaveNumberByResourceType = map[string]waveNumber{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we also defined the apply order in https://github.com/kubefleet-dev/kubefleet/blob/main/pkg/controllers/placement/resource_selector.go#L47
the orders are not consistent. for example, the ingressclasses.
Can we try to merge them? so that it's always consistent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Zhiying! Yeah, I was a bit concerned about this too when composing the PR. The reason why we did it separately in this PR was that, if we do not group the resource types but process them invididually, there's a high chance that in each batch there's only 1-2 objects, which kind of defeats the purpose of doing the parallelization.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR also kinds of renders the apply order sorting we did on the hub cluster side redundant (we still need to sort the resources for stability reasons, but they do not have to be done in a specific order -> similar to how the work generator sorts enveloped objects).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At this moment I am leaning on grouping the resource types for larger batch sizes, but I do not have a particularly strong opinion on the subject matter -> happy to discuss about the topic further.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As for the apply order part on the hub cluster, will submit another PR to keep things clean after this one is merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(A side note: another reason I am a bit reluctant to change the apply order on the hub cluster side was that it might trigger a rollout on existing workloads, as it will register as a new resource snapshot IIRC? -> we might need to be a bit careful on this 😞)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these two orders serve different purposes. The hub one was the apply order before this PR but now it's more to keep the uniqueness for a list of resources (or we don't think there is any change) while the member side is more on the real apply order. Probably should change the name of the hub side list to reflect the fact that it's no longer the order that member will apply.
zhiying-lin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
discussed offline, will update the applyOrder comment in a separate PR.
Will do 👌 |
| // Note (chenyu1): the waves below are based on the Helm resource installation | ||
| // order (see also the Helm source code). Similar objects are grouped together | ||
| // to achieve best performance. | ||
| defaultWaveNumberByResourceType = map[string]waveNumber{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these two orders serve different purposes. The hub one was the apply order before this PR but now it's more to keep the uniqueness for a list of resources (or we don't think there is any change) while the member side is more on the real apply order. Probably should change the name of the hub side list to reflect the fact that it's no longer the order that member will apply.
| // Pre-allocate the map; 7 is the total count of default wave numbers, though | ||
| // not all wave numbers might be used. | ||
| waveByNum := make(map[waveNumber]*bundleProcessingWave, 7) | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ni: shouldn't this be a bundleProcessingWave array instead? One can precreate all the bundleProcessingWave so there is no need for the getOrAddWave function anymore (but we can keep to save memory). I am not sure why we need to sort the map to produce an array at the end.
Description of your changes
This PR (re-)enables parallel processing in the work applier.
I have:
make reviewableto ensure this PR is ready for review.How has this code been tested
See notes.
Special notes for your reviewer