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

increase initialWindowSize and initialConnWindowSize by 32x #1153

Closed
wants to merge 1 commit into from

Conversation

glycerine
Copy link

Improves throughput by 5x on a 2.7msec latency link.

Partially addresses #1043.

@glycerine glycerine force-pushed the default_window_128mb branch 2 times, most recently from edd14bc to 9720953 Compare March 27, 2017 20:54
@glycerine glycerine changed the title set defaultWindowSize to 128MB. increase initialWindowSize and initialConnWindowSize by 2048x Mar 27, 2017
initialWindowSize = defaultWindowSize // for an RPC
initialConnWindowSize = defaultWindowSize * 16 // for a connection
initialWindowSize = defaultWindowSize * 2048 // for an RPC
initialConnWindowSize = defaultWindowSize * 16 * 2048 // for a connection
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A larger window size means more memory that can be buffered by gRPC without being acknowledged by the application. In addition to the extra memory usage, you've likely hurt latency for small requests sharing the same connection.

This change increases the stream and connection window sizes by 2048x for only a 5.5x throughput improvement. I think there is a less radical change that can provide most of the benefit. In my testing with CockroachDB, bumping the stream and connection window sizes to 2MB (increase of 32x) was the minimum size that provided close to max throughput on a link with 60ms RTTs. As a stop-gap until the window sizes dynamically adjust, I'd be much more comfortable with a change which left the defaults unchanged but made the stream and window sizes configurable.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a change which left the defaults unchanged but made the stream and window sizes configurable

I backed the multiplier back to 64x (4MB). I tried 32x but that was still loosing 8% compared to 64x on my 2.7msec latency link.

Options are great, but the defaults should be sane too. I would think. Because most users won't ever dig deep enough to discover the option.

you've likely hurt latency for small requests sharing the same connection

This comment I don't follow the reasoning, but I would like to. How would latency for small requests sharing the same connection be hurt by a bigger window; I don't see how their frames would be delayed since they are likely to be sent and reach the receiver sooner.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would latency for small requests sharing the same connection be hurt by a bigger window; I don't see how their frames would be delayed since they are likely to be sent and reach the receiver sooner.

Ah, ignore me. I misremembered how framing when writing data to a connection works. See http2Client.Write. Data is interleaved in 16 KB chunks regardless of the stream/connection window sizes.

@glycerine glycerine changed the title increase initialWindowSize and initialConnWindowSize by 2048x increase initialWindowSize and initialConnWindowSize by 64x Mar 27, 2017
@glycerine
Copy link
Author

a change which left the defaults unchanged but made the stream and window sizes configurable

I backed the multiplier back to 64x (4MB). I tried 32x but that was still loosing 8% compared to 64x on my 2.7msec latency link.

Options are great, but the defaults should be sane too. I would think. Because most users won't ever dig deep enough to discover the option.

you've likely hurt latency for small requests sharing the same connection

This comment I don't follow the reasoning, but I would like to. How would latency for small requests sharing the same connection be hurt by a bigger window; I don't see how their frames would be delayed since they are likely to be sent and reach the receiver sooner.

Improves throughput by 5x.

Partially addresses grpc#1043.
@glycerine glycerine changed the title increase initialWindowSize and initialConnWindowSize by 64x increase initialWindowSize and initialConnWindowSize by 32x Mar 27, 2017
@glycerine
Copy link
Author

Travis tests in transport timeout at 64x, even though they pass locally on my laptop. Trying at 32x.

glycerine added a commit to glycerine/hnatsd that referenced this pull request Mar 31, 2017
glycerine added a commit to glycerine/hnatsd that referenced this pull request Mar 31, 2017
@glycerine
Copy link
Author

glycerine commented Mar 31, 2017

Yes, this (32x) looks good. It gives a 2MB initialWindowSize, and 32MB initialConnWindowSize. These seem to be pretty sane defaults, at least for my 2.7msec end-to-end wan setup.

@MakMukhi
Copy link
Contributor

MakMukhi commented May 5, 2017

Implemented by #1210

@MakMukhi MakMukhi closed this May 5, 2017
@glycerine
Copy link
Author

This was not implemented by #1210, and so should not have been closed.

#1210 allows the defaults to be changed, but this PR actually improves the defaults. Hence they will less often need to be changed.

I just re-tested this against tip, and on a high latency 109msec link, between New Jersey and Australia, these defaults double the throughput on tip (e.g. for #1043).

@lock lock bot locked as resolved and limited conversation to collaborators Jan 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants