go-nebulas
go-nebulas copied to clipboard
[Design] Add optimize strategy for message dispatching in network
In current implementation of go-nebulas, a network message, for example, a newtx
message will broadcast to whole network, each network will also relay to peer nodes as well. That makes broadcast storm
effect, which still has some impaction even if we implement receved_message
strategy.
When a duplicated message are spread in network, they bring lots of computation pressure to blockchain core
, especially newtx
message during stress test.
To optimize that, I suppose to introduce a duplication message check in dispatcher.go
module.
In function PutMessage()
, check whether this message are dispatched. If so, ignore; otherwise escalate to upper level.
Update:
add metrics for duplicated messages in commit 4d843a033550daf21cfb678eb18e12595c6c2cca
So far, this strategy works, and the following commits are related to this change:
5adbb32d5e23f859c045ffc66b87d8a0adf4d709 net: dispatcher.go. support enable & disable duplicate msg filter for…
d6cc4e4bb5651ec78c2cb4f292d11c9d20c9a229 core: block_pool.go. remove filter from downloaded block message.
The reason why we introduce this strategy is the broadcast storm, we should find new strategy to prevent that.
#56 seems a bug related to this strategy.