Drain up to maxServerRecvPacketsPerLoop per EVB iteration#455
Open
afrind wants to merge 1 commit into
Open
Conversation
Summary: On the `shouldUseWrapperRecvmmsgForBatchRecv` path, `QuicServerWorker::onSocketReadable` previously issued a single `recvmmsg(2)` per notification. Since the adapter sets `shouldOnlyNotify=true`, folly's own read loop (which honors `setMaxReadsPerEvent`) does not run, making `transportSettings_.maxServerRecvPacketsPerLoop` effectively dead on this path — the per-iteration cap collapsed to `maxRecvBatchSize`. Wrap the recvmmsg call in an outer `while (totalRecvd < maxServerRecvPacketsPerLoop)` loop, breaking out on any `NoReadReason` (EAGAIN signals the kernel buffer drained) and returning on error. This restores the per-EVB-iteration cap to match the legacy `socket_->resumeRead(this)` path, where folly's read loop has always done the same thing. We rely on level-triggered `EV_READ` to re-fire on the next EVB iteration if we hit the cap with data still buffered — no `runInLoop` re-arm needed. Differential Revision: D106145721
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.
Summary:
On the
shouldUseWrapperRecvmmsgForBatchRecvpath,QuicServerWorker::onSocketReadablepreviously issued a singlerecvmmsg(2)per notification. Since the adapter setsshouldOnlyNotify=true, folly's own read loop (which honorssetMaxReadsPerEvent) does not run, makingtransportSettings_.maxServerRecvPacketsPerLoopeffectively dead on this path — the per-iteration cap collapsed tomaxRecvBatchSize.Wrap the recvmmsg call in an outer
while (totalRecvd < maxServerRecvPacketsPerLoop)loop, breaking out on anyNoReadReason(EAGAIN signals the kernel buffer drained) and returning on error. This restores the per-EVB-iteration cap to match the legacysocket_->resumeRead(this)path, where folly's read loop has always done the same thing.We rely on level-triggered
EV_READto re-fire on the next EVB iteration if we hit the cap with data still buffered — norunInLoopre-arm needed.Differential Revision: D106145721