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

feat(env): auto set GOMAXPROCS #4561

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dongjiang1989
Copy link
Contributor

Description

Auto set GOMAXPROCS.
add dependency on go.uber.org/automaxprocs

Checklist

  • Unit tests updated
  • End user documentation updated

Signed-off-by: dongjiang1989 <dongjiang1989@126.com>
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jun 19, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign mloiseleur for approval. For more information see the Kubernetes Code Review Process.

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 requested a review from szuecs June 19, 2024 02:49
@k8s-ci-robot
Copy link
Contributor

Hi @dongjiang1989. 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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jun 19, 2024
@dongjiang1989
Copy link
Contributor Author

/ok-to-test

@k8s-ci-robot
Copy link
Contributor

@dongjiang1989: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/ok-to-test

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-sigs/prow repository.

@dongjiang1989
Copy link
Contributor Author

@mloiseleur PTAL

@mloiseleur
Copy link
Contributor

I have mixed feeling with this PR.
This kind of optimization should be done by either the language or the admin.

@dongjiang1989
Copy link
Contributor Author

dongjiang1989 commented Jun 19, 2024

I have mixed feeling with this PR. This kind of optimization should be done by either the language or the admin.

Thanks for your review. @mloiseleur
The containers to pick up the correct GOMAXPROCS based on the CPU resource limits.
ref: https://pkg.go.dev/go.uber.org/automaxprocs?utm_source=godoc

@szuecs
Copy link
Contributor

szuecs commented Jun 19, 2024

@dongjiang1989 what do you try to fix?
I don't see why we should add a dependency for a thing that is not important for control loops like external-dns.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 19, 2024
@dongjiang1989
Copy link
Contributor Author

@dongjiang1989 what do you try to fix? I don't see why we should add a dependency for a thing that is not important for control loops like external-dns.

As you all know node/pod come with different sizes. For example, we use quite huge nodes with up to 104 CPUs, we aren't able to set environment variables to set GOMAXPROCS to the value of cpu.limit. automaxprocs package does this automatically without any additional pain. If there are not limits specified, default value (number of cores) will be left in place.

@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 20, 2024
@mloiseleur
Copy link
Contributor

mloiseleur commented Jun 20, 2024

we aren't able to set environment variables to set GOMAXPROCS to the value of cpu.limit

IMHO, this is the problem you should solve on your platform, not with external-dns source code.. You may also be interested to tune GOMEMLIMIT.

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. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants