-
Notifications
You must be signed in to change notification settings - Fork 40k
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
Dynamic cpu consumption #13243
Dynamic cpu consumption #13243
Conversation
58c5a69
to
69f9c66
Compare
GCE e2e build/test passed for commit 58c5a694638f810e156c638b2801d26cea68ce87. |
GCE e2e build/test passed for commit 69f9c6619a334a1e9c4efd32dfeb9b5efcc7cb0e. |
. "github.com/onsi/ginkgo" | ||
) | ||
|
||
// ConsumingRC is a tool for testing. It helps create specified usage of CPU or memory (Warnig: memory not supported) |
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.
No extra indent.
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.
done
GCE e2e build/test passed for commit 5bac8bcff6d50fbfbb407a3959742f43a8ae43c4. |
type ConsumingRC struct { | ||
name string | ||
milicores int | ||
mutex *sync.Mutex |
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.
Here was a comment but I apparently didn't click on "Send".
Why do we need this mutex at all? If this is only for testing can we have this single-threaded or using classic go synchronization (via channels).
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.
done via channels
rc.channel <- milicores | ||
} | ||
|
||
func (rc *ConsumingRC) consumeCPU() { |
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.
can we name this func a bit different - right now there are 2 methods with the same name that do completely different thing.
GCE e2e build/test passed for commit 83abdc27eab88ce0ce325e3bbf339348325748fa. |
if rest != 0 { | ||
go rc.sendOneConsumeCPUrequest(rest, consumptionTimeInSeconds) | ||
} | ||
time.Sleep(sleepTime) |
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.
Having sleep here will probably cause problems with setting the number of millicores - the go routine is blocked here. As the rc.channel is unbuffered the sender of the update will have to wait until the sleep ends.
Labelling this PR as size/L |
GCE e2e build/test failed for commit 0eac84970ab371114b522c9f453fb581508e8a4f. |
GCE e2e build/test failed for commit de8ca71d0dab7c9655840810ed656bef8b8e7380. |
LGTM, please squash the commits. |
de8ca71
to
be61507
Compare
Done |
GCE e2e build/test failed for commit be61507456f9be615a974182de0a1bc6359e00b7. |
@k8s-bot test this please |
stop chan int | ||
} | ||
|
||
// creates new ConsumingRC |
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.
Comments are in wrong format, method name should go first:
// NewConsumingRC creates new ConsumingRC.
be61507
to
4f282ef
Compare
PTAL |
LGTM |
GCE e2e build/test failed for commit be61507456f9be615a974182de0a1bc6359e00b7. |
GCE e2e build/test passed for commit 4f282ef. |
@k8s-bot test this [testing build queue, sorry for the noise] |
GCE e2e build/test failed for commit 4f282ef. |
Jenkins e2e failure looks like a flake. Retrying.
|
GCE e2e build/test failed for commit 4f282ef. |
@k8s-bot test this please |
GCE e2e build/test passed for commit 4f282ef. |
Part of #11570
@piosz