Skip to content

Conversation

@graebm
Copy link
Contributor

@graebm graebm commented Jan 31, 2020

THIS IS NOT A MERGE TO MASTER. CI WILL FAIL. WORKS ON MY MACHINE THOUGH.

HTTP/1 was writing one 16KB message per event-loop tick, regardless of whether that data was making it to the network. This wastes memory on a slow network, and made it hard for us to measure the actual write throughput.

This PR makes it so HTTP/1 waits until a message makes it to the network before attempting to write another.

Also removed hacks that had the stream complete when a 101 Switching Protocols response came in. 1xx responses should never complete the stream. Websockets needed to adapt to this change and install its handler the moment the response came in, instead of waiting for the stream to end.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

This avoids bloating memory with unsent messages.
This also helps improve the accuracy of our upload stats.
Still needs tweaking to deal with websocket upgrade edge-cases.
…it for stream to complete.

Remove hacks where 101 response completed a stream, no 1xx response should complete a stream.
@graebm graebm requested review from a team and bretambrose January 31, 2020 18:50
Remove the server-only `waiting_stream_list`.
Do a simple scan over available streams to find the next one to work on. This is O(N) when pipelining, but I hear that no one does HTTP/1 pipelining, so in that case O(N=1). We can always re-optimize if we have data that pipelining is super popular and this is a hotspot.
@bretambrose bretambrose merged commit 7a6fc36 into Stat Feb 3, 2020
bretambrose added a commit that referenced this pull request Feb 4, 2020
* Base statistics gathering and monitoring
* Control rate of HTTP/1 writes (#180)
* HTTP/1 only writes 1 message at a time.
This avoids bloating memory with unsent messages.
This also helps improve the accuracy of our upload stats.
Still needs tweaking to deal with websocket upgrade edge-cases.
* Install websocket handler the moment 101 response comes in, do not wait for stream to complete.
Remove hacks where 101 response completed a stream, no 1xx response should complete a stream.
* Simplify confusing list logic.
Remove the server-only `waiting_stream_list`.
Do a simple scan over available streams to find the next one to work on. This is O(N) when pipelining, but I hear that no one does HTTP/1 pipelining, so in that case O(N=1). We can always re-optimize if we have data that pipelining is super popular and this is a hotspot.
* Update
* Windows warning

Co-authored-by: Michael Graeb <graebm@amazon.com>
@graebm graebm deleted the Stat-http1-write-limiter branch April 3, 2020 18:21
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