merlimat opened a new pull request, #4831: URL: https://github.com/apache/bookkeeper/pull/4831
### Motivation `BlockingMpscQueue.put()` and the timed `offer()` busy-spin on `relaxedOffer()` in a bare loop, with no pause hint. When the queue fills up under back-pressure (e.g. the journal queue with `enableBusyWait=true`), every blocked producer thread pins a core spinning at full speed — competing for CPU with the very consumer thread that needs to run to drain the queue. The consumer side (`take()` / `poll()`) already idles through `WAIT_STRATEGY.idle()`, which uses the `Thread.onSpinWait()` intrinsic (via `BusyWait.onSpinWait()`). The producer side was missing the same treatment. ### Changes Apply the same wait strategy in the `put()` and `offer(timeout)` spin loops. The producers still busy-spin (by design for this queue), but with the spin-wait hint that reduces power/pipeline contention and lets the sibling hyperthread — often the consumer — make progress. Verified with `BlockingMpscQueueTest` (4/4 pass) and module checkstyle. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
