mirror of https://github.com/poanetwork/quorum.git
Fix for Raft stability (#886)
* increased the size of blockProposal and chainHeadEvent channels. Changed the call to mintNewBlock from a go routine to a function call. Changes done to improve performance of Raft in high load envs
This commit is contained in:
parent
f80914446a
commit
5cb92ceb3c
|
@ -1323,3 +1323,8 @@ func checkAccount(fromAcct common.Address, toAcct *common.Address) error {
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// helper function to return chainHeadChannel size
|
||||||
|
func GetChainHeadChannleSize() int {
|
||||||
|
return chainHeadChanSize
|
||||||
|
}
|
||||||
|
|
|
@ -110,7 +110,7 @@ func NewProtocolManager(raftId uint16, raftPort uint16, blockchain *core.BlockCh
|
||||||
joinExisting: joinExisting,
|
joinExisting: joinExisting,
|
||||||
blockchain: blockchain,
|
blockchain: blockchain,
|
||||||
eventMux: mux,
|
eventMux: mux,
|
||||||
blockProposalC: make(chan *types.Block),
|
blockProposalC: make(chan *types.Block, 10),
|
||||||
confChangeProposalC: make(chan raftpb.ConfChange),
|
confChangeProposalC: make(chan raftpb.ConfChange),
|
||||||
httpstopc: make(chan struct{}),
|
httpstopc: make(chan struct{}),
|
||||||
httpdonec: make(chan struct{}),
|
httpdonec: make(chan struct{}),
|
||||||
|
|
|
@ -89,7 +89,7 @@ func newMinter(config *params.ChainConfig, eth *RaftService, blockTime time.Dura
|
||||||
speculativeChain: newSpeculativeChain(),
|
speculativeChain: newSpeculativeChain(),
|
||||||
|
|
||||||
invalidRaftOrderingChan: make(chan InvalidRaftOrdering, 1),
|
invalidRaftOrderingChan: make(chan InvalidRaftOrdering, 1),
|
||||||
chainHeadChan: make(chan core.ChainHeadEvent, 1),
|
chainHeadChan: make(chan core.ChainHeadEvent, core.GetChainHeadChannleSize()),
|
||||||
txPreChan: make(chan core.NewTxsEvent, 4096),
|
txPreChan: make(chan core.NewTxsEvent, 4096),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,7 +213,7 @@ func throttle(rate time.Duration, f func()) func() {
|
||||||
|
|
||||||
for range ticker.C {
|
for range ticker.C {
|
||||||
<-request.Out()
|
<-request.Out()
|
||||||
go f()
|
f()
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue