Skip to content

Commit 90be960

Browse files
amcaseyvseanreesermsft
authored andcommitted
Clarify some log messages and comments
1 parent c1d9659 commit 90be960

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

src/Servers/Kestrel/Core/src/Internal/Http2/Http2Connection.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ internal sealed partial class Http2Connection : IHttp2StreamLifetimeHandler, IHt
4646
private const int MaxStreamPoolSize = 100;
4747
private const long StreamPoolExpiryTicks = TimeSpan.TicksPerSecond * 5;
4848

49-
private const string EnhanceYourCalmMaximumCountProperty = "Microsoft.AspNetCore.Server.Kestrel.Http2.EnhanceYourCalmCount";
49+
private const string MaximumEnhanceYourCalmCountProperty = "Microsoft.AspNetCore.Server.Kestrel.Http2.MaxEnhanceYourCalmCount";
5050

51-
private static readonly int _enhanceYourCalmMaximumCount = GetEnhanceYourCalmMaximumCount();
51+
private static readonly int _enhanceYourCalmMaximumCount = GetMaximumEnhanceYourCalmCount();
5252

53-
private static int GetEnhanceYourCalmMaximumCount()
53+
private static int GetMaximumEnhanceYourCalmCount()
5454
{
55-
var data = AppContext.GetData(EnhanceYourCalmMaximumCountProperty);
55+
var data = AppContext.GetData(MaximumEnhanceYourCalmCountProperty);
5656
if (data is int count)
5757
{
5858
return count;
@@ -1290,6 +1290,8 @@ private void AbortStream(int streamId, IOException error)
12901290
void IRequestProcessor.Tick(DateTimeOffset now)
12911291
{
12921292
Input.CancelPendingRead();
1293+
// We count EYCs over a window of a given length to avoid flagging short-lived bursts.
1294+
// At the end of each window, reset the count.
12931295
if (IsEnhanceYourCalmEnabled && ++_tickCount % EnhanceYourCalmTickWindowCount == 0)
12941296
{
12951297
Interlocked.Exchange(ref _enhanceYourCalmCount, 0);

src/Servers/Kestrel/Core/src/Internal/Http2/Http2FrameWriter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public Http2FrameWriter(
105105
_hpackEncoder = new DynamicHPackEncoder(serviceContext.ServerOptions.AllowResponseHeaderCompression);
106106

107107
_maximumFlowControlQueueSize = ConfiguredMaximumFlowControlQueueSize is null
108-
? 4 * maxStreamsPerConnection
108+
? 4 * maxStreamsPerConnection // 4 is a magic number to give us some padding above the expected maximum size
109109
: (int)ConfiguredMaximumFlowControlQueueSize;
110110

111111
if (IsMaximumFlowControlQueueSizeEnabled && _maximumFlowControlQueueSize < maxStreamsPerConnection)

src/Servers/Kestrel/Core/src/Internal/Infrastructure/KestrelTrace.Http2.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,13 @@ private static partial class Http2Log
146146

147147
// Highest shared ID is 63. New consecutive IDs start at 64
148148

149-
[LoggerMessage(64, LogLevel.Debug, @"Connection id ""{ConnectionId}"" aborted since at least ""{Count}"" ENHANCE_YOUR_CALM responses were required per second.", EventName = "Http2TooManyEnhanceYourCalms")]
149+
[LoggerMessage(64, LogLevel.Debug, @"Connection id ""{ConnectionId}"" aborted since at least {Count} ENHANCE_YOUR_CALM responses were recorded per second.", EventName = "Http2TooManyEnhanceYourCalms")]
150150
public static partial void Http2TooManyEnhanceYourCalms(ILogger logger, string connectionId, int count);
151151

152-
[LoggerMessage(65, LogLevel.Debug, @"Connection id ""{ConnectionId}"" exceeded the output flow control maximum queue size of ""{Count}"".", EventName = "Http2FlowControlQueueOperationsExceeded")]
152+
[LoggerMessage(65, LogLevel.Debug, @"Connection id ""{ConnectionId}"" exceeded the output flow control maximum queue size of {Count}.", EventName = "Http2FlowControlQueueOperationsExceeded")]
153153
public static partial void Http2FlowControlQueueOperationsExceeded(ILogger logger, string connectionId, int count);
154154

155-
[LoggerMessage(66, LogLevel.Debug, @"Connection id ""{ConnectionId}"" configured maximum flow control queue size ""{Actual}"" is less than the maximum streams per connection ""{Expected}"" - increasing to match.", EventName = "Http2FlowControlQueueMaximumTooLow")]
155+
[LoggerMessage(66, 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")]
156156
public static partial void Http2FlowControlQueueMaximumTooLow(ILogger logger, string connectionId, int expected, int actual);
157157
}
158158
}

0 commit comments

Comments
 (0)