From 15475b437bbb0535f4849139675e1139534ad623 Mon Sep 17 00:00:00 2001 From: yutianwu Date: Wed, 21 Nov 2018 11:08:37 +0800 Subject: [PATCH 1/2] change default params --- config/config.go | 10 +++++----- mempool/mempool.go | 3 ++- mempool/reactor.go | 6 +++--- p2p/conn/connection.go | 10 +++++----- types/params.go | 4 ++-- 5 files changed, 17 insertions(+), 16 deletions(-) diff --git a/config/config.go b/config/config.go index d0e075477..a12d12c7d 100644 --- a/config/config.go +++ b/config/config.go @@ -351,10 +351,10 @@ func DefaultP2PConfig() *P2PConfig { AddrBookStrict: true, MaxNumInboundPeers: 40, MaxNumOutboundPeers: 10, - FlushThrottleTimeout: 100, - MaxPacketMsgPayloadSize: 1024, // 1 kB - SendRate: 5120000, // 5 mB/s - RecvRate: 5120000, // 5 mB/s + FlushThrottleTimeout: 10, + MaxPacketMsgPayloadSize: 1024 * 1024, // 1 MB + SendRate: 50 * 1024 * 1024, // 5 mB/s + RecvRate: 50 * 1024 * 1024, // 5 mB/s PexReactor: true, SeedMode: false, AllowDuplicateIP: true, // so non-breaking yet @@ -488,7 +488,7 @@ func DefaultConsensusConfig() *ConsensusConfig { SkipTimeoutCommit: false, CreateEmptyBlocks: true, CreateEmptyBlocksInterval: 0, - PeerGossipSleepDuration: 100, + PeerGossipSleepDuration: 10, PeerQueryMaj23SleepDuration: 2000, BlockTimeIota: 1000, } diff --git a/mempool/mempool.go b/mempool/mempool.go index 268af5ed1..ef20ed6f2 100644 --- a/mempool/mempool.go +++ b/mempool/mempool.go @@ -462,7 +462,8 @@ func (mem *Mempool) ReapMaxBytesMaxGas(maxBytes, maxGas int64) types.Txs { for e := mem.txs.Front(); e != nil; e = e.Next() { memTx := e.Value.(*mempoolTx) // Check total size requirement - aminoOverhead := int64(amino.UvarintSize(uint64(len(memTx.tx)))) + // TODO: merge tendermint + aminoOverhead := int64(amino.UvarintSize(uint64(len(memTx.tx)))) + 1 if maxBytes > -1 && totalBytes+int64(len(memTx.tx))+aminoOverhead > maxBytes { return txs } diff --git a/mempool/reactor.go b/mempool/reactor.go index bbb9337c6..25a5be09c 100644 --- a/mempool/reactor.go +++ b/mempool/reactor.go @@ -18,9 +18,9 @@ import ( const ( MempoolChannel = byte(0x30) - maxMsgSize = 1048576 // 1MB TODO make it configurable - peerCatchupSleepIntervalMS = 100 // If peer is behind, sleep this amount - MempoolPacketChannelSize = 1024 * 8 // 8K messages can be queued + maxMsgSize = 1048576 // 1MB TODO make it configurable + peerCatchupSleepIntervalMS = 100 // If peer is behind, sleep this amount + MempoolPacketChannelSize = 1024 * 200 // 200K messages can be queued ) type MempoolPacket struct { diff --git a/p2p/conn/connection.go b/p2p/conn/connection.go index 37900422c..70716d42a 100644 --- a/p2p/conn/connection.go +++ b/p2p/conn/connection.go @@ -18,7 +18,7 @@ import ( ) const ( - defaultMaxPacketMsgPayloadSize = 1024 + defaultMaxPacketMsgPayloadSize = 1024 * 1024 // 1MB numBatchPacketMsgs = 10 minReadBufferSize = 1024 @@ -28,13 +28,13 @@ const ( // some of these defaults are written in the user config // flushThrottle, sendRate, recvRate // TODO: remove values present in config - defaultFlushThrottle = 100 * time.Millisecond + defaultFlushThrottle = 10 * time.Millisecond defaultSendQueueCapacity = 1 defaultRecvBufferCapacity = 4096 - defaultRecvMessageCapacity = 22020096 // 21MB - defaultSendRate = int64(512000) // 500KB/s - defaultRecvRate = int64(512000) // 500KB/s + defaultRecvMessageCapacity = 22020096 // 21MB + defaultSendRate = int64(50 * 1024 * 1024) // 50MB/s + defaultRecvRate = int64(50 * 1024 * 1024) // 50MKB/s defaultSendTimeout = 10 * time.Second defaultPingInterval = 60 * time.Second defaultPongTimeout = 45 * time.Second diff --git a/types/params.go b/types/params.go index a7301d063..46207c17c 100644 --- a/types/params.go +++ b/types/params.go @@ -11,7 +11,7 @@ const ( MaxBlockSizeBytes = 104857600 // 100MB // BlockPartSizeBytes is the size of one block part. - BlockPartSizeBytes = 65536 // 64kB + BlockPartSizeBytes = 1024 * 1024 // 1MB ) // ConsensusParams contains consensus critical parameters that determine the @@ -43,7 +43,7 @@ func DefaultConsensusParams() *ConsensusParams { // DefaultBlockSize returns a default BlockSize. func DefaultBlockSize() BlockSize { return BlockSize{ - MaxBytes: 22020096, // 21MB + MaxBytes: 1024 * 1024, // 1M MaxGas: -1, } } From ed87b99709dda46b937e571728d07ab07132c19e Mon Sep 17 00:00:00 2001 From: yutianwu Date: Wed, 21 Nov 2018 11:11:47 +0800 Subject: [PATCH 2/2] update comments --- config/config.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/config.go b/config/config.go index a12d12c7d..936173015 100644 --- a/config/config.go +++ b/config/config.go @@ -353,8 +353,8 @@ func DefaultP2PConfig() *P2PConfig { MaxNumOutboundPeers: 10, FlushThrottleTimeout: 10, MaxPacketMsgPayloadSize: 1024 * 1024, // 1 MB - SendRate: 50 * 1024 * 1024, // 5 mB/s - RecvRate: 50 * 1024 * 1024, // 5 mB/s + SendRate: 50 * 1024 * 1024, // 50 MB/s + RecvRate: 50 * 1024 * 1024, // 50 MB/s PexReactor: true, SeedMode: false, AllowDuplicateIP: true, // so non-breaking yet