Skip to content
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

Accumulate resources in parallel #3172

Closed

Conversation

flo-02-mu
Copy link

As suggested in #2950 it would be nice to load base resources in parallel. With this PR an additional parameter is introduced:
kustomize build --max_parallel_accumulate n accumulates the resources in parallel go routines.
The default value equals to 1, so that the existing behaviour remains.

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 3, 2020
@k8s-ci-robot
Copy link
Contributor

Welcome @flo-02-mu!

It looks like this is your first PR to kubernetes-sigs/kustomize 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/kustomize has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot
Copy link
Contributor

Hi @flo-02-mu. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot
Copy link
Contributor

Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA.

It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.


Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 3, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: flo-02-mu
To complete the pull request process, please assign justinsb after the PR has been reviewed.
You can assign the PR to them by writing /assign @justinsb in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Nov 3, 2020
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Nov 8, 2020
@flo-02-mu flo-02-mu changed the title [WIP] Accumulate resources in parallel Accumulate resources in parallel Nov 9, 2020
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 9, 2020
@Shell32-Natsu
Copy link
Contributor

@monopole What do you think about this?

@Shell32-Natsu
Copy link
Contributor

@flo-02-mu Regardless of whether this proposal will be accepted, please add some tests to cover these new behaviors.

@flo-02-mu
Copy link
Author

@flo-02-mu Regardless of whether this proposal will be accepted, please add some tests to cover these new behaviors.

In https://github.com/kubernetes-sigs/kustomize/pull/3172/files#diff-840240dda964a03a3ad4437883ccbfbc0b84099f695a083bc7642b7c14df46c6R263 I reused the existing tests but with 16 parallel accumulators. Do you have any specific tests in mind?

@Shell32-Natsu
Copy link
Contributor

Sorry. My fault. But I still want to have more test coverage.

Also waiting for input from @monopole

@flo-02-mu
Copy link
Author

@Shell32-Natsu Some existing tests are now duplicated with parallel execution and a dedicated one is added, too.

@monopole monopole removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Nov 18, 2020
@monopole
Copy link
Contributor

Before adding this complexity, we all need to see some benchmark tests
https://dave.cheney.net/2013/06/30/how-to-write-benchmarks-in-go
I can think of other ways to improve concurrency, but w/o benchmarks we don't know
that we're solving a problem or just making things more complex.
Would you be willing to add some benchmark test first?

Replace testing.T with testing.AB interface in test harness.
@flo-02-mu
Copy link
Author

Would you be willing to add some benchmark test first?

I gave it a try and added a benchmark test: https://github.com/kubernetes-sigs/kustomize/pull/3172/files#diff-840240dda964a03a3ad4437883ccbfbc0b84099f695a083bc7642b7c14df46c6R407
My main intention was to speed up git checkouts, that's why the test uses git endpoints. Benchmark tests are currently not included in the Makefile (and probably it is not a good idea?), so here my local output for the test:

$ go test -bench=.
goos: darwin
goarch: amd64
pkg: sigs.k8s.io/kustomize/api/internal/target
BenchmarkMaxParallelAccumulate1-8              1        43338623097 ns/op
BenchmarkMaxParallelAccumulate2-8              1        31191153303 ns/op
BenchmarkMaxParallelAccumulate3-8              1        25994556832 ns/op
PASS
ok      sigs.k8s.io/kustomize/api/internal/target       101.583s

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 24, 2020
@Shell32-Natsu
Copy link
Contributor

Please rebase.

It will be good if you can create a distinct PR with a benchmark script so that we can have a base line to measure the performance benefits. It can be a simple script under hack directory.

# Conflicts:
#	api/internal/target/kusttarget_test.go
#	api/internal/target/maker_test.go
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 28, 2020
@flo-02-mu
Copy link
Author

@Shell32-Natsu I added a script, but there is not much added value since it just executes go test. An additional test run now does the baseline benchmark without the parallel option set.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 5, 2020
Signed-off-by: Florian Mueller <f.l.o.mueller@web.de>

# Conflicts:
#	api/krusty/options.go
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 6, 2020
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Mar 7, 2021
@k8s-ci-robot
Copy link
Contributor

@flo-02-mu: PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 7, 2021
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Apr 6, 2021
@fejta-bot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-contributor-experience at kubernetes/community.
/close

@k8s-ci-robot
Copy link
Contributor

@fejta-bot: Closed this PR.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-contributor-experience at kubernetes/community.
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants