Browse Source

config: increase MaxPacketMsgPayloadSize to 1400

The MTU (Maximum Transmission Unit) for Ethernet is 1500 bytes.
The IP header and the TCP header take up 20 bytes each at least (unless
optional header fields are used) and thus the max for (non-Jumbo frame)
Ethernet is 1500 - 20 -20 = 1460
Source: https://stackoverflow.com/a/3074427/820520
pull/5810/head
Anton Kaliaev 4 years ago
parent
commit
ced66e4eb5
2 changed files with 16 additions and 10 deletions
  1. +14
    -9
      config/config.go
  2. +2
    -1
      p2p/conn/connection.go

+ 14
- 9
config/config.go View File

@ -561,15 +561,20 @@ func DefaultP2PConfig() *P2PConfig {
MaxNumOutboundPeers: 10, MaxNumOutboundPeers: 10,
PersistentPeersMaxDialPeriod: 0 * time.Second, PersistentPeersMaxDialPeriod: 0 * time.Second,
FlushThrottleTimeout: 100 * time.Millisecond, FlushThrottleTimeout: 100 * time.Millisecond,
MaxPacketMsgPayloadSize: 1024, // 1 kB
SendRate: 5120000, // 5 mB/s
RecvRate: 5120000, // 5 mB/s
PexReactor: true,
SeedMode: false,
AllowDuplicateIP: false,
HandshakeTimeout: 20 * time.Second,
DialTimeout: 3 * time.Second,
TestDialFail: false,
// The MTU (Maximum Transmission Unit) for Ethernet is 1500 bytes.
// The IP header and the TCP header take up 20 bytes each at least (unless
// optional header fields are used) and thus the max for (non-Jumbo frame)
// Ethernet is 1500 - 20 -20 = 1460
// Source: https://stackoverflow.com/a/3074427/820520
MaxPacketMsgPayloadSize: 1400,
SendRate: 5120000, // 5 mB/s
RecvRate: 5120000, // 5 mB/s
PexReactor: true,
SeedMode: false,
AllowDuplicateIP: false,
HandshakeTimeout: 20 * time.Second,
DialTimeout: 3 * time.Second,
TestDialFail: false,
} }
} }


+ 2
- 1
p2p/conn/connection.go View File

@ -25,7 +25,8 @@ import (
) )
const ( const (
defaultMaxPacketMsgPayloadSize = 1024
// mirrors MaxPacketMsgPayloadSize from config/config.go
defaultMaxPacketMsgPayloadSize = 1400
numBatchPacketMsgs = 10 numBatchPacketMsgs = 10
minReadBufferSize = 1024 minReadBufferSize = 1024


Loading…
Cancel
Save