Repository navigation
Port: Restore configurable ioRatio-based task scheduling in SingleThreadIoEventLoop (#17481) - #17603
Merged
Merged
Conversation
…ventLoop (#17481) Motivation: The unification done in #13991/#14557 replaced the per-transport ioRatio scheduling with a fixed maxTaskProcessingQuantumMs cap on task processing before returning to IO. Under sustained load the task queue is never empty, so the event loop can spend up to the full quantum on tasks every iteration regardless of how little time was just spent on IO, delaying IO servicing (and so response completion) for a minority of requests. This was observed as an elevated mean (but not median) round-trip latency after upgrading from 4.1 to 4.2, which went away on rollback. Modifications: - Add back a volatile ioRatio field and functional getIoRatio()/ setIoRatio(int) on SingleThreadIoEventLoop, configurable via the new io.netty.eventLoop.ioRatio system property (default 100, which preserves the current fixed-quantum behaviour unchanged). - When ioRatio < 100, size each iteration's task budget as ioTime * (100 - ioRatio) / ioRatio, capped by maxTaskProcessingQuantumNs, matching the pre-4.2 NioEventLoop formula while keeping the existing quantum as a safety upper bound. - Add setter / getter to MultiThreadIoEventLoopGroup so it is supported globally Result: Users hitting the 4.2 scheduling regression can restore proportional IO/task balancing with a single setIoRatio(50) call (or the new system property), with no change in behaviour for anyone who doesn't opt in.
🚨 TestLens detected 1 failed test 🚨Here is what you can do:
Test SummaryBuild PR / linux-x86_64-java25 build > Netty/Common
🏷️ Commit: 8367fd3 Test FailuresSingleThreadEventExecutorTest > testSuspendDoesNotRaceWithCancelledScheduledTask() (Netty/Common in Build PR / linux-x86_64-java25 build)
Rerun ControlsSelect tests to mute in this pull request:
Reuse successful test results:
Click the checkbox to trigger a rerun:
Learn more about TestLens at testlens.app/docs. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation:
The unification done in #13991/#14557 replaced the per-transport ioRatio
scheduling with a fixed maxTaskProcessingQuantumMs cap on task
processing
before returning to IO. Under sustained load the task queue is never
empty, so the event loop can spend up to the full quantum on tasks every
iteration regardless of how little time was just spent on IO, delaying
IO servicing (and so response completion) for a minority of requests.
This was observed as an elevated mean (but not median) round-trip
latency after upgrading from 4.1 to 4.2, which went away on rollback.
Modifications:
setIoRatio(int) on SingleThreadIoEventLoop, configurable via the new
io.netty.eventLoop.ioRatio system property (default 100, which
preserves the current fixed-quantum behaviour unchanged).
ioTime * (100 - ioRatio) / ioRatio, capped by
maxTaskProcessingQuantumNs, matching the pre-4.2 NioEventLoop formula
while keeping the existing quantum as a safety upper bound.
globally
Result:
Users hitting the 4.2 scheduling regression can restore proportional
IO/task balancing with a single setIoRatio(50) call (or the new system
property), with no change in behaviour for anyone who doesn't opt in.