From 4b37ecb2b5770ea7cd217b063d267b8700761358 Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Sat, 10 Nov 2018 15:18:58 +0700 Subject: [PATCH 1/2] use the same default max flow control window sizes for client and server --- client.go | 4 ++-- internal/protocol/server_parameters.go | 16 ++++------------ server.go | 4 ++-- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/client.go b/client.go index 1a90dacfc..5273103cf 100644 --- a/client.go +++ b/client.go @@ -205,11 +205,11 @@ func populateClientConfig(config *Config, createdPacketConn bool) *Config { maxReceiveStreamFlowControlWindow := config.MaxReceiveStreamFlowControlWindow if maxReceiveStreamFlowControlWindow == 0 { - maxReceiveStreamFlowControlWindow = protocol.DefaultMaxReceiveStreamFlowControlWindowClient + maxReceiveStreamFlowControlWindow = protocol.DefaultMaxReceiveStreamFlowControlWindow } maxReceiveConnectionFlowControlWindow := config.MaxReceiveConnectionFlowControlWindow if maxReceiveConnectionFlowControlWindow == 0 { - maxReceiveConnectionFlowControlWindow = protocol.DefaultMaxReceiveConnectionFlowControlWindowClient + maxReceiveConnectionFlowControlWindow = protocol.DefaultMaxReceiveConnectionFlowControlWindow } maxIncomingStreams := config.MaxIncomingStreams if maxIncomingStreams == 0 { diff --git a/internal/protocol/server_parameters.go b/internal/protocol/server_parameters.go index 6308bc8f1..0bcd6ff9e 100644 --- a/internal/protocol/server_parameters.go +++ b/internal/protocol/server_parameters.go @@ -32,21 +32,13 @@ const InitialMaxStreamData = (1 << 10) * 32 // 32 kB // This is the value that Google servers are using const InitialMaxData = (1 << 10) * 48 // 48 kB -// DefaultMaxReceiveStreamFlowControlWindowServer is the default maximum stream-level flow control window for receiving data, for the server +// DefaultMaxReceiveStreamFlowControlWindow is the default maximum stream-level flow control window for receiving data, for the server // This is the value that Google servers are using -const DefaultMaxReceiveStreamFlowControlWindowServer = 1 * (1 << 20) // 1 MB +const DefaultMaxReceiveStreamFlowControlWindow = 6 * (1 << 20) // 6 MB -// DefaultMaxReceiveConnectionFlowControlWindowServer is the default connection-level flow control window for receiving data, for the server +// DefaultMaxReceiveConnectionFlowControlWindow is the default connection-level flow control window for receiving data, for the server // This is the value that Google servers are using -const DefaultMaxReceiveConnectionFlowControlWindowServer = 1.5 * (1 << 20) // 1.5 MB - -// DefaultMaxReceiveStreamFlowControlWindowClient is the default maximum stream-level flow control window for receiving data, for the client -// This is the value that Chromium is using -const DefaultMaxReceiveStreamFlowControlWindowClient = 6 * (1 << 20) // 6 MB - -// DefaultMaxReceiveConnectionFlowControlWindowClient is the default connection-level flow control window for receiving data, for the client -// This is the value that Google servers are using -const DefaultMaxReceiveConnectionFlowControlWindowClient = 15 * (1 << 20) // 15 MB +const DefaultMaxReceiveConnectionFlowControlWindow = 15 * (1 << 20) // 12 MB // ConnectionFlowControlMultiplier determines how much larger the connection flow control windows needs to be relative to any stream's flow control window // This is the value that Chromium is using diff --git a/server.go b/server.go index 6a4f8b944..cf435e492 100644 --- a/server.go +++ b/server.go @@ -205,11 +205,11 @@ func populateServerConfig(config *Config) *Config { maxReceiveStreamFlowControlWindow := config.MaxReceiveStreamFlowControlWindow if maxReceiveStreamFlowControlWindow == 0 { - maxReceiveStreamFlowControlWindow = protocol.DefaultMaxReceiveStreamFlowControlWindowServer + maxReceiveStreamFlowControlWindow = protocol.DefaultMaxReceiveStreamFlowControlWindow } maxReceiveConnectionFlowControlWindow := config.MaxReceiveConnectionFlowControlWindow if maxReceiveConnectionFlowControlWindow == 0 { - maxReceiveConnectionFlowControlWindow = protocol.DefaultMaxReceiveConnectionFlowControlWindowServer + maxReceiveConnectionFlowControlWindow = protocol.DefaultMaxReceiveConnectionFlowControlWindow } maxIncomingStreams := config.MaxIncomingStreams if maxIncomingStreams == 0 { From df7c6a221b88ccd7b30c6d27c0c91dafcb302960 Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Sat, 10 Nov 2018 15:31:20 +0700 Subject: [PATCH 2/2] use higher initial flow control windows --- internal/protocol/server_parameters.go | 28 +++++++++++--------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/internal/protocol/server_parameters.go b/internal/protocol/server_parameters.go index 0bcd6ff9e..2968dc31b 100644 --- a/internal/protocol/server_parameters.go +++ b/internal/protocol/server_parameters.go @@ -24,26 +24,22 @@ const InitialCongestionWindow ByteCount = 32 * DefaultTCPMSS // session queues for later until it sends a public reset. const MaxUndecryptablePackets = 10 -// InitialMaxStreamData is the stream-level flow control window for receiving data -// This is the value that Google servers are using -const InitialMaxStreamData = (1 << 10) * 32 // 32 kB - -// InitialMaxData is the connection-level flow control window for receiving data -// This is the value that Google servers are using -const InitialMaxData = (1 << 10) * 48 // 48 kB - -// DefaultMaxReceiveStreamFlowControlWindow is the default maximum stream-level flow control window for receiving data, for the server -// This is the value that Google servers are using -const DefaultMaxReceiveStreamFlowControlWindow = 6 * (1 << 20) // 6 MB - -// DefaultMaxReceiveConnectionFlowControlWindow is the default connection-level flow control window for receiving data, for the server -// This is the value that Google servers are using -const DefaultMaxReceiveConnectionFlowControlWindow = 15 * (1 << 20) // 12 MB - // ConnectionFlowControlMultiplier determines how much larger the connection flow control windows needs to be relative to any stream's flow control window // This is the value that Chromium is using const ConnectionFlowControlMultiplier = 1.5 +// InitialMaxStreamData is the stream-level flow control window for receiving data +const InitialMaxStreamData = (1 << 10) * 512 // 512 kb + +// InitialMaxData is the connection-level flow control window for receiving data +const InitialMaxData = ConnectionFlowControlMultiplier * InitialMaxStreamData + +// DefaultMaxReceiveStreamFlowControlWindow is the default maximum stream-level flow control window for receiving data, for the server +const DefaultMaxReceiveStreamFlowControlWindow = 6 * (1 << 20) // 6 MB + +// DefaultMaxReceiveConnectionFlowControlWindow is the default connection-level flow control window for receiving data, for the server +const DefaultMaxReceiveConnectionFlowControlWindow = 15 * (1 << 20) // 12 MB + // WindowUpdateThreshold is the fraction of the receive window that has to be consumed before an higher offset is advertised to the client const WindowUpdateThreshold = 0.25