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

Minimum GOMAXPROCS should be 1 #10

Merged
merged 3 commits into from
Nov 10, 2017
Merged

Minimum GOMAXPROCS should be 1 #10

merged 3 commits into from
Nov 10, 2017

Conversation

prashantv
Copy link
Contributor

We previously set the minimum GOMAXPROCS value to 2 as that was the
minimum allocation we expected internally. However, if the allocation is
actually smaller, we should use lower GOMAXPROCS.

This will also allow us to reduce the allocation size and use a more
appropriate GOMAXPROCS which will reduce the amount of CFS throttling.

@codecov
Copy link

codecov bot commented Nov 10, 2017

Codecov Report

Merging #10 into master will increase coverage by 0.21%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #10      +/-   ##
==========================================
+ Coverage   93.37%   93.58%   +0.21%     
==========================================
  Files           7        7              
  Lines         181      187       +6     
==========================================
+ Hits          169      175       +6     
  Misses         10       10              
  Partials        2        2
Impacted Files Coverage Δ
maxprocs/maxprocs.go 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2b02b99...4c35c48. Read the comment docs.

// Min sets the minimum GOMAXPROCS value that will be used.
func Min(n int) Option {
return optionFunc(func(cfg *config) {
cfg.minGOMAXPROCS = n
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be worth either handling n<1 or noting in the docs that passing n<1 leaves GOMAXPROCS unchanged.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea, will note that GOMAXPROCS < 1 will have no affect.

We previously set the minimum GOMAXPROCS value to 2 as that was the
minimum allocation we expected internally. However, if the allocation is
actually smaller, we should use lower GOMAXPROCS.

This will also allow us to reduce the allocation size and use a more
appropriate GOMAXPROCS which will reduce the amount of CFS throttling.
@prashantv prashantv merged commit 4225287 into master Nov 10, 2017
@prashantv prashantv deleted the min_gomaxprocs branch November 10, 2017 05:51
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