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

Why not replace Thread.yield() with Thread.onSpinWait() in SleepingWaitStrategy? #490

Open
LinShunKang opened this issue Jan 12, 2025 · 0 comments

Comments

@LinShunKang
Copy link

Is your feature request related to a problem? Please describe.
When I configured Log4j2's WaitStrategy to SleepingWaitStrategy, I observed that the Log4j2-TF-11-AsyncLoggerConfig-4 thread consumed 105% CPU during stress testing. However, after replacing Thread.yield() with Thread.onSpinWait() within the SleepingWaitStrategy implementation, the CPU usage of Log4j2-TF-11-AsyncLoggerConfig-4 dropped to approximately 55%, and no log loss was observed.

Describe the solution you'd like
Replace Thread.yield() with Thread.onSpinWait() in SleepingWaitStrategy.

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

No branches or pull requests

1 participant