Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
554c0d73
Unverified
Commit
554c0d73
authored
Aug 27, 2018
by
Jordan Liggitt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Size http2 buffers to allow concurrent streams
parent
b2b3c36e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
3 deletions
+23
-3
secure_serving.go
staging/src/k8s.io/apiserver/pkg/server/secure_serving.go
+23
-3
No files found.
staging/src/k8s.io/apiserver/pkg/server/secure_serving.go
View file @
554c0d73
...
...
@@ -87,10 +87,30 @@ func (s *SecureServingInfo) Serve(handler http.Handler, shutdownTimeout time.Dur
secureServer
.
TLSConfig
.
ClientCAs
=
s
.
ClientCA
}
// At least 99% of serialized resources in surveyed clusters were smaller than 256kb.
// This should be big enough to accommodate most API POST requests in a single frame,
// and small enough to allow a per connection buffer of this size multiplied by `MaxConcurrentStreams`.
const
resourceBody99Percentile
=
256
*
1024
http2Options
:=
&
http2
.
Server
{}
// shrink the per-stream buffer and max framesize from the 1MB default while still accommodating most API POST requests in a single frame
http2Options
.
MaxUploadBufferPerStream
=
resourceBody99Percentile
http2Options
.
MaxReadFrameSize
=
resourceBody99Percentile
// use the overridden concurrent streams setting or make the default of 250 explicit so we can size MaxUploadBufferPerConnection appropriately
if
s
.
HTTP2MaxStreamsPerConnection
>
0
{
http2
.
ConfigureServer
(
secureServer
,
&
http2
.
Server
{
MaxConcurrentStreams
:
uint32
(
s
.
HTTP2MaxStreamsPerConnection
),
})
http2Options
.
MaxConcurrentStreams
=
uint32
(
s
.
HTTP2MaxStreamsPerConnection
)
}
else
{
http2Options
.
MaxConcurrentStreams
=
250
}
// increase the connection buffer size from the 1MB default to handle the specified number of concurrent streams
http2Options
.
MaxUploadBufferPerConnection
=
http2Options
.
MaxUploadBufferPerStream
*
int32
(
http2Options
.
MaxConcurrentStreams
)
// apply settings to the server
if
err
:=
http2
.
ConfigureServer
(
secureServer
,
http2Options
);
err
!=
nil
{
return
fmt
.
Errorf
(
"error configuring http2: %v"
,
err
)
}
glog
.
Infof
(
"Serving securely on %s"
,
secureServer
.
Addr
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment