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

outbuf_high_watermark #242

Merged
merged 6 commits into from Apr 6, 2019
Merged

outbuf_high_watermark #242

merged 6 commits into from Apr 6, 2019

Conversation

@mmerickel
Copy link
Member

@mmerickel mmerickel commented Apr 2, 2019

Fixes #67.

The outbuf_high_watermark is a setting that can be used to apply backpressure on the app_iter if it is yielding data faster than can be written to the client. When the socket falls behind, the app_iter will not resume until the socket catches up to at least the watermark (this does not mean the socket is caught up, just that it's not so far behind).

@mmerickel mmerickel force-pushed the outbuf-high-watermark branch from 0329dab to b9dbed8 Apr 2, 2019
waitress/channel.py Outdated Show resolved Hide resolved
waitress/channel.py Outdated Show resolved Hide resolved
@mmerickel mmerickel force-pushed the outbuf-high-watermark branch 2 times, most recently from ba55660 to 908573f Apr 4, 2019
@mmerickel mmerickel marked this pull request as ready for review Apr 4, 2019
@mmerickel mmerickel force-pushed the outbuf-high-watermark branch 2 times, most recently from 5722d8e to 6534d80 Apr 4, 2019
@mmerickel mmerickel force-pushed the outbuf-high-watermark branch from 6534d80 to 7268909 Apr 5, 2019
@mmerickel mmerickel force-pushed the outbuf-high-watermark branch from 7268909 to b4df005 Apr 5, 2019
waitress/channel.py Outdated Show resolved Hide resolved
bertjwregeer and others added 2 commits Apr 5, 2019
Co-Authored-By: mmerickel <github@m.merickel.org>
@mmerickel mmerickel force-pushed the outbuf-high-watermark branch from b9d0a3e to 291f8e1 Apr 5, 2019
Copy link
Member

@bertjwregeer bertjwregeer left a comment

Looks great, minor nitpicks.

waitress/channel.py Outdated Show resolved Hide resolved
waitress/channel.py Show resolved Hide resolved
# that we need to account for, otherwise it'd be better
# to do this check at the start of the request instead of
# at the end to account for consecutive service() calls
if len(self.requests) > 1:
Copy link
Member

@bertjwregeer bertjwregeer Apr 6, 2019

Would it make sense here to kick the trigger?

Copy link
Member Author

@mmerickel mmerickel Apr 6, 2019

I'm not familiar with the scenarios in which kicking the trigger is required.

Copy link
Member Author

@mmerickel mmerickel Apr 6, 2019

It's not like the current behavior is worse than it was before. I would assume the situation is that the write returned 0 bytes written because the buffer was full, and the system would know that more data is writable before hitting a select timeout or something. If you think it's a problem then it should be kicked in _flush_outbufs_below_high_watermark which affects both app_iter writes as well as here between requests. I can't imagine the circumstances are different here than there.

@bertjwregeer bertjwregeer merged commit 5583715 into master Apr 6, 2019
4 checks passed
@bertjwregeer bertjwregeer deleted the outbuf-high-watermark branch Apr 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants