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

Size http2 buffers to allow concurrent streams #67902

Merged
merged 1 commit into from
Aug 28, 2018

Conversation

liggitt
Copy link
Member

@liggitt liggitt commented Aug 27, 2018

http/2 requests from a given client multiplex over a single connection via streams, chopped up into frames.

The amount of data the client is allowed to send for a given stream and for the overall connection before acknowledgement is determined by the server's MaxUploadBufferPerStream and MaxUploadBufferPerConnection settings respectively, both defaulting to 1MB.

The number of concurrent streams a client is allowed to send over a single connection is determined by the server's MaxConcurrentStreams setting, defaulting to 250.

We observed a starvation issue with the kube aggregator's proxy client if handling of a POST through the aggregator to a backend server exceeded the 1MB buffer size AND the backend server required a second POST request through the aggregator to be handled before it could drain the first request's body.

Logically, if concurrent streams are allowed in a single connection, the connection buffer should be MaxUploadBufferPerStream*MaxConcurrentStreams to allow individual streams to make progress even when one stream is blocked.

This PR shrinks the MaxUploadBufferPerStream size to 256kb (which is still large enough to allow all the resources we saw in our test clusters to be sent in a single frame), and grows the MaxUploadBufferPerConnection to accomodate concurrent streams.

I'm also opening a golang issue, reproducer, and fix for the defaults for this

adjusted http/2 buffer sizes for apiservers to prevent starvation issues between concurrent streams

@k8s-ci-robot k8s-ci-robot added do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. area/apiserver sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. labels Aug 27, 2018
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Aug 27, 2018
@liggitt
Copy link
Member Author

liggitt commented Aug 27, 2018

/sig scalability
/sig api-machinery

@k8s-ci-robot k8s-ci-robot added the sig/scalability Categorizes an issue or PR as relevant to SIG Scalability. label Aug 27, 2018
@liggitt
Copy link
Member Author

liggitt commented Aug 27, 2018

@kubernetes/sig-api-machinery-pr-reviews @kubernetes/sig-scalability-pr-reviews

/cc @deads2k

@wenjiaswe
Copy link
Contributor

cc @lavalamp @yliaog

@wenjiaswe
Copy link
Contributor

cc @jpbetz

@wojtek-t
Copy link
Member

Thanks @liggitt !

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 28, 2018
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: liggitt, wojtek-t

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-github-robot
Copy link

Automatic merge from submit-queue (batch tested with PRs 67694, 64973, 67902). If you want to cherry-pick this change to another branch, please follow the instructions here.

@mbohlool
Copy link
Contributor

does it make sense to add a test for this?

@liggitt
Copy link
Member Author

liggitt commented Sep 17, 2018

I have a reproducer for a golang issue queued up, but exercising this bug requires an aggregated API server whose rest handler makes a call to an aggregated API… pretty involved for a bug I'd rather see fixed by the runtime defaults

k8s-ci-robot added a commit that referenced this pull request Sep 26, 2018
…2-upstream-release-1.9

[1.9] Automated cherry pick of #67902: Size http2 buffers to allow concurrent streams
k8s-ci-robot added a commit that referenced this pull request Oct 1, 2018
…2-upstream-release-1.10

[1.10] Automated cherry pick of #67902: Size http2 buffers to allow concurrent streams
@liggitt liggitt deleted the http2-buffers branch October 3, 2018 15:33
k8s-ci-robot added a commit that referenced this pull request Oct 4, 2018
…2-upstream-release-1.11

[1.11] Automated cherry pick of #67902: Size http2 buffers to allow concurrent streams
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/apiserver cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/scalability Categorizes an issue or PR as relevant to SIG Scalability. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants