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

Set write buffer limit to zero on client and server #2869

Closed
wants to merge 1 commit into from

Conversation

asvetlov
Copy link
Member

@fafhrd91
Copy link
Member

You should run some benchmarks

@codecov-io
Copy link

codecov-io commented Mar 22, 2018

Codecov Report

Merging #2869 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2869      +/-   ##
==========================================
+ Coverage   97.97%   97.97%   +<.01%     
==========================================
  Files          39       39              
  Lines        7464     7466       +2     
  Branches     1310     1310              
==========================================
+ Hits         7313     7315       +2     
  Misses         48       48              
  Partials      103      103
Impacted Files Coverage Δ
aiohttp/client_proto.py 94.44% <100%> (+0.04%) ⬆️
aiohttp/web_protocol.py 91.83% <100%> (+0.02%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 39831ca...98e96f7. Read the comment docs.

@asvetlov
Copy link
Member Author

Sure will do

@pfreixes
Copy link
Contributor

pfreixes commented Apr 4, 2018

@asvetlov just some general considerations, I would like to put myself int he same page as you because sure I'm missing something.

The StreamWriter.drain method uses the Asyncio method _drain_helper which checks if the stream is paused, in case that is paused will wait till the stream is resumed. Having a new limit of 0 for the high water mark - that is what this MR is doing - shouldn't we expect that the stream is never paused? Making useless the call to the drain?

At the same time, the call to the StreamWriter.drain made by the StreamWriter.write it's at least a bit confusing IMHO - sure I'm missing something again. It calls explicitly the drain if the size of the buffer sent till that specific moment is greater than 0x10000, my questions here are:

  1. Why 16 bytes?
  2. Why call the drain when we have sent 16 bytes?
  3. Why we are not just calling the Asyncio._drain_helper setting the high watermark to the desired value?

@asvetlov
Copy link
Member Author

asvetlov commented Apr 5, 2018

Good questions. The initial idea was not using aiohttp/asyncio buffering but only OS kernel write buffer for a socket.
On benchmarking I see ~7% slowdown, need to investigate more.

@asvetlov asvetlov closed this Nov 30, 2018
@asvetlov asvetlov deleted the disable-write-buffer branch September 7, 2019 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants