Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cap DotNetty Threads #7134

Merged
merged 1 commit into from
Jun 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/Nethermind/Nethermind.Network/Rlpx/RlpxHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
using Nethermind.Network.P2P.EventArg;
using Nethermind.Network.Rlpx.Handshake;
using Nethermind.Stats.Model;
using ILogger = Nethermind.Logging.InterfaceLogger;
using LogLevel = DotNetty.Handlers.Logging.LogLevel;

namespace Nethermind.Network.Rlpx
Expand Down Expand Up @@ -105,8 +104,13 @@ public async Task Init()

try
{
_bossGroup = new MultithreadEventLoopGroup();
_workerGroup = new MultithreadEventLoopGroup();
// Default is LogicalCoreCount * 2
// - so with two groups and 32 logical cores, we would have 128 threads
// Max at 8 threads per group for 16 threads total
// Min of 2 threads per group for 4 threads total
var threads = Math.Clamp(Environment.ProcessorCount / 2, min: 2, max: 8);
_bossGroup = new MultithreadEventLoopGroup(threads);
_workerGroup = new MultithreadEventLoopGroup(threads);

ServerBootstrap bootstrap = new();
bootstrap
Expand Down