Skip to content

Do not yield in CoroutineScheduler during transition to the idle stat… #884

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

Merged
merged 2 commits into from
Dec 12, 2018

Conversation

qwwdfsad
Copy link
Collaborator

…e, introduce system properties to tune this behaviour.

Rationale:

Thread.yield has a significant CPU cost (especially relatively to spins) and provides no significant benefits compared with exponential parking.
Thus yields burn a lot of CPU due to JVM upcall + syscall, providing benefits neither for liveness property (as CPU is mostly busy with doing these calls) nor for latencies. Initial benchmarking shows significant CPU usage reduction (200-300%) in low-to-average load benchmarks with no degradation on target affinity benchmarks.

Partially addresses #840

…e, introduce system properties to tune this behaviour.

Rationale:

Thread.yield has a significant CPU cost (especially relatively to spins) and provides no significant benefits compared with exponential parking.
Thus yields burn a lot of CPU due to JVM upcall + syscall, providing benefits neither for liveness property (as CPU is mostly busy with doing these calls) nor for latencies. Initial benchmarking shows significant CPU usage reduction (200-300%) in low-to-average load benchmarks with no degradation on target affinity benchmarks.

Partially addresses #840
@qwwdfsad qwwdfsad requested a review from elizarov December 12, 2018 10:31
@qwwdfsad
Copy link
Collaborator Author

Note that change does not completely fix #840, a transition to the idle state still can be significantly improved

Copy link
Contributor

@elizarov elizarov left a comment

Choose a reason for hiding this comment

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

LGTM

@qwwdfsad qwwdfsad merged commit e06585a into develop Dec 12, 2018
@qwwdfsad qwwdfsad deleted the yield-off branch December 12, 2018 15:14
@jcornaz
Copy link
Contributor

jcornaz commented Dec 19, 2018

Hi,

Initial benchmarking shows significant CPU usage reduction (200-300%)

Sorry to disturb, but how can a reduction be more than 100%?

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