Skip to content

Commit 47ac274

Browse files
authored
Add Kestrel keep alive ping section (#20261)
1 parent d94bb6d commit 47ac274

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

aspnetcore/fundamentals/servers/kestrel.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,30 @@ webBuilder.ConfigureKestrel(serverOptions =>
340340

341341
The default value is 96 KB (98,304).
342342

343+
::: moniker range=">= aspnetcore-5.0"
344+
345+
### HTTP/2 keep alive ping configuration
346+
347+
Kestrel can be configured to send HTTP/2 pings to connected clients. HTTP/2 pings serve multiple purposes:
348+
349+
* Keep idle connections alive. Some clients and proxy servers close connections that are idle. HTTP/2 pings are considered as activity on a connection and prevent the connection from being closed as idle.
350+
* Close unhealthy connections. Connections where the client doesn't respond to the keep alive ping in the configured time are closed by the server.
351+
352+
There are two configuration options related to HTTP/2 keep alive pings:
353+
354+
* `Http2.KeepAlivePingInterval` is a `TimeSpan` that configures the ping internal. The server sends a keep alive ping to the client if it doesn't receive any frames for this period of time. Keep alive pings are disabled when this option is set to `TimeSpan.MaxValue`. The default value is `TimeSpan.MaxValue`.
355+
* `Http2.KeepAlivePingTimeout` is a `TimeSpan` that configures the ping timeout. If the server doesn't receive any frames, such as a response ping, during this timeout then the connection is closed. Keep alive timeout is disabled when this option is set to `TimeSpan.MaxValue`. The default value is 20 seconds.
356+
357+
```csharp
358+
webBuilder.ConfigureKestrel(serverOptions =>
359+
{
360+
serverOptions.Limits.Http2.KeepAlivePingInterval = TimeSpan.FromSeconds(30);
361+
serverOptions.Limits.Http2.KeepAlivePingTimeout = TimeSpan.FromSeconds(60);
362+
});
363+
```
364+
365+
::: moniker-end
366+
343367
### Trailers
344368

345369
[!INCLUDE[](~/includes/trailers.md)]

0 commit comments

Comments
 (0)