diff --git a/README.md b/README.md index bfb3ed4..d9fc6a7 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,6 @@ The Transport has these options: - **DeferSend**: This defers sends to the Transport Thread which increases chances for multiple sends to coalesce. This options defaults to true. -- **ThreadCount**: Specifies the number of Transport Threads. This defaults to the number of logical processors in the system divided by 4. +- **ThreadCount**: Specifies the number of Transport Threads. This defaults to the number of logical processors in the system, maxed to 16. - **AioSend/AioReceive**: Uses Linux AIO system calls to batch send and receive calls. AioSend implies DeferSend. These options default to true. diff --git a/src/RedHatX.AspNetCore.Server.Kestrel.Transport.Linux/TransportOptions.cs b/src/RedHatX.AspNetCore.Server.Kestrel.Transport.Linux/TransportOptions.cs index dc9eaa7..fed354c 100644 --- a/src/RedHatX.AspNetCore.Server.Kestrel.Transport.Linux/TransportOptions.cs +++ b/src/RedHatX.AspNetCore.Server.Kestrel.Transport.Linux/TransportOptions.cs @@ -20,11 +20,10 @@ public LinuxTransportOptions() AioSend = true; AioReceive = true; - // Benchmarking Techempower Json on 24-core machine with hyper threading (ProcessorCount = 48) - // shows best performance at ThreadCount 12. - // TODO: what happens if hyperthreading is disabled? Perhaps this should be half the cores? - // TODO: benchmark more scenarios to validate this is a good default. - ThreadCount = Math.Max((Environment.ProcessorCount + 2) / 4, 1); + // Use a default ThreadCount that wont cause the number of threads + // to be a bottleneck. + // Users that want to optimize, should do their own benchmarks. + ThreadCount = Math.Min(Environment.ProcessorCount, 16); } internal bool ReceiveOnIncomingCpu