From 9efc1100580bf7c24c2779e6ed9f8c581cd4ede7 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Mon, 24 Oct 2022 10:43:20 +0300 Subject: [PATCH] network: it is 42 32 is a very good number, but we all know 42 is a better one. And it can even be proven by tests with higher peaking TPS values. You may wonder why is it so good? Because we're using packet-switching networks mostly and a packet is a packet almost irrespectively of how bit it is. Yet a packet has some maximum possible size (hi, MTU) and this size most of the time is 1500 (or a little less than that, hi VPN). Subtract IP header (20 for IPv4 or 40 for IPv6 not counting options), TCP header (another 20) and Neo message/payload headers (~8 for this case) and we have just a little more than 1400 bytes for our dear hashes. Which means that in a single packet most of the time we can have 42-44 of them, maybe 45. Choosing between these numbers is not hard then. --- pkg/network/server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/network/server.go b/pkg/network/server.go index 9e65ccbe3..5541d1820 100644 --- a/pkg/network/server.go +++ b/pkg/network/server.go @@ -1580,7 +1580,7 @@ func (s *Server) initStaleMemPools() { func (s *Server) broadcastTxLoop() { const ( batchTime = time.Millisecond * 50 - batchSize = 32 + batchSize = 42 ) txs := make([]util.Uint256, 0, batchSize)