-
Notifications
You must be signed in to change notification settings - Fork 164
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
Add a Reserved option #14
Conversation
Codecov Report
@@ Coverage Diff @@
## master #14 +/- ##
==========================================
- Coverage 93.58% 91.57% -2.01%
==========================================
Files 7 7
Lines 187 190 +3
==========================================
- Hits 175 174 -1
- Misses 10 14 +4
Partials 2 2
Continue to review full report at Codecov.
|
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.
Sounds reasonable to have a separate reservation for resources used outside the go-runtime.
Left a couple small comments about whether we want to respect this reservation fully or whether the boundary between reserved and non-reserved quota is permeable. The answer depends on the previous discussion about whether we want to prevent throttling or under-utilization.
From the system perspective, it seems clear that we'd prefer throttling to under-utilization, but at the moment the throttling penalty is quite large (100ms) which can be severe for latency-critical applications. Ideally we'd allow applications to make this tradeoff themselves.
if cfg.Reserved > 0 { | ||
quota -= cfg.Reserved | ||
} | ||
|
||
maxProcs := int(math.Ceil(quota)) |
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.
Do we want Floor
here after all? If we use Ceil
, we will not be respecting the full reservation for the Reserved
quota. Can Reserved
ever be fractional?
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.
Correct, we do want floor, this PR was just written orthogonally to #13.
// outside of the Go runtime; e.g. by a cgo extension, or another process | ||
// within the container. | ||
// | ||
// GOMAXPROCS will be set to the remaining (rounded down) quota, clamped to the |
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.
Is "rounded down" still the intention? This part of the comment contradicts the use of Ceil
in CPUQuotaToGOMAXPROCS
(commented there).
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.
Yes it is, this doc comment is out of line with the code reality above, good catch.
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.
Good stuff!
Joshua T Corbin seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
Okay, after offline discussion with @prashantv and @akshayjshah, here's an addendum to #13:
Reserved(q float64)
option that can be used to not allocate all of the CPU quota toGOMAXPROCS
func(func(quota float64, config CPUQuotaConfig) (int, CPUQuotaStatus)) Option
)Questions I have for reviewers at the outset:
Reserved
?