From 6bcf7643df43e06fde17f5ebfd1a677ff116d8c0 Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Thu, 21 Jul 2016 16:05:50 -0700 Subject: [PATCH] Do not allocate large write task queues (#1005) --- .../Internal/Http/SocketOutput.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Http/SocketOutput.cs b/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Http/SocketOutput.cs index fc43cd67fa..7c6be2e7b0 100644 --- a/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Http/SocketOutput.cs +++ b/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Http/SocketOutput.cs @@ -18,7 +18,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Internal.Http private const int _maxPendingWrites = 3; private const int _maxBytesPreCompleted = 65536; - private const int _initialTaskQueues = 64; + // Well behaved WriteAsync users should await returned task, so there is no need to allocate more per connection by default + private const int _initialTaskQueues = 1; private const int _maxPooledWriteContexts = 32; private static readonly WaitCallback _returnBlocks = (state) => ReturnBlocks((MemoryPoolBlock)state);