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

HashedWheelTimer cost too many CPU time on windows #9710

Closed
michaelmao999 opened this issue Oct 25, 2019 · 2 comments · Fixed by #9714
Closed

HashedWheelTimer cost too many CPU time on windows #9710

michaelmao999 opened this issue Oct 25, 2019 · 2 comments · Fixed by #9714
Milestone

Comments

@michaelmao999
Copy link

When tickDuration is set to 1, sleep time will be ignore in waitForNextTick on HashedWheelTimer, it will waste CPU time to perform waitForNextTick again and agin.

JVM version (e.g. java -version)

OS version (e.g. uname -a) windows 10

Here, I just post workaround for your reference.
if (Platform.isWindows()) {
sleepTimeMs = sleepTimeMs / 10 * 10;
if (sleepTimeMs == 0) {
sleepTimeMs = 1;
}
}

@normanmaurer
Copy link
Member

@michaelmao999 can you provide a PR to fix this ?

normanmaurer added a commit that referenced this issue Oct 25, 2019
…d a tickDuration of 1

Motivation:

We do not correct guard against the gact that when applying our workaround for windows we may end up with a 0 sleep period. In this case we should just sleep for 1 ms.

Modifications:

Guard agains the case when our calculation will produce 0 as sleep time on windows

Result:

Fixes #9710.
@normanmaurer normanmaurer added this to the 4.1.44.Final milestone Oct 25, 2019
@normanmaurer
Copy link
Member

@michaelmao999 can you check #9714... This should fix it.

normanmaurer added a commit that referenced this issue Oct 25, 2019
…d a tickDuration of 1

Motivation:

We do not correct guard against the gact that when applying our workaround for windows we may end up with a 0 sleep period. In this case we should just sleep for 1 ms.

Modifications:

Guard agains the case when our calculation will produce 0 as sleep time on windows

Result:

Fixes #9710.
normanmaurer added a commit that referenced this issue Oct 25, 2019
…d a tickDuration of 1 (#9714)

Motivation:

We do not correct guard against the gact that when applying our workaround for windows we may end up with a 0 sleep period. In this case we should just sleep for 1 ms.

Modifications:

Guard agains the case when our calculation will produce 0 as sleep time on windows

Result:

Fixes #9710.
normanmaurer added a commit that referenced this issue Oct 25, 2019
…d a tickDuration of 1 (#9714)

Motivation:

We do not correct guard against the gact that when applying our workaround for windows we may end up with a 0 sleep period. In this case we should just sleep for 1 ms.

Modifications:

Guard agains the case when our calculation will produce 0 as sleep time on windows

Result:

Fixes #9710.
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 a pull request may close this issue.

2 participants