From f1e18e2c5b572b68c494e6231cce99c275782f76 Mon Sep 17 00:00:00 2001 From: Andrew Casey Date: Tue, 26 Sep 2023 20:04:26 -0700 Subject: [PATCH] Increase the min max queue size to match 7 and 8 --- .../Kestrel/Core/src/Internal/Http2/Http2Connection.cs | 7 ++++--- .../Core/src/Internal/Infrastructure/KestrelTrace.cs | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Servers/Kestrel/Core/src/Internal/Http2/Http2Connection.cs b/src/Servers/Kestrel/Core/src/Internal/Http2/Http2Connection.cs index 5280f3e2b275..2e4a208fcc4e 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http2/Http2Connection.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http2/Http2Connection.cs @@ -189,10 +189,11 @@ public Http2Connection(HttpConnectionContext context) ? 4 * http2Limits.MaxStreamsPerConnection // 4 is a magic number to give us some padding above the expected maximum size : (int)ConfiguredMaximumFlowControlQueueSize; - if (IsMaximumFlowControlQueueSizeEnabled && _maximumFlowControlQueueSize < http2Limits.MaxStreamsPerConnection) + var minimumMaximumFlowControlQueueSize = 2 * http2Limits.MaxStreamsPerConnection; // Double to match 7.0 and 8.0 + if (IsMaximumFlowControlQueueSizeEnabled && _maximumFlowControlQueueSize < minimumMaximumFlowControlQueueSize) { - Log.Http2FlowControlQueueMaximumTooLow(context.ConnectionId, http2Limits.MaxStreamsPerConnection, _maximumFlowControlQueueSize); - _maximumFlowControlQueueSize = http2Limits.MaxStreamsPerConnection; + Log.Http2FlowControlQueueMaximumTooLow(context.ConnectionId, minimumMaximumFlowControlQueueSize, _maximumFlowControlQueueSize); + _maximumFlowControlQueueSize = minimumMaximumFlowControlQueueSize; } // Start pool off at a smaller size if the max number of streams is less than the InitialStreamPoolSize diff --git a/src/Servers/Kestrel/Core/src/Internal/Infrastructure/KestrelTrace.cs b/src/Servers/Kestrel/Core/src/Internal/Infrastructure/KestrelTrace.cs index 6a9279e5a3f0..c1a6021549f5 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Infrastructure/KestrelTrace.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Infrastructure/KestrelTrace.cs @@ -411,7 +411,7 @@ public void Http2FlowControlQueueOperationsExceeded(string connectionId, int cou Http2FlowControlQueueOperationsExceeded(_http3Logger, connectionId, count); } - [LoggerMessage(56, LogLevel.Debug, @"Connection id ""{ConnectionId}"" configured maximum flow control queue size {Actual} is less than the maximum streams per connection {Expected}. Increasing configured value to {Expected}.", EventName = "Http2FlowControlQueueMaximumTooLow")] + [LoggerMessage(56, LogLevel.Debug, @"Connection id ""{ConnectionId}"" configured maximum flow control queue size {Actual} is less than double the maximum streams per connection {Expected}. Increasing configured value to {Expected}.", EventName = "Http2FlowControlQueueMaximumTooLow")] private static partial void Http2FlowControlQueueMaximumTooLow(ILogger logger, string connectionId, int expected, int actual); public void Http2FlowControlQueueMaximumTooLow(string connectionId, int expected, int actual)