Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modify Reactor priorities #5826

Merged
merged 5 commits into from
Dec 23, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion blockchain/v0/reactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func (bcR *BlockchainReactor) GetChannels() []*p2p.ChannelDescriptor {
return []*p2p.ChannelDescriptor{
{
ID: BlockchainChannel,
Priority: 10,
Priority: 5,
SendQueueCapacity: 1000,
RecvBufferCapacity: 50 * 4096,
RecvMessageCapacity: bc.MaxMsgSize,
Expand Down
2 changes: 1 addition & 1 deletion blockchain/v2/reactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ func (r *BlockchainReactor) GetChannels() []*p2p.ChannelDescriptor {
return []*p2p.ChannelDescriptor{
{
ID: BlockchainChannel,
Priority: 10,
Priority: 5,
SendQueueCapacity: 2000,
RecvBufferCapacity: 50 * 4096,
RecvMessageCapacity: bc.MaxMsgSize,
Expand Down
4 changes: 2 additions & 2 deletions consensus/reactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func (conR *Reactor) GetChannels() []*p2p.ChannelDescriptor {
return []*p2p.ChannelDescriptor{
{
ID: StateChannel,
Priority: 5,
Priority: 6,
SendQueueCapacity: 100,
RecvMessageCapacity: maxMsgSize,
},
Expand All @@ -156,7 +156,7 @@ func (conR *Reactor) GetChannels() []*p2p.ChannelDescriptor {
},
{
ID: VoteChannel,
Priority: 5,
Priority: 6,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could maybe consider even 7 here. Priorities are sort of weighted during packet sending, so that if one channel has 6 and another har 5 then the 6 channel gets 6/11 packets sent while the other gets 5/11 (if I'm reading this right).

SendQueueCapacity: 100,
RecvBufferCapacity: 100 * 100,
RecvMessageCapacity: maxMsgSize,
Expand Down
2 changes: 1 addition & 1 deletion evidence/reactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (evR *Reactor) GetChannels() []*p2p.ChannelDescriptor {
return []*p2p.ChannelDescriptor{
{
ID: EvidenceChannel,
Priority: 5,
Priority: 6,
RecvMessageCapacity: maxMsgSize,
},
}
Expand Down
4 changes: 2 additions & 2 deletions statesync/reactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var (
MsgType: new(ssproto.Message),
Descriptor: &p2p.ChannelDescriptor{
ID: byte(SnapshotChannel),
Priority: 3,
Priority: 2,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@erikgrinaker do I understand correctly that sending snapshots are 1/3rd less important than sending chunks? or it should be vice versa? maybe we should just assign 5 to both channels?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Higher priority is better, right? So snapshot metadata is 3 times more important than chunks. This is because chunks are large and restoration is time-consuming, while snapshot metadata is tiny and requested in real-time, so it should have priority.

We probably want chunks to have low priority in general, for the same reason. It shouldn't have priority above e.g. consensus.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Higher priority is better, right?

right

SendQueueCapacity: 10,
RecvMessageCapacity: snapshotMsgSize,
},
Expand All @@ -43,7 +43,7 @@ var (
MsgType: new(ssproto.Message),
Descriptor: &p2p.ChannelDescriptor{
ID: byte(ChunkChannel),
Priority: 1,
Priority: 5,
SendQueueCapacity: 4,
RecvMessageCapacity: chunkMsgSize,
},
Expand Down
4 changes: 2 additions & 2 deletions test/maverick/consensus/reactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func (conR *Reactor) GetChannels() []*p2p.ChannelDescriptor {
return []*p2p.ChannelDescriptor{
{
ID: StateChannel,
Priority: 5,
Priority: 6,
SendQueueCapacity: 100,
RecvMessageCapacity: maxMsgSize,
},
Expand All @@ -158,7 +158,7 @@ func (conR *Reactor) GetChannels() []*p2p.ChannelDescriptor {
},
{
ID: VoteChannel,
Priority: 5,
Priority: 6,
SendQueueCapacity: 100,
RecvBufferCapacity: 100 * 100,
RecvMessageCapacity: maxMsgSize,
Expand Down