Expose EnhanceYourCalm per connection limit and create a server-wide limit
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 281
Description
Kestrel's HTTP/2 `ENHANCE_YOUR_CALM` (EYC) is rate-limit limit per connection. While this is working great, I am proposing to investigate / implement the per-app global limit. The reason is that multiple connections may be an amplifier which may be useful to have limits in some cases.
## Proposal
Add an opt-in, cross-connection / global rate limit for EYC stream errors, evaluated alongside the existing per-connection limit.
### Suggested API shape
A new property on `Http2Limits` (or equivalent on `KestrelServerOptions.Limits`). Also exposing existing limit for configuration.
```diff
public sealed class Http2Limits
{
+ public int MaxEnhanceYourCalmCountPerConnection { get; set; } = 20;
+ public int MaxEnhanceYourCalmCountServerWide { get; set; } = 0;
///
/// Window over which is measured.
/// Default: 5 seconds, matching the per-connection window.
///
+ public TimeSpan EnhanceYourCalmWindow { get; set; } = TimeSpan.FromSeconds(5);
}
```
Contributor guide
Assessment
This issue has not been assessed yet.