Mr.Wang from Next Door
Mr.Wang from Next Door

Reputation: 14820

Disabling Nagle algorithm in Kestrel Web Server of ASP.Net Core 2.2

KestrelServerOptions.NoDelay is not available in .NET Core 2.2 any more.

Please how can I disable Nagle algorithm in Kestrel Web Server of ASP.Net Core 2.2?

Upvotes: 1

Views: 1382

Answers (3)

mayne92
mayne92

Reputation: 11

I can't post a comment, but wanted to share this as I couldn't find the answer until I went through the commit history for ListenOptions.cs here. For .Net Core 3.0/3.1, "NoDelay" has moved to SocketTransportOptions.

Example:

var builder = new WebHostBuilder().UseKestrel(kestrelServerOptions => {...}).UseSockets(socketTransportOptions => { socketTransportOptions.NoDelay = false; }).Build();

Upvotes: 1

Sheng
Sheng

Reputation: 31

listenOptions.NoDelay = false; Means enable Nagle algorithm. Set to false to enable Nagle's algorithm for all connections. Defaults to true.

Upvotes: 0

codeninja.sj
codeninja.sj

Reputation: 4129

Disabling Nagle's algorithm is now available at ListenOptions.NoDelay

Here is the code snippet for the same

.ConfigureKestrel((context, options) =>
{
    options.Limits.MaxConcurrentConnections = 100;
    options.Listen(IPAddress.Loopback, 5000, (listenOptions =>
    {
        listenOptions.NoDelay = false;
    }));
});

Upvotes: 2

Related Questions