-
Notifications
You must be signed in to change notification settings - Fork 22
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
BAAS-22402: add early exits when possible memusage #87
Conversation
@@ -25,7 +25,11 @@ tasks: | |||
export PATH=$ROOT_DIR/go/bin:$PATH | |||
|
|||
cd goja | |||
go test -v ./... | |||
go test -v ./... >> ${workdir}/goja.suite | |||
- command: gotest.parse_files |
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.
[drive-by] to get tests under tests tab in EVG
fix tests after removing early exit from objects fix more tests
854ef8f
to
c4a8d72
Compare
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.
Thank you for these changes, were you able to see what impact they end up having?
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.
nice!
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.
LGTM
Co-authored-by: Taylor Cannon <[email protected]>
mem_context.go
Outdated
// MemUsageLimitExceeded ensures a limit function is defined and checks against the limit. If limit is breached | ||
// it will return true, if the limit check is undefined it will return an error | ||
func (m *MemUsageContext) MemUsageLimitExceeded(memUsage uint64) (bool, error) { | ||
if m.MemUsageExceedsLimit == nil { |
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 need to perform this check in tight loops? I would rather not if possible. Wouldn't we be able to check this in advance?
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.
The var is an exported pointer structure so anyone could change it at any point. I think if we determined that the only ever definition of this function would be:
if memUsage > m.MemLimit {
return err
}
then we can remove these checks and clean things up a bit. Happy to do so if everyone is on board.
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.
Chatted with @Gabri3l offline and he was fine with moving forward this approach as long as the limit field was not exported. It has been refactored.
remove limitfunction error
92ff8ee
to
944cf27
Compare
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.
Looking good 💪🏼
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.
🥳
In this PR it seems like we have opportunity to exit large arrays early when we've exceeded the total mem allowed. This does not cause the interrupt in the function and will continue to rely on the poller within pass to check these values but should ease the CPU needed to calculate mem.
I think this also allows us to remove the estimate, but that path is a bit different so was not adjusted as part of this effort.