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

use automaxprocs to calculate the number of CPUs #649

Merged
merged 1 commit into from
Mar 14, 2022

Conversation

dprotaso
Copy link
Contributor

this is useful for container environments

Addresses: #642

@dprotaso
Copy link
Contributor Author

misspell doesn't ignore vendor

@imjasonh
Copy link
Member

Can you share how you verified that this helps? I'd like to understand it better.

Something like this?

docker run --cpus=1 -v $(pwd):/workspace --workdir=/workspace $(ko build ./ --local) resolve -f ./test/

That only matches one importpath, but I guess I could run it against Knative or Tekton or Triggermesh to see it correctly limit parallelism.

@dprotaso
Copy link
Contributor Author

Related issue: golang/go#33803

@dprotaso
Copy link
Contributor Author

Essentially GOMAXPROCS is not cgroup aware so it reports the total CPUs on the machine instead of the # of CPUs allocated to the container

@dprotaso
Copy link
Contributor Author

Also I don't claim this fixes the issue but is a big part. I think in earlier versions of ko something else was limiting parallelism (besides the limiter). Hence why we never encountered this issue

@dprotaso
Copy link
Contributor Author

the other notable thing is cgroupsv2 support isn't in the library yet

this is  useful for container environments
@dprotaso
Copy link
Contributor Author

got the typo fixed upstream - force pushing the fix

Copy link
Member

@imjasonh imjasonh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems worth doing, and unlikely to cause any new problems. After this is merged I'll try it out and see if it changes the behavior.

Thanks for this fix!

@imjasonh imjasonh merged commit 3cf55a1 into ko-build:main Mar 14, 2022
@dprotaso dprotaso deleted the use-autoprocs branch March 14, 2022 20:49
@akshayjshah
Copy link

Keep in mind that automaxprocs doesn't (yet) support cgroups v2 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants