diff --git a/src/Nethermind/Nethermind.Init/Steps/InitializeNetwork.cs b/src/Nethermind/Nethermind.Init/Steps/InitializeNetwork.cs index 1e8a8aaa21c..34ecca8ab75 100644 --- a/src/Nethermind/Nethermind.Init/Steps/InitializeNetwork.cs +++ b/src/Nethermind/Nethermind.Init/Steps/InitializeNetwork.cs @@ -495,7 +495,6 @@ private async Task InitPeer() encryptionHandshakeServiceA, _api.SessionMonitor, _api.DisconnectsAnalyzer, - _networkConfig.P2PHandlerThreadCount, _api.LogManager); await _api.RlpxPeer.Init(); diff --git a/src/Nethermind/Nethermind.Network.Test/Rlpx/RlpxPeerTests.cs b/src/Nethermind/Nethermind.Network.Test/Rlpx/RlpxPeerTests.cs index d549704a7dd..57754d9dabf 100644 --- a/src/Nethermind/Nethermind.Network.Test/Rlpx/RlpxPeerTests.cs +++ b/src/Nethermind/Nethermind.Network.Test/Rlpx/RlpxPeerTests.cs @@ -1,16 +1,16 @@ // Copyright (c) 2021 Demerzel Solutions Limited // This file is part of the Nethermind library. -// +// // The Nethermind library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -// +// // The Nethermind library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. -// +// // You should have received a copy of the GNU Lesser General Public License // along with the Nethermind. If not, see . @@ -40,7 +40,6 @@ public async Task Start_stop() Substitute.For(), Substitute.For(), NullDisconnectsAnalyzer.Instance, - 1, LimboLogs.Instance); await host.Init(); await host.Shutdown(); diff --git a/src/Nethermind/Nethermind.Network/Config/INetworkConfig.cs b/src/Nethermind/Nethermind.Network/Config/INetworkConfig.cs index 1e0d6ae1ef3..6c406326b58 100644 --- a/src/Nethermind/Nethermind.Network/Config/INetworkConfig.cs +++ b/src/Nethermind/Nethermind.Network/Config/INetworkConfig.cs @@ -1,16 +1,16 @@ // Copyright (c) 2021 Demerzel Solutions Limited // This file is part of the Nethermind library. -// +// // The Nethermind library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -// +// // The Nethermind library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. -// +// // You should have received a copy of the GNU Lesser General Public License // along with the Nethermind. If not, see . @@ -81,8 +81,5 @@ public interface INetworkConfig : IConfig [ConfigItem(DefaultValue = "", Description = "Bootnodes")] string Bootnodes { get; set; } - - [ConfigItem(DefaultValue = "0", Description = "[TECHNICAL] Set P2P handler thread count. Set this to a low number such as 1 or 2 if you have too slow block processing during old bodies or old receipts sync which may cause missed attestation. Defaults to processor count - 2.")] - int P2PHandlerThreadCount { get; set; } } } diff --git a/src/Nethermind/Nethermind.Network/Config/NetworkConfig.cs b/src/Nethermind/Nethermind.Network/Config/NetworkConfig.cs index 076f65e9fd6..24f4360f076 100644 --- a/src/Nethermind/Nethermind.Network/Config/NetworkConfig.cs +++ b/src/Nethermind/Nethermind.Network/Config/NetworkConfig.cs @@ -1,16 +1,16 @@ // Copyright (c) 2021 Demerzel Solutions Limited // This file is part of the Nethermind library. -// +// // The Nethermind library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -// +// // The Nethermind library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. -// +// // You should have received a copy of the GNU Lesser General Public License // along with the Nethermind. If not, see . @@ -42,6 +42,5 @@ public class NetworkConfig : INetworkConfig public string Bootnodes { get; set; } = string.Empty; public int DiscoveryPort { get; set; } = 30303; public int P2PPort { get; set; } = 30303; - public int P2PHandlerThreadCount { get; set; } = 0; } } diff --git a/src/Nethermind/Nethermind.Network/Rlpx/NettyHandshakeHandler.cs b/src/Nethermind/Nethermind.Network/Rlpx/NettyHandshakeHandler.cs index 78dff8e8abc..87a78d8a6a2 100644 --- a/src/Nethermind/Nethermind.Network/Rlpx/NettyHandshakeHandler.cs +++ b/src/Nethermind/Nethermind.Network/Rlpx/NettyHandshakeHandler.cs @@ -1,16 +1,16 @@ // Copyright (c) 2021 Demerzel Solutions Limited // This file is part of the Nethermind library. -// +// // The Nethermind library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -// +// // The Nethermind library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. -// +// // You should have received a copy of the GNU Lesser General Public License // along with the Nethermind. If not, see . diff --git a/src/Nethermind/Nethermind.Network/Rlpx/RlpxHost.cs b/src/Nethermind/Nethermind.Network/Rlpx/RlpxHost.cs index 6edc57d888d..593c72f6180 100644 --- a/src/Nethermind/Nethermind.Network/Rlpx/RlpxHost.cs +++ b/src/Nethermind/Nethermind.Network/Rlpx/RlpxHost.cs @@ -1,16 +1,16 @@ // Copyright (c) 2021 Demerzel Solutions Limited // This file is part of the Nethermind library. -// +// // The Nethermind library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -// +// // The Nethermind library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. -// +// // You should have received a copy of the GNU Lesser General Public License // along with the Nethermind. If not, see . @@ -54,9 +54,7 @@ public class RlpxHost : IRlpxHost private readonly ILogger _logger; private readonly ISessionMonitor _sessionMonitor; private readonly IDisconnectsAnalyzer _disconnectsAnalyzer; - - // Main executor group. Used to execute snappy decompression and message deserialization. - private readonly IEventExecutorGroup _group; + private IEventExecutorGroup _group; public RlpxHost(IMessageSerializationService serializationService, PublicKey localNodeId, @@ -64,7 +62,6 @@ public RlpxHost(IMessageSerializationService serializationService, IHandshakeService handshakeService, ISessionMonitor sessionMonitor, IDisconnectsAnalyzer disconnectsAnalyzer, - int handlerThreadCount, ILogManager logManager) { // .NET Core definitely got the easy logging setup right :D @@ -82,15 +79,7 @@ public RlpxHost(IMessageSerializationService serializationService, // new LoggerFilterOptions { MinLevel = Microsoft.Extensions.Logging.LogLevel.Warning }); // InternalLoggerFactory.DefaultFactory = loggerFactory; - if (handlerThreadCount == 0) - { - // Using slightly less than processor count to give some compute for other tasks - // The thread count is rarely a limit, outside of old bodies/old receipts, but it may improve - // some latency as a peer message may get blocked by another peer's message deserialization - // if thread count is 1. - handlerThreadCount = Math.Max(1, Environment.ProcessorCount - 2); - } - _group = new MultithreadEventLoopGroup(handlerThreadCount); + _group = new SingleThreadEventLoop(); _serializationService = serializationService ?? throw new ArgumentNullException(nameof(serializationService)); _logManager = logManager ?? throw new ArgumentNullException(nameof(logManager)); _logger = logManager.GetClassLogger();