Phase 25 of 30 · Topic 25.5

Kestrel Socket Tuning, HTTP/3 (QUIC) & Transport Multiplexing

1Concept

Kestrel is .NET's cross-platform web server. It supports HTTP/1.1, HTTP/2 (binary multiplexing), and HTTP/3 over QUIC (UDP transport) for low latency on unreliable mobile networks.

2Architecture Diagram

HTTP/1.1: 1 TCP connection per sequential request (Head-of-line blocking)
HTTP/2:   1 TCP connection with multiple multiplexed streams
HTTP/3:   QUIC UDP transport (Zero Head-of-Line packet drop stalls!)

3Code Example

C# 13 & .NET 9
using System;

public class KestrelTuningDemo
{
    public static void Main()
    {
        Console.WriteLine("Kestrel Socket Configuration:");
        Console.WriteLine("builder.WebHost.ConfigureKestrel(options => {");
        Console.WriteLine("    options.Limits.MaxConcurrentConnections = 100_000;");
        Console.WriteLine("    options.Limits.Http2.MaxStreamsPerConnection = 250;");
        Console.WriteLine("});");
    }
}

4Expected Output

Kestrel Socket Configuration:
builder.WebHost.ConfigureKestrel(options => {
    options.Limits.MaxConcurrentConnections = 100_000;
    options.Limits.Http2.MaxStreamsPerConnection = 250;
});

5Key Takeaways

  • Kestrel is ranked among the fastest web servers in TechEmpower benchmarks.
  • HTTP/3 eliminates TCP connection handshake latency.
  • Configure socket buffer sizes for high-throughput streaming.