pkg/idutil: reduce conflict rate from 1% to 0.005%
Perviously, we only use 8bits from member identification in id generation. The conflict rate is A(256,3)/256^3, which is around 1%. Now we use 16bites to reduce the rate to 0.005%. We can attach the full member id into id generation if needed...
This commit is contained in:
@ -358,7 +358,7 @@ func NewServer(cfg *ServerConfig) (*EtcdServer, error) {
|
||||
lstats: lstats,
|
||||
SyncTicker: time.Tick(500 * time.Millisecond),
|
||||
peerRt: prt,
|
||||
reqIDGen: idutil.NewGenerator(uint8(id), time.Now()),
|
||||
reqIDGen: idutil.NewGenerator(uint16(id), time.Now()),
|
||||
forceVersionC: make(chan struct{}),
|
||||
msgSnapC: make(chan raftpb.Message, maxInFlightMsgSnap),
|
||||
}
|
||||
|
Reference in New Issue
Block a user