Epoll: Don't wake event loop when splicing#9354
Merged
normanmaurer merged 1 commit intonetty:4.1from Jul 12, 2019
Merged
Conversation
Motivation I noticed this while looking at something else. AbstractEpollStreamChannel::spliceQueue is an MPSC queue but only accessed from the event loop. So it could be just changed to e.g. an ArrayDeque. This PR instead reverts to using is as an MPSC queue to avoid dispatching a task to the EL, as appears was the original intention. Modification Change AbstractEpollStreamChannel::spliceQueue to be volatile and lazily initialized via double-checked locking. Add tasks directly to the queue from the public methods rather than possibly waking the EL just to enqueue. An alternative is just to change PlatformDependent.newMpscQueue() to new ArrayDeque() and be done with it :) Result Less disruptive channel/fd-splicing.
|
Can one of the admins verify this patch? |
Member
|
@netty-bot test this please |
Member
|
@njhill thanks this looks great! |
normanmaurer
pushed a commit
that referenced
this pull request
Jul 12, 2019
Motivation I noticed this while looking at something else. AbstractEpollStreamChannel::spliceQueue is an MPSC queue but only accessed from the event loop. So it could be just changed to e.g. an ArrayDeque. This PR instead reverts to using is as an MPSC queue to avoid dispatching a task to the EL, as appears was the original intention. Modification Change AbstractEpollStreamChannel::spliceQueue to be volatile and lazily initialized via double-checked locking. Add tasks directly to the queue from the public methods rather than possibly waking the EL just to enqueue. An alternative is just to change PlatformDependent.newMpscQueue() to new ArrayDeque() and be done with it :) Result Less disruptive channel/fd-splicing.
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
I noticed this while looking at something else.
AbstractEpollStreamChannel::spliceQueueis an MPSC queue but only accessed from the event loop. So it could be just changed to e.g. anArrayDeque. This PR instead reverts to using is as an MPSC queue to avoid dispatching a task to the EL, as appears was the original intention.Modification
Change
AbstractEpollStreamChannel::spliceQueueto be volatile and lazily initialized via double-checked locking. Add tasks directly to the queue from the public methods rather than possibly waking the EL just to enqueue.An alternative would be to change
PlatformDependent.newMpscQueue()tonew ArrayDeque()and be done with it :)Result
Less disruptive channel/fd-splicing.